diff options
author | jsh <jsh@google.com> | 2010-06-23 21:46:52 -0700 |
---|---|---|
committer | jsh <jsh@google.com> | 2010-08-03 14:50:18 -0700 |
commit | 05a5a88a171721705685d1ae3dcfe82780907210 (patch) | |
tree | 3b2e39bb0628b2a35474d8196eefd8b1884e449d | |
parent | 5d46ce24cc46dc57d31f809302af916999114ced (diff) | |
download | frameworks_base-05a5a88a171721705685d1ae3dcfe82780907210.zip frameworks_base-05a5a88a171721705685d1ae3dcfe82780907210.tar.gz frameworks_base-05a5a88a171721705685d1ae3dcfe82780907210.tar.bz2 |
Add support for PSC of serving cell.
Bug: 2465036
-rw-r--r-- | telephony/java/android/telephony/gsm/GsmCellLocation.java | 28 | ||||
-rw-r--r-- | telephony/java/com/android/internal/telephony/gsm/GsmServiceStateTracker.java | 7 |
2 files changed, 32 insertions, 3 deletions
diff --git a/telephony/java/android/telephony/gsm/GsmCellLocation.java b/telephony/java/android/telephony/gsm/GsmCellLocation.java index fa1f985..c4204fa 100644 --- a/telephony/java/android/telephony/gsm/GsmCellLocation.java +++ b/telephony/java/android/telephony/gsm/GsmCellLocation.java @@ -25,6 +25,7 @@ import android.telephony.CellLocation; public class GsmCellLocation extends CellLocation { private int mLac; private int mCid; + private int mPsc; /** * Empty constructor. Initializes the LAC and CID to -1. @@ -32,6 +33,7 @@ public class GsmCellLocation extends CellLocation { public GsmCellLocation() { mLac = -1; mCid = -1; + mPsc = -1; } /** @@ -40,6 +42,7 @@ public class GsmCellLocation extends CellLocation { public GsmCellLocation(Bundle bundle) { mLac = bundle.getInt("lac", mLac); mCid = bundle.getInt("cid", mCid); + mPsc = bundle.getInt("psc", mPsc); } /** @@ -57,11 +60,20 @@ public class GsmCellLocation extends CellLocation { } /** + * @return primary scrambling code for UMTS, -1 if unknown or GSM + * @hide + */ + public int getPsc() { + return mPsc; + } + + /** * Invalidate this object. The location area code and the cell id are set to -1. */ public void setStateInvalid() { mLac = -1; mCid = -1; + mPsc = -1; } /** @@ -72,6 +84,14 @@ public class GsmCellLocation extends CellLocation { mCid = cid; } + /** + * Set the primary scrambling code. + * @hide + */ + public void setPsc(int psc) { + mPsc = psc; + } + @Override public int hashCode() { return mLac ^ mCid; @@ -91,12 +111,13 @@ public class GsmCellLocation extends CellLocation { return false; } - return equalsHandlesNulls(mLac, s.mLac) && equalsHandlesNulls(mCid, s.mCid); + return equalsHandlesNulls(mLac, s.mLac) && equalsHandlesNulls(mCid, s.mCid) + && equalsHandlesNulls(mPsc, s.mPsc); } @Override public String toString() { - return "["+ mLac + "," + mCid + "]"; + return "["+ mLac + "," + mCid + "," + mPsc + "]"; } /** @@ -118,12 +139,13 @@ public class GsmCellLocation extends CellLocation { public void fillInNotifierBundle(Bundle m) { m.putInt("lac", mLac); m.putInt("cid", mCid); + m.putInt("psc", mPsc); } /** * @hide */ public boolean isEmpty() { - return (mLac == -1 && mCid == -1); + return (mLac == -1 && mCid == -1 && mPsc == -1); } } diff --git a/telephony/java/com/android/internal/telephony/gsm/GsmServiceStateTracker.java b/telephony/java/com/android/internal/telephony/gsm/GsmServiceStateTracker.java index d539f6f..90ecbd7 100644 --- a/telephony/java/com/android/internal/telephony/gsm/GsmServiceStateTracker.java +++ b/telephony/java/com/android/internal/telephony/gsm/GsmServiceStateTracker.java @@ -650,6 +650,7 @@ final class GsmServiceStateTracker extends ServiceStateTracker { int lac = -1; int cid = -1; int regState = -1; + int psc = -1; if (states.length > 0) { try { regState = Integer.parseInt(states[0]); @@ -661,6 +662,11 @@ final class GsmServiceStateTracker extends ServiceStateTracker { cid = Integer.parseInt(states[2], 16); } } + if (states.length > 14) { + if (states[14] != null && states[14].length() > 0) { + psc = Integer.parseInt(states[14], 16); + } + } } catch (NumberFormatException ex) { Log.w(LOG_TAG, "error parsing RegistrationState: " + ex); } @@ -677,6 +683,7 @@ final class GsmServiceStateTracker extends ServiceStateTracker { // LAC and CID are -1 if not avail newCellLoc.setLacAndCid(lac, cid); + newCellLoc.setPsc(psc); break; case EVENT_POLL_STATE_GPRS: |