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

Commit d72b3137 authored by Nico Sallembien's avatar Nico Sallembien Committed by Android (Google) Code Review
Browse files

Merge "Map base station lat-lng of "0","0" to undefined."

parents 1257b101 9384b145
Loading
Loading
Loading
Loading
+17 −12
Original line number Original line Diff line number Diff line
@@ -25,13 +25,18 @@ import android.telephony.CellLocation;
public class CdmaCellLocation extends CellLocation {
public class CdmaCellLocation extends CellLocation {
    private int mBaseStationId = -1;
    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.
     * 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
     * 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 1296000, both values inclusive (corresponding to a range of -90
     * to +90 degrees). Integer.MAX_VALUE is considered invalid value.
     * 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.
     * 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 2592000, both values inclusive (corresponding to a range of -180
     * to +180 degrees). Integer.MAX_VALUE is considered invalid value.
     * 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 mSystemId = -1;
    private int mNetworkId = -1;
    private int mNetworkId = -1;
@@ -51,8 +56,8 @@ public class CdmaCellLocation extends CellLocation {
     */
     */
    public CdmaCellLocation() {
    public CdmaCellLocation() {
        this.mBaseStationId = -1;
        this.mBaseStationId = -1;
        this.mBaseStationLatitude = Integer.MAX_VALUE;
        this.mBaseStationLatitude = INVALID_LAT_LONG;
        this.mBaseStationLongitude = Integer.MAX_VALUE;
        this.mBaseStationLongitude = INVALID_LAT_LONG;
        this.mSystemId = -1;
        this.mSystemId = -1;
        this.mNetworkId = -1;
        this.mNetworkId = -1;
    }
    }
@@ -60,12 +65,12 @@ public class CdmaCellLocation extends CellLocation {
    /**
    /**
     * Initialize the object from a bundle.
     * Initialize the object from a bundle.
     */
     */
    public CdmaCellLocation(Bundle bundleWithValues) {
    public CdmaCellLocation(Bundle bundle) {
        this.mBaseStationId = bundleWithValues.getInt("baseStationId");
        this.mBaseStationId = bundle.getInt("baseStationId", mBaseStationId);
        this.mBaseStationLatitude = bundleWithValues.getInt("baseStationLatitude");
        this.mBaseStationLatitude = bundle.getInt("baseStationLatitude", mBaseStationLatitude);
        this.mBaseStationLongitude = bundleWithValues.getInt("baseStationLongitude");
        this.mBaseStationLongitude = bundle.getInt("baseStationLongitude", mBaseStationLongitude);
        this.mSystemId = bundleWithValues.getInt("systemId");
        this.mSystemId = bundle.getInt("systemId", mSystemId);
        this.mNetworkId = bundleWithValues.getInt("networkId");
        this.mNetworkId = bundle.getInt("networkId", mNetworkId);
    }
    }


    /**
    /**
@@ -108,8 +113,8 @@ public class CdmaCellLocation extends CellLocation {
     */
     */
    public void setStateInvalid() {
    public void setStateInvalid() {
        this.mBaseStationId = -1;
        this.mBaseStationId = -1;
        this.mBaseStationLatitude = Integer.MAX_VALUE;
        this.mBaseStationLatitude = INVALID_LAT_LONG;
        this.mBaseStationLongitude = Integer.MAX_VALUE;
        this.mBaseStationLongitude = INVALID_LAT_LONG;
        this.mSystemId = -1;
        this.mSystemId = -1;
        this.mNetworkId = -1;
        this.mNetworkId = -1;
    }
    }
+2 −4
Original line number Original line Diff line number Diff line
@@ -38,8 +38,8 @@ public class GsmCellLocation extends CellLocation {
     * Initialize the object from a bundle.
     * Initialize the object from a bundle.
     */
     */
    public GsmCellLocation(Bundle bundle) {
    public GsmCellLocation(Bundle bundle) {
        mLac = bundle.getInt("lac");
        mLac = bundle.getInt("lac", mLac);
        mCid = bundle.getInt("cid");
        mCid = bundle.getInt("cid", mCid);
    }
    }


    /**
    /**
@@ -120,5 +120,3 @@ public class GsmCellLocation extends CellLocation {
        m.putInt("cid", mCid);
        m.putInt("cid", mCid);
    }
    }
}
}

+16 −4
Original line number Original line Diff line number Diff line
@@ -357,8 +357,8 @@ final class CdmaServiceStateTracker extends ServiceStateTracker {
            if (ar.exception == null) {
            if (ar.exception == null) {
                String states[] = (String[])ar.result;
                String states[] = (String[])ar.result;
                int baseStationId = -1;
                int baseStationId = -1;
                int baseStationLatitude = Integer.MAX_VALUE;
                int baseStationLatitude = CdmaCellLocation.INVALID_LAT_LONG;
                int baseStationLongitude = Integer.MAX_VALUE;
                int baseStationLongitude = CdmaCellLocation.INVALID_LAT_LONG;
                int systemId = -1;
                int systemId = -1;
                int networkId = -1;
                int networkId = -1;


@@ -373,6 +373,11 @@ final class CdmaServiceStateTracker extends ServiceStateTracker {
                        if (states[6] != null) {
                        if (states[6] != null) {
                            baseStationLongitude = Integer.parseInt(states[6]);
                            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) {
                        if (states[8] != null) {
                            systemId = Integer.parseInt(states[8]);
                            systemId = Integer.parseInt(states[8]);
                        }
                        }
@@ -662,8 +667,10 @@ final class CdmaServiceStateTracker extends ServiceStateTracker {
                int registrationState = 4;     //[0] registrationState
                int registrationState = 4;     //[0] registrationState
                int radioTechnology = -1;      //[3] radioTechnology
                int radioTechnology = -1;      //[3] radioTechnology
                int baseStationId = -1;        //[4] baseStationId
                int baseStationId = -1;        //[4] baseStationId
                int baseStationLatitude = Integer.MAX_VALUE;  //[5] baseStationLatitude
                //[5] baseStationLatitude
                int baseStationLongitude = Integer.MAX_VALUE; //[6] baseStationLongitude
                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 cssIndicator = 0;          //[7] init with 0, because it is treated as a boolean
                int systemId = 0;              //[8] systemId
                int systemId = 0;              //[8] systemId
                int networkId = 0;             //[9] networkId
                int networkId = 0;             //[9] networkId
@@ -689,6 +696,11 @@ final class CdmaServiceStateTracker extends ServiceStateTracker {
                        if (states[6] != null) {
                        if (states[6] != null) {
                            baseStationLongitude = Integer.parseInt(states[6]);
                            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) {
                        if (states[7] != null) {
                            cssIndicator = Integer.parseInt(states[7]);
                            cssIndicator = Integer.parseInt(states[7]);
                        }
                        }