summaryrefslogtreecommitdiffstats
path: root/telephony
diff options
context:
space:
mode:
authorJohn Wang <johnwang@google.com>2010-03-11 13:56:59 -0800
committerAndroid (Google) Code Review <android-gerrit@google.com>2010-03-11 13:56:59 -0800
commiteb3035cbcad06a9154f69e9bb22231b0632946b2 (patch)
treee1053b4912011d96f695e21b0ebaa86c88bca675 /telephony
parentc95142d4a0ab7bebb899167da17c70c3196abbe4 (diff)
parent41a46718b3deec95661e149b3acea2a9e54016be (diff)
downloadframeworks_base-eb3035cbcad06a9154f69e9bb22231b0632946b2.zip
frameworks_base-eb3035cbcad06a9154f69e9bb22231b0632946b2.tar.gz
frameworks_base-eb3035cbcad06a9154f69e9bb22231b0632946b2.tar.bz2
Merge "Make getCellLocation return null if not available."
Diffstat (limited to 'telephony')
-rw-r--r--telephony/java/android/telephony/CellLocation.java5
-rw-r--r--telephony/java/android/telephony/TelephonyManager.java5
-rw-r--r--telephony/java/android/telephony/cdma/CdmaCellLocation.java12
-rw-r--r--telephony/java/android/telephony/gsm/GsmCellLocation.java7
4 files changed, 28 insertions, 1 deletions
diff --git a/telephony/java/android/telephony/CellLocation.java b/telephony/java/android/telephony/CellLocation.java
index f763d3f..2edfc23 100644
--- a/telephony/java/android/telephony/CellLocation.java
+++ b/telephony/java/android/telephony/CellLocation.java
@@ -79,6 +79,11 @@ public abstract class CellLocation {
public abstract void fillInNotifierBundle(Bundle bundle);
/**
+ * @hide
+ */
+ public abstract boolean isEmpty();
+
+ /**
* Return a new CellLocation object representing an unknown
* location, or null for unknown/none phone radio types.
*
diff --git a/telephony/java/android/telephony/TelephonyManager.java b/telephony/java/android/telephony/TelephonyManager.java
index 6685c18..a6b1d93 100644
--- a/telephony/java/android/telephony/TelephonyManager.java
+++ b/telephony/java/android/telephony/TelephonyManager.java
@@ -203,7 +203,10 @@ public class TelephonyManager {
public CellLocation getCellLocation() {
try {
Bundle bundle = getITelephony().getCellLocation();
- return CellLocation.newFromBundle(bundle);
+ CellLocation cl = CellLocation.newFromBundle(bundle);
+ if (cl.isEmpty())
+ return null;
+ return cl;
} catch (RemoteException ex) {
return null;
} catch (NullPointerException ex) {
diff --git a/telephony/java/android/telephony/cdma/CdmaCellLocation.java b/telephony/java/android/telephony/cdma/CdmaCellLocation.java
index 2a0f8cd..84db830 100644
--- a/telephony/java/android/telephony/cdma/CdmaCellLocation.java
+++ b/telephony/java/android/telephony/cdma/CdmaCellLocation.java
@@ -204,6 +204,18 @@ public class CdmaCellLocation extends CellLocation {
bundleToFill.putInt("networkId", this.mNetworkId);
}
+ /**
+ * @hide
+ */
+ public boolean isEmpty() {
+ return (this.mBaseStationId == -1 &&
+ this.mBaseStationLatitude == INVALID_LAT_LONG &&
+ this.mBaseStationLongitude == INVALID_LAT_LONG &&
+ this.mSystemId == -1 &&
+ this.mNetworkId == -1);
+ }
+
+
}
diff --git a/telephony/java/android/telephony/gsm/GsmCellLocation.java b/telephony/java/android/telephony/gsm/GsmCellLocation.java
index 0d4e0be..fa1f985 100644
--- a/telephony/java/android/telephony/gsm/GsmCellLocation.java
+++ b/telephony/java/android/telephony/gsm/GsmCellLocation.java
@@ -119,4 +119,11 @@ public class GsmCellLocation extends CellLocation {
m.putInt("lac", mLac);
m.putInt("cid", mCid);
}
+
+ /**
+ * @hide
+ */
+ public boolean isEmpty() {
+ return (mLac == -1 && mCid == -1);
+ }
}