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

Commit 2872e306 authored by Mike Lockwood's avatar Mike Lockwood
Browse files

DO NOT MERGE: backporting from master:



CDMA: Add Network ID and System ID to CdmaCellLocation.

Signed-off-by: default avatarMike Lockwood <lockwood@android.com>
parent 506dd3fc
Loading
Loading
Loading
Loading
+45 −3
Original line number Original line Diff line number Diff line
@@ -27,6 +27,8 @@ public class CdmaCellLocation extends CellLocation {
    private int mBaseStationId = -1;
    private int mBaseStationId = -1;
    private int mBaseStationLatitude = -1;
    private int mBaseStationLatitude = -1;
    private int mBaseStationLongitude = -1;
    private int mBaseStationLongitude = -1;
    private int mSystemId = -1;
    private int mNetworkId = -1;


    /**
    /**
     * Empty constructor.  Initializes the LAC and CID to -1.
     * Empty constructor.  Initializes the LAC and CID to -1.
@@ -35,6 +37,8 @@ public class CdmaCellLocation extends CellLocation {
        this.mBaseStationId = -1;
        this.mBaseStationId = -1;
        this.mBaseStationLatitude = -1;
        this.mBaseStationLatitude = -1;
        this.mBaseStationLongitude = -1;
        this.mBaseStationLongitude = -1;
        this.mSystemId = -1;
        this.mNetworkId = -1;
    }
    }


    /**
    /**
@@ -44,6 +48,8 @@ public class CdmaCellLocation extends CellLocation {
        this.mBaseStationId = bundleWithValues.getInt("baseStationId");
        this.mBaseStationId = bundleWithValues.getInt("baseStationId");
        this.mBaseStationLatitude = bundleWithValues.getInt("baseStationLatitude");
        this.mBaseStationLatitude = bundleWithValues.getInt("baseStationLatitude");
        this.mBaseStationLongitude = bundleWithValues.getInt("baseStationLongitude");
        this.mBaseStationLongitude = bundleWithValues.getInt("baseStationLongitude");
        this.mSystemId = bundleWithValues.getInt("systemId");
        this.mNetworkId = bundleWithValues.getInt("networkId");
    }
    }


    /**
    /**
@@ -67,6 +73,20 @@ public class CdmaCellLocation extends CellLocation {
        return this.mBaseStationLongitude;
        return this.mBaseStationLongitude;
    }
    }


    /**
     * @return cdma system identification number, -1 if unknown
     */
    public int getSystemId() {
        return this.mSystemId;
    }

    /**
     * @return cdma network identification number, -1 if unknown
     */
    public int getNetworkId() {
        return this.mNetworkId;
    }

    /**
    /**
     * Invalidate this object.  The cell location data is set to -1.
     * Invalidate this object.  The cell location data is set to -1.
     */
     */
@@ -74,6 +94,8 @@ public class CdmaCellLocation extends CellLocation {
        this.mBaseStationId = -1;
        this.mBaseStationId = -1;
        this.mBaseStationLatitude = -1;
        this.mBaseStationLatitude = -1;
        this.mBaseStationLongitude = -1;
        this.mBaseStationLongitude = -1;
        this.mSystemId = -1;
        this.mNetworkId = -1;
    }
    }


    /**
    /**
@@ -87,9 +109,23 @@ public class CdmaCellLocation extends CellLocation {
         this.mBaseStationLongitude = baseStationLongitude; //values[3];
         this.mBaseStationLongitude = baseStationLongitude; //values[3];
    }
    }


    /**
     * Set the cell location data.
     */
     public void setCellLocationData(int baseStationId, int baseStationLatitude,
         int baseStationLongitude, int systemId, int networkId) {
         // The following values have to be written in the correct sequence
         this.mBaseStationId = baseStationId;
         this.mBaseStationLatitude = baseStationLatitude;   //values[2];
         this.mBaseStationLongitude = baseStationLongitude; //values[3];
         this.mSystemId = systemId;
         this.mNetworkId = networkId;
    }

    @Override
    @Override
    public int hashCode() {
    public int hashCode() {
        return this.mBaseStationId ^ this.mBaseStationLatitude ^ this.mBaseStationLongitude;
        return this.mBaseStationId ^ this.mBaseStationLatitude ^ this.mBaseStationLongitude
                ^ this.mSystemId ^ this.mNetworkId;
    }
    }


    @Override
    @Override
@@ -108,7 +144,9 @@ public class CdmaCellLocation extends CellLocation {


        return (equalsHandlesNulls(this.mBaseStationId, s.mBaseStationId) &&
        return (equalsHandlesNulls(this.mBaseStationId, s.mBaseStationId) &&
                equalsHandlesNulls(this.mBaseStationLatitude, s.mBaseStationLatitude) &&
                equalsHandlesNulls(this.mBaseStationLatitude, s.mBaseStationLatitude) &&
                equalsHandlesNulls(this.mBaseStationLongitude, s.mBaseStationLongitude)
                equalsHandlesNulls(this.mBaseStationLongitude, s.mBaseStationLongitude) &&
                equalsHandlesNulls(this.mSystemId, s.mSystemId) &&
                equalsHandlesNulls(this.mNetworkId, s.mNetworkId)
        );
        );
    }
    }


@@ -116,7 +154,9 @@ public class CdmaCellLocation extends CellLocation {
    public String toString() {
    public String toString() {
        return "[" + this.mBaseStationId + ","
        return "[" + this.mBaseStationId + ","
                   + this.mBaseStationLatitude + ","
                   + this.mBaseStationLatitude + ","
                   + this.mBaseStationLongitude + "]";
                   + this.mBaseStationLongitude + ","
                   + this.mSystemId + ","
                   + this.mNetworkId + "]";
    }
    }


    /**
    /**
@@ -139,6 +179,8 @@ public class CdmaCellLocation extends CellLocation {
        bundleToFill.putInt("baseStationId", this.mBaseStationId);
        bundleToFill.putInt("baseStationId", this.mBaseStationId);
        bundleToFill.putInt("baseStationLatitude", this.mBaseStationLatitude);
        bundleToFill.putInt("baseStationLatitude", this.mBaseStationLatitude);
        bundleToFill.putInt("baseStationLongitude", this.mBaseStationLongitude);
        bundleToFill.putInt("baseStationLongitude", this.mBaseStationLongitude);
        bundleToFill.putInt("systemId", this.mSystemId);
        bundleToFill.putInt("networkId", this.mNetworkId);
    }
    }


}
}
+2 −2
Original line number Original line Diff line number Diff line
@@ -571,7 +571,7 @@ final class CdmaServiceStateTracker extends ServiceStateTracker {
                    try {
                    try {
                        registrationState = Integer.parseInt(states[0]);
                        registrationState = Integer.parseInt(states[0]);
                        radioTechnology = Integer.parseInt(states[3]);
                        radioTechnology = Integer.parseInt(states[3]);
                        baseStationId = Integer.parseInt(states[4], 16);
                        baseStationId = Integer.parseInt(states[4]);
                        baseStationLatitude = Integer.parseInt(states[5], 16);
                        baseStationLatitude = Integer.parseInt(states[5], 16);
                        baseStationLongitude = Integer.parseInt(states[6], 16);
                        baseStationLongitude = Integer.parseInt(states[6], 16);
                        cssIndicator = Integer.parseInt(states[7]);
                        cssIndicator = Integer.parseInt(states[7]);
@@ -608,7 +608,7 @@ final class CdmaServiceStateTracker extends ServiceStateTracker {


                // values are -1 if not available
                // values are -1 if not available
                newCellLoc.setCellLocationData(baseStationId, baseStationLatitude,
                newCellLoc.setCellLocationData(baseStationId, baseStationLatitude,
                        baseStationLongitude);
                        baseStationLongitude, systemId, networkId);


                if (reasonForDenial == 0) {
                if (reasonForDenial == 0) {
                    mRegistrationDeniedReason = ServiceStateTracker.REGISTRATION_DENIED_GEN;
                    mRegistrationDeniedReason = ServiceStateTracker.REGISTRATION_DENIED_GEN;