Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0b4e3ad3 authored by jsh's avatar jsh Committed by Android Git Automerger
Browse files

am 82cadee3: Merge "Add support for PSC of serving cell." into gingerbread

Merge commit '82cadee3' into gingerbread-plus-aosp

* commit '82cadee3':
  Add support for PSC of serving cell.
parents ac8e7060 82cadee3
Loading
Loading
Loading
Loading
+25 −3
Original line number Diff line number Diff line
@@ -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);
    }

    /**
@@ -56,12 +59,21 @@ public class GsmCellLocation extends CellLocation {
        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.
     */
    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);
    }
}
+7 −0
Original line number Diff line number Diff line
@@ -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: