am 82cadee3: Merge "Add support for PSC of serving cell." into gingerbread
Merge commit '82cadee3ca830315c617dfdbf3a8eef207c58436' into gingerbread-plus-aosp * commit '82cadee3ca830315c617dfdbf3a8eef207c58436': Add support for PSC of serving cell.
This commit is contained in:
@@ -25,6 +25,7 @@ import android.telephony.CellLocation;
|
|||||||
public class GsmCellLocation extends CellLocation {
|
public class GsmCellLocation extends CellLocation {
|
||||||
private int mLac;
|
private int mLac;
|
||||||
private int mCid;
|
private int mCid;
|
||||||
|
private int mPsc;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Empty constructor. Initializes the LAC and CID to -1.
|
* Empty constructor. Initializes the LAC and CID to -1.
|
||||||
@@ -32,6 +33,7 @@ public class GsmCellLocation extends CellLocation {
|
|||||||
public GsmCellLocation() {
|
public GsmCellLocation() {
|
||||||
mLac = -1;
|
mLac = -1;
|
||||||
mCid = -1;
|
mCid = -1;
|
||||||
|
mPsc = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -40,6 +42,7 @@ public class GsmCellLocation extends CellLocation {
|
|||||||
public GsmCellLocation(Bundle bundle) {
|
public GsmCellLocation(Bundle bundle) {
|
||||||
mLac = bundle.getInt("lac", mLac);
|
mLac = bundle.getInt("lac", mLac);
|
||||||
mCid = bundle.getInt("cid", mCid);
|
mCid = bundle.getInt("cid", mCid);
|
||||||
|
mPsc = bundle.getInt("psc", mPsc);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -56,12 +59,21 @@ public class GsmCellLocation extends CellLocation {
|
|||||||
return mCid;
|
return mCid;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @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.
|
* Invalidate this object. The location area code and the cell id are set to -1.
|
||||||
*/
|
*/
|
||||||
public void setStateInvalid() {
|
public void setStateInvalid() {
|
||||||
mLac = -1;
|
mLac = -1;
|
||||||
mCid = -1;
|
mCid = -1;
|
||||||
|
mPsc = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -72,6 +84,14 @@ public class GsmCellLocation extends CellLocation {
|
|||||||
mCid = cid;
|
mCid = cid;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the primary scrambling code.
|
||||||
|
* @hide
|
||||||
|
*/
|
||||||
|
public void setPsc(int psc) {
|
||||||
|
mPsc = psc;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
return mLac ^ mCid;
|
return mLac ^ mCid;
|
||||||
@@ -91,12 +111,13 @@ public class GsmCellLocation extends CellLocation {
|
|||||||
return false;
|
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
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "["+ mLac + "," + mCid + "]";
|
return "["+ mLac + "," + mCid + "," + mPsc + "]";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -118,12 +139,13 @@ public class GsmCellLocation extends CellLocation {
|
|||||||
public void fillInNotifierBundle(Bundle m) {
|
public void fillInNotifierBundle(Bundle m) {
|
||||||
m.putInt("lac", mLac);
|
m.putInt("lac", mLac);
|
||||||
m.putInt("cid", mCid);
|
m.putInt("cid", mCid);
|
||||||
|
m.putInt("psc", mPsc);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @hide
|
* @hide
|
||||||
*/
|
*/
|
||||||
public boolean isEmpty() {
|
public boolean isEmpty() {
|
||||||
return (mLac == -1 && mCid == -1);
|
return (mLac == -1 && mCid == -1 && mPsc == -1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -650,6 +650,7 @@ final class GsmServiceStateTracker extends ServiceStateTracker {
|
|||||||
int lac = -1;
|
int lac = -1;
|
||||||
int cid = -1;
|
int cid = -1;
|
||||||
int regState = -1;
|
int regState = -1;
|
||||||
|
int psc = -1;
|
||||||
if (states.length > 0) {
|
if (states.length > 0) {
|
||||||
try {
|
try {
|
||||||
regState = Integer.parseInt(states[0]);
|
regState = Integer.parseInt(states[0]);
|
||||||
@@ -661,6 +662,11 @@ final class GsmServiceStateTracker extends ServiceStateTracker {
|
|||||||
cid = Integer.parseInt(states[2], 16);
|
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) {
|
} catch (NumberFormatException ex) {
|
||||||
Log.w(LOG_TAG, "error parsing RegistrationState: " + 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
|
// LAC and CID are -1 if not avail
|
||||||
newCellLoc.setLacAndCid(lac, cid);
|
newCellLoc.setLacAndCid(lac, cid);
|
||||||
|
newCellLoc.setPsc(psc);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case EVENT_POLL_STATE_GPRS:
|
case EVENT_POLL_STATE_GPRS:
|
||||||
|
|||||||
Reference in New Issue
Block a user