summaryrefslogtreecommitdiffstats
path: root/telephony
diff options
context:
space:
mode:
authorMark Vandevoorde <mtv@google.com>2010-02-11 12:50:34 -0800
committerMark Vandevoorde <mtv@google.com>2010-02-12 10:13:12 -0800
commit9384b145e625b3bb6ff8b829ddb1466e16a78f49 (patch)
treed5aeedd6a1ccbc3ef1584ef95f9821e6251b4644 /telephony
parent111c178bc46fa2c61027bc3870a2c8c442936821 (diff)
downloadframeworks_base-9384b145e625b3bb6ff8b829ddb1466e16a78f49.zip
frameworks_base-9384b145e625b3bb6ff8b829ddb1466e16a78f49.tar.gz
frameworks_base-9384b145e625b3bb6ff8b829ddb1466e16a78f49.tar.bz2
Map base station lat-lng of "0","0" to undefined.
Also introduce a public constant for the invalid lat/lng value. Change-Id: Ifaa1e563bfa94c06dfbba51157b9160055442682
Diffstat (limited to 'telephony')
-rw-r--r--telephony/java/android/telephony/cdma/CdmaCellLocation.java29
-rw-r--r--telephony/java/android/telephony/gsm/GsmCellLocation.java6
-rw-r--r--telephony/java/com/android/internal/telephony/cdma/CdmaServiceStateTracker.java20
3 files changed, 35 insertions, 20 deletions
diff --git a/telephony/java/android/telephony/cdma/CdmaCellLocation.java b/telephony/java/android/telephony/cdma/CdmaCellLocation.java
index 7ef7747..2a0f8cd 100644
--- a/telephony/java/android/telephony/cdma/CdmaCellLocation.java
+++ b/telephony/java/android/telephony/cdma/CdmaCellLocation.java
@@ -26,12 +26,17 @@ public class CdmaCellLocation extends CellLocation {
private int mBaseStationId = -1;
/**
+ * @hide
+ */
+ public final static int INVALID_LAT_LONG = Integer.MAX_VALUE;
+
+ /**
* Latitude is a decimal number as specified in 3GPP2 C.S0005-A v6.0.
* It is represented in units of 0.25 seconds and ranges from -1296000
* to 1296000, both values inclusive (corresponding to a range of -90
* to +90 degrees). Integer.MAX_VALUE is considered invalid value.
*/
- private int mBaseStationLatitude = Integer.MAX_VALUE;
+ private int mBaseStationLatitude = INVALID_LAT_LONG;
/**
* Longitude is a decimal number as specified in 3GPP2 C.S0005-A v6.0.
@@ -39,7 +44,7 @@ public class CdmaCellLocation extends CellLocation {
* to 2592000, both values inclusive (corresponding to a range of -180
* to +180 degrees). Integer.MAX_VALUE is considered invalid value.
*/
- private int mBaseStationLongitude = Integer.MAX_VALUE;
+ private int mBaseStationLongitude = INVALID_LAT_LONG;
private int mSystemId = -1;
private int mNetworkId = -1;
@@ -51,8 +56,8 @@ public class CdmaCellLocation extends CellLocation {
*/
public CdmaCellLocation() {
this.mBaseStationId = -1;
- this.mBaseStationLatitude = Integer.MAX_VALUE;
- this.mBaseStationLongitude = Integer.MAX_VALUE;
+ this.mBaseStationLatitude = INVALID_LAT_LONG;
+ this.mBaseStationLongitude = INVALID_LAT_LONG;
this.mSystemId = -1;
this.mNetworkId = -1;
}
@@ -60,12 +65,12 @@ public class CdmaCellLocation extends CellLocation {
/**
* Initialize the object from a bundle.
*/
- public CdmaCellLocation(Bundle bundleWithValues) {
- this.mBaseStationId = bundleWithValues.getInt("baseStationId");
- this.mBaseStationLatitude = bundleWithValues.getInt("baseStationLatitude");
- this.mBaseStationLongitude = bundleWithValues.getInt("baseStationLongitude");
- this.mSystemId = bundleWithValues.getInt("systemId");
- this.mNetworkId = bundleWithValues.getInt("networkId");
+ public CdmaCellLocation(Bundle bundle) {
+ this.mBaseStationId = bundle.getInt("baseStationId", mBaseStationId);
+ this.mBaseStationLatitude = bundle.getInt("baseStationLatitude", mBaseStationLatitude);
+ this.mBaseStationLongitude = bundle.getInt("baseStationLongitude", mBaseStationLongitude);
+ this.mSystemId = bundle.getInt("systemId", mSystemId);
+ this.mNetworkId = bundle.getInt("networkId", mNetworkId);
}
/**
@@ -108,8 +113,8 @@ public class CdmaCellLocation extends CellLocation {
*/
public void setStateInvalid() {
this.mBaseStationId = -1;
- this.mBaseStationLatitude = Integer.MAX_VALUE;
- this.mBaseStationLongitude = Integer.MAX_VALUE;
+ 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 637a11c..0d4e0be 100644
--- a/telephony/java/android/telephony/gsm/GsmCellLocation.java
+++ b/telephony/java/android/telephony/gsm/GsmCellLocation.java
@@ -38,8 +38,8 @@ public class GsmCellLocation extends CellLocation {
* Initialize the object from a bundle.
*/
public GsmCellLocation(Bundle bundle) {
- mLac = bundle.getInt("lac");
- mCid = bundle.getInt("cid");
+ mLac = bundle.getInt("lac", mLac);
+ mCid = bundle.getInt("cid", mCid);
}
/**
@@ -120,5 +120,3 @@ public class GsmCellLocation extends CellLocation {
m.putInt("cid", mCid);
}
}
-
-
diff --git a/telephony/java/com/android/internal/telephony/cdma/CdmaServiceStateTracker.java b/telephony/java/com/android/internal/telephony/cdma/CdmaServiceStateTracker.java
index b64e5bd..c351289 100644
--- a/telephony/java/com/android/internal/telephony/cdma/CdmaServiceStateTracker.java
+++ b/telephony/java/com/android/internal/telephony/cdma/CdmaServiceStateTracker.java
@@ -357,8 +357,8 @@ final class CdmaServiceStateTracker extends ServiceStateTracker {
if (ar.exception == null) {
String states[] = (String[])ar.result;
int baseStationId = -1;
- int baseStationLatitude = Integer.MAX_VALUE;
- int baseStationLongitude = Integer.MAX_VALUE;
+ int baseStationLatitude = CdmaCellLocation.INVALID_LAT_LONG;
+ int baseStationLongitude = CdmaCellLocation.INVALID_LAT_LONG;
int systemId = -1;
int networkId = -1;
@@ -373,6 +373,11 @@ final class CdmaServiceStateTracker extends ServiceStateTracker {
if (states[6] != null) {
baseStationLongitude = Integer.parseInt(states[6]);
}
+ // Some carriers only return lat-lngs of 0,0
+ if (baseStationLatitude == 0 && baseStationLongitude == 0) {
+ baseStationLatitude = CdmaCellLocation.INVALID_LAT_LONG;
+ baseStationLongitude = CdmaCellLocation.INVALID_LAT_LONG;
+ }
if (states[8] != null) {
systemId = Integer.parseInt(states[8]);
}
@@ -662,8 +667,10 @@ final class CdmaServiceStateTracker extends ServiceStateTracker {
int registrationState = 4; //[0] registrationState
int radioTechnology = -1; //[3] radioTechnology
int baseStationId = -1; //[4] baseStationId
- int baseStationLatitude = Integer.MAX_VALUE; //[5] baseStationLatitude
- int baseStationLongitude = Integer.MAX_VALUE; //[6] baseStationLongitude
+ //[5] baseStationLatitude
+ int baseStationLatitude = CdmaCellLocation.INVALID_LAT_LONG;
+ //[6] baseStationLongitude
+ int baseStationLongitude = CdmaCellLocation.INVALID_LAT_LONG;
int cssIndicator = 0; //[7] init with 0, because it is treated as a boolean
int systemId = 0; //[8] systemId
int networkId = 0; //[9] networkId
@@ -689,6 +696,11 @@ final class CdmaServiceStateTracker extends ServiceStateTracker {
if (states[6] != null) {
baseStationLongitude = Integer.parseInt(states[6]);
}
+ // Some carriers only return lat-lngs of 0,0
+ if (baseStationLatitude == 0 && baseStationLongitude == 0) {
+ baseStationLatitude = CdmaCellLocation.INVALID_LAT_LONG;
+ baseStationLongitude = CdmaCellLocation.INVALID_LAT_LONG;
+ }
if (states[7] != null) {
cssIndicator = Integer.parseInt(states[7]);
}