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

Commit bd9da6de authored by Nathan Harold's avatar Nathan Harold Committed by Gerrit Code Review
Browse files

Merge "Refactor CellInfo Constructors"

parents 8acece04 7ce5baf9
Loading
Loading
Loading
Loading
+13 −20
Original line number Original line Diff line number Diff line
@@ -16,7 +16,6 @@


package android.telephony;
package android.telephony;


import android.annotation.UnsupportedAppUsage;
import android.os.Parcel;
import android.os.Parcel;
import android.telephony.cdma.CdmaCellLocation;
import android.telephony.cdma.CdmaCellLocation;


@@ -62,23 +61,6 @@ public final class CellIdentityCdma extends CellIdentity {
        mLatitude = CellInfo.UNAVAILABLE;
        mLatitude = CellInfo.UNAVAILABLE;
    }
    }


    /**
     * public constructor
     * @param nid Network Id 0..65535
     * @param sid CDMA System Id 0..32767
     * @param bid Base Station Id 0..65535
     * @param lon Longitude is a decimal number ranges from -2592000
     *        to 2592000
     * @param lat Latitude is a decimal number ranges from -1296000
     *        to 1296000
     *
     * @hide
     */
    @UnsupportedAppUsage
    public CellIdentityCdma(int nid, int sid, int bid, int lon, int lat) {
        this(nid, sid, bid, lon, lat, null, null);
    }

    /**
    /**
     * public constructor
     * public constructor
     * @param nid Network Id 0..65535
     * @param nid Network Id 0..65535
@@ -93,8 +75,8 @@ public final class CellIdentityCdma extends CellIdentity {
     *
     *
     * @hide
     * @hide
     */
     */
    public CellIdentityCdma(int nid, int sid, int bid, int lon, int lat, String alphal,
    public CellIdentityCdma(
                             String alphas) {
            int nid, int sid, int bid, int lon, int lat, String alphal, String alphas) {
        super(TAG, CellInfo.TYPE_CDMA, null, null, alphal, alphas);
        super(TAG, CellInfo.TYPE_CDMA, null, null, alphal, alphas);
        mNetworkId = nid;
        mNetworkId = nid;
        mSystemId = sid;
        mSystemId = sid;
@@ -107,6 +89,17 @@ public final class CellIdentityCdma extends CellIdentity {
        }
        }
    }
    }


    /** @hide */
    public CellIdentityCdma(android.hardware.radio.V1_0.CellIdentityCdma cid) {
        this(cid.networkId, cid.systemId, cid.baseStationId, cid.longitude, cid.latitude, "", "");
    }

    /** @hide */
    public CellIdentityCdma(android.hardware.radio.V1_2.CellIdentityCdma cid) {
        this(cid.base.networkId, cid.base.systemId, cid.base.baseStationId, cid.base.longitude,
                cid.base.latitude, cid.operatorNames.alphaLong, cid.operatorNames.alphaShort);
    }

    private CellIdentityCdma(CellIdentityCdma cid) {
    private CellIdentityCdma(CellIdentityCdma cid) {
        this(cid.mNetworkId, cid.mSystemId, cid.mBasestationId, cid.mLongitude, cid.mLatitude,
        this(cid.mNetworkId, cid.mSystemId, cid.mBasestationId, cid.mLongitude, cid.mLatitude,
                cid.mAlphaLong, cid.mAlphaShort);
                cid.mAlphaLong, cid.mAlphaShort);
+14 −33
Original line number Original line Diff line number Diff line
@@ -36,10 +36,8 @@ public final class CellIdentityGsm extends CellIdentity {
    // 16-bit GSM Cell Identity described in TS 27.007, 0..65535
    // 16-bit GSM Cell Identity described in TS 27.007, 0..65535
    private final int mCid;
    private final int mCid;
    // 16-bit GSM Absolute RF Channel Number
    // 16-bit GSM Absolute RF Channel Number
    @UnsupportedAppUsage
    private final int mArfcn;
    private final int mArfcn;
    // 6-bit Base Station Identity Code
    // 6-bit Base Station Identity Code
    @UnsupportedAppUsage
    private final int mBsic;
    private final int mBsic;


    /**
    /**
@@ -53,34 +51,6 @@ public final class CellIdentityGsm extends CellIdentity {
        mArfcn = CellInfo.UNAVAILABLE;
        mArfcn = CellInfo.UNAVAILABLE;
        mBsic = CellInfo.UNAVAILABLE;
        mBsic = CellInfo.UNAVAILABLE;
    }
    }
    /**
     * public constructor
     * @param mcc 3-digit Mobile Country Code, 0..999
     * @param mnc 2 or 3-digit Mobile Network Code, 0..999
     * @param lac 16-bit Location Area Code, 0..65535
     * @param cid 16-bit GSM Cell Identity or 28-bit UMTS Cell Identity
     *
     * @hide
     */
    public CellIdentityGsm(int mcc, int mnc, int lac, int cid) {
        this(lac, cid, CellInfo.UNAVAILABLE, CellInfo.UNAVAILABLE,
                String.valueOf(mcc), String.valueOf(mnc), null, null);
    }

    /**
     * public constructor
     * @param mcc 3-digit Mobile Country Code, 0..999
     * @param mnc 2 or 3-digit Mobile Network Code, 0..999
     * @param lac 16-bit Location Area Code, 0..65535
     * @param cid 16-bit GSM Cell Identity or 28-bit UMTS Cell Identity
     * @param arfcn 16-bit GSM Absolute RF Channel Number
     * @param bsic 6-bit Base Station Identity Code
     *
     * @hide
     */
    public CellIdentityGsm(int mcc, int mnc, int lac, int cid, int arfcn, int bsic) {
        this(lac, cid, arfcn, bsic, String.valueOf(mcc), String.valueOf(mnc), null, null);
    }


    /**
    /**
     * public constructor
     * public constructor
@@ -101,9 +71,20 @@ public final class CellIdentityGsm extends CellIdentity {
        mLac = lac;
        mLac = lac;
        mCid = cid;
        mCid = cid;
        mArfcn = arfcn;
        mArfcn = arfcn;
        // In RIL BSIC is a UINT8, so 0xFF is the 'INVALID' designator
        mBsic = bsic;
        // for inbound parcels
    }
        mBsic = (bsic == 0xFF) ? CellInfo.UNAVAILABLE : bsic;

    /** @hide */
    public CellIdentityGsm(android.hardware.radio.V1_0.CellIdentityGsm cid) {
        this(cid.lac, cid.cid, cid.arfcn,
                cid.bsic == 0xFF ? CellInfo.UNAVAILABLE : cid.bsic, cid.mcc, cid.mnc, "", "");
    }

    /** @hide */
    public CellIdentityGsm(android.hardware.radio.V1_2.CellIdentityGsm cid) {
        this(cid.base.lac, cid.base.cid, cid.base.arfcn,
                cid.base.bsic == 0xFF ? CellInfo.UNAVAILABLE : cid.base.bsic, cid.base.mcc,
                cid.base.mnc, cid.operatorNames.alphaLong, cid.operatorNames.alphaShort);
    }
    }


    private CellIdentityGsm(CellIdentityGsm cid) {
    private CellIdentityGsm(CellIdentityGsm cid) {
+12 −17
Original line number Original line Diff line number Diff line
@@ -38,7 +38,6 @@ public final class CellIdentityLte extends CellIdentity {
    // 16-bit tracking area code
    // 16-bit tracking area code
    private final int mTac;
    private final int mTac;
    // 18-bit Absolute RF Channel Number
    // 18-bit Absolute RF Channel Number
    @UnsupportedAppUsage
    private final int mEarfcn;
    private final int mEarfcn;
    // cell bandwidth, in kHz
    // cell bandwidth, in kHz
    private final int mBandwidth;
    private final int mBandwidth;
@@ -72,22 +71,6 @@ public final class CellIdentityLte extends CellIdentity {
                String.valueOf(mnc), null, null);
                String.valueOf(mnc), null, null);
    }
    }


    /**
     *
     * @param mcc 3-digit Mobile Country Code, 0..999
     * @param mnc 2 or 3-digit Mobile Network Code, 0..999
     * @param ci 28-bit Cell Identity
     * @param pci Physical Cell Id 0..503
     * @param tac 16-bit Tracking Area Code
     * @param earfcn 18-bit LTE Absolute RF Channel Number
     *
     * @hide
     */
    public CellIdentityLte(int mcc, int mnc, int ci, int pci, int tac, int earfcn) {
        this(ci, pci, tac, earfcn, CellInfo.UNAVAILABLE, String.valueOf(mcc), String.valueOf(mnc),
                null, null);
    }

    /**
    /**
     *
     *
     * @param ci 28-bit Cell Identity
     * @param ci 28-bit Cell Identity
@@ -112,6 +95,18 @@ public final class CellIdentityLte extends CellIdentity {
        mBandwidth = bandwidth;
        mBandwidth = bandwidth;
    }
    }


    /** @hide */
    public CellIdentityLte(android.hardware.radio.V1_0.CellIdentityLte cid) {
        this(cid.ci, cid.pci, cid.tac, cid.earfcn, CellInfo.UNAVAILABLE, cid.mcc, cid.mnc, "", "");
    }

    /** @hide */
    public CellIdentityLte(android.hardware.radio.V1_2.CellIdentityLte cid) {
        this(cid.base.ci, cid.base.pci, cid.base.tac, cid.base.earfcn, cid.bandwidth,
                cid.base.mcc, cid.base.mnc, cid.operatorNames.alphaLong,
                cid.operatorNames.alphaShort);
    }

    private CellIdentityLte(CellIdentityLte cid) {
    private CellIdentityLte(CellIdentityLte cid) {
        this(cid.mCi, cid.mPci, cid.mTac, cid.mEarfcn, cid.mBandwidth, cid.mMccStr,
        this(cid.mCi, cid.mPci, cid.mTac, cid.mEarfcn, cid.mBandwidth, cid.mMccStr,
                cid.mMncStr, cid.mAlphaLong, cid.mAlphaShort);
                cid.mMncStr, cid.mAlphaLong, cid.mAlphaShort);
+11 −16
Original line number Original line Diff line number Diff line
@@ -50,22 +50,6 @@ public final class CellIdentityTdscdma extends CellIdentity {
        mUarfcn = CellInfo.UNAVAILABLE;
        mUarfcn = CellInfo.UNAVAILABLE;
    }
    }


    /**
     * @param mcc 3-digit Mobile Country Code, 0..999
     * @param mnc 2 or 3-digit Mobile Network Code, 0..999
     * @param lac 16-bit Location Area Code, 0..65535, CellInfo.UNAVAILABLE if unknown
     * @param cid 28-bit UMTS Cell Identity described in TS 25.331, 0..268435455, CellInfo.
     *        UNAVAILABLE if unknown
     * @param cpid 8-bit Cell Parameters ID described in TS 25.331, 0..127, CellInfo.UNAVAILABLE
     *        if unknown
     * @param uarfcn 16-bit UMTS Absolute RF Channel Number described in TS 25.101 sec. 5.4.3
     *
     * @hide
     */
    public CellIdentityTdscdma(int mcc, int mnc, int lac, int cid, int cpid, int uarfcn) {
        this(String.valueOf(mcc), String.valueOf(mnc), lac, cid, cpid, uarfcn, null, null);
    }

    /**
    /**
     * @param mcc 3-digit Mobile Country Code in string format
     * @param mcc 3-digit Mobile Country Code in string format
     * @param mnc 2 or 3-digit Mobile Network Code in string format
     * @param mnc 2 or 3-digit Mobile Network Code in string format
@@ -94,6 +78,17 @@ public final class CellIdentityTdscdma extends CellIdentity {
                cid.mCpid, cid.mUarfcn, cid.mAlphaLong, cid.mAlphaShort);
                cid.mCpid, cid.mUarfcn, cid.mAlphaLong, cid.mAlphaShort);
    }
    }


    /** @hide */
    public CellIdentityTdscdma(android.hardware.radio.V1_0.CellIdentityTdscdma cid) {
        this(cid.mcc, cid.mnc, cid.lac, cid.cid, cid.cpid, CellInfo.UNAVAILABLE, "", "");
    }

    /** @hide */
    public CellIdentityTdscdma(android.hardware.radio.V1_2.CellIdentityTdscdma cid) {
        this(cid.base.mcc, cid.base.mnc, cid.base.lac, cid.base.cid, cid.base.cpid,
                cid.uarfcn, cid.operatorNames.alphaLong, cid.operatorNames.alphaShort);
    }

    CellIdentityTdscdma copy() {
    CellIdentityTdscdma copy() {
        return new CellIdentityTdscdma(this);
        return new CellIdentityTdscdma(this);
    }
    }
+12 −29
Original line number Original line Diff line number Diff line
@@ -51,35 +51,6 @@ public final class CellIdentityWcdma extends CellIdentity {
        mPsc = CellInfo.UNAVAILABLE;
        mPsc = CellInfo.UNAVAILABLE;
        mUarfcn = CellInfo.UNAVAILABLE;
        mUarfcn = CellInfo.UNAVAILABLE;
    }
    }
    /**
     * public constructor
     * @param mcc 3-digit Mobile Country Code, 0..999
     * @param mnc 2 or 3-digit Mobile Network Code, 0..999
     * @param lac 16-bit Location Area Code, 0..65535
     * @param cid 28-bit UMTS Cell Identity
     * @param psc 9-bit UMTS Primary Scrambling Code
     *
     * @hide
     */
    public CellIdentityWcdma (int mcc, int mnc, int lac, int cid, int psc) {
        this(lac, cid, psc, CellInfo.UNAVAILABLE, String.valueOf(mcc), String.valueOf(mnc),
                null, null);
    }

    /**
     * public constructor
     * @param mcc 3-digit Mobile Country Code, 0..999
     * @param mnc 2 or 3-digit Mobile Network Code, 0..999
     * @param lac 16-bit Location Area Code, 0..65535
     * @param cid 28-bit UMTS Cell Identity
     * @param psc 9-bit UMTS Primary Scrambling Code
     * @param uarfcn 16-bit UMTS Absolute RF Channel Number described in TS 25.101 sec. 5.4.3
     *
     * @hide
     */
    public CellIdentityWcdma (int mcc, int mnc, int lac, int cid, int psc, int uarfcn) {
        this(lac, cid, psc, uarfcn, String.valueOf(mcc), String.valueOf(mnc), null, null);
    }


    /**
    /**
     * public constructor
     * public constructor
@@ -103,6 +74,18 @@ public final class CellIdentityWcdma extends CellIdentity {
        mUarfcn = uarfcn;
        mUarfcn = uarfcn;
    }
    }


    /** @hide */
    public CellIdentityWcdma(android.hardware.radio.V1_0.CellIdentityWcdma cid) {
        this(cid.lac, cid.cid, cid.psc, cid.uarfcn, cid.mcc, cid.mnc, "", "");
    }

    /** @hide */
    public CellIdentityWcdma(android.hardware.radio.V1_2.CellIdentityWcdma cid) {
        this(cid.base.lac, cid.base.cid, cid.base.psc, cid.base.uarfcn,
                cid.base.mcc, cid.base.mnc, cid.operatorNames.alphaLong,
                cid.operatorNames.alphaShort);
    }

    private CellIdentityWcdma(CellIdentityWcdma cid) {
    private CellIdentityWcdma(CellIdentityWcdma cid) {
        this(cid.mLac, cid.mCid, cid.mPsc, cid.mUarfcn, cid.mMccStr,
        this(cid.mLac, cid.mCid, cid.mPsc, cid.mUarfcn, cid.mMccStr,
                cid.mMncStr, cid.mAlphaLong, cid.mAlphaShort);
                cid.mMncStr, cid.mAlphaLong, cid.mAlphaShort);
Loading