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

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

Merge "Merge CellInfo TYPE Enums"

parents dccbfca1 65c4b15d
Loading
Loading
Loading
Loading
+9 −47
Original line number Diff line number Diff line
@@ -17,14 +17,11 @@
package android.telephony;

import android.annotation.CallSuper;
import android.annotation.IntDef;
import android.annotation.Nullable;
import android.os.Parcel;
import android.os.Parcelable;
import android.text.TextUtils;

import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.util.Objects;

/**
@@ -32,44 +29,6 @@ import java.util.Objects;
 * CellIdentityXxx which represents cell identity for specific network access technology.
 */
public abstract class CellIdentity implements Parcelable {
    /**
     * Cell identity type
     * @hide
     */
    @Retention(RetentionPolicy.SOURCE)
    @IntDef(prefix = "TYPE_", value = {TYPE_GSM, TYPE_CDMA, TYPE_LTE, TYPE_WCDMA, TYPE_TDSCDMA})
    public @interface Type {}

    /**
     * Unknown cell identity type
     * @hide
     */
    public static final int TYPE_UNKNOWN        = 0;
    /**
     * GSM cell identity type
     * @hide
     */
    public static final int TYPE_GSM            = 1;
    /**
     * CDMA cell identity type
     * @hide
     */
    public static final int TYPE_CDMA           = 2;
    /**
     * LTE cell identity type
     * @hide
     */
    public static final int TYPE_LTE            = 3;
    /**
     * WCDMA cell identity type
     * @hide
     */
    public static final int TYPE_WCDMA          = 4;
    /**
     * TDS-CDMA cell identity type
     * @hide
     */
    public static final int TYPE_TDSCDMA        = 5;

    /** @hide */
    public static final int INVALID_CHANNEL_NUMBER = -1;
@@ -138,7 +97,9 @@ public abstract class CellIdentity implements Parcelable {
     * @hide
     * @return The type of the cell identity
     */
    public @Type int getType() { return mType; }
    public @CellInfo.Type int getType() {
        return mType;
    }

    /**
     * Returns the channel number of the cell identity.
@@ -217,11 +178,12 @@ public abstract class CellIdentity implements Parcelable {
                public CellIdentity createFromParcel(Parcel in) {
                    int type = in.readInt();
                    switch (type) {
                        case TYPE_GSM: return CellIdentityGsm.createFromParcelBody(in);
                        case TYPE_WCDMA: return CellIdentityWcdma.createFromParcelBody(in);
                        case TYPE_CDMA: return CellIdentityCdma.createFromParcelBody(in);
                        case TYPE_LTE: return CellIdentityLte.createFromParcelBody(in);
                        case TYPE_TDSCDMA: return CellIdentityTdscdma.createFromParcelBody(in);
                        case CellInfo.TYPE_GSM: return CellIdentityGsm.createFromParcelBody(in);
                        case CellInfo.TYPE_WCDMA: return CellIdentityWcdma.createFromParcelBody(in);
                        case CellInfo.TYPE_CDMA: return CellIdentityCdma.createFromParcelBody(in);
                        case CellInfo.TYPE_LTE: return CellIdentityLte.createFromParcelBody(in);
                        case CellInfo.TYPE_TDSCDMA:
                            return CellIdentityTdscdma.createFromParcelBody(in);
                        default: throw new IllegalArgumentException("Bad Cell identity Parcel");
                    }
                }
+4 −4
Original line number Diff line number Diff line
@@ -54,7 +54,7 @@ public final class CellIdentityCdma extends CellIdentity {
     * @hide
     */
    public CellIdentityCdma() {
        super(TAG, TYPE_CDMA, null, null, null, null);
        super(TAG, CellInfo.TYPE_CDMA, null, null, null, null);
        mNetworkId = Integer.MAX_VALUE;
        mSystemId = Integer.MAX_VALUE;
        mBasestationId = Integer.MAX_VALUE;
@@ -94,7 +94,7 @@ public final class CellIdentityCdma extends CellIdentity {
     */
    public CellIdentityCdma(int nid, int sid, int bid, int lon, int lat, String alphal,
                             String alphas) {
        super(TAG, TYPE_CDMA, null, null, alphal, alphas);
        super(TAG, CellInfo.TYPE_CDMA, null, null, alphal, alphas);
        mNetworkId = nid;
        mSystemId = sid;
        mBasestationId = bid;
@@ -213,7 +213,7 @@ public final class CellIdentityCdma extends CellIdentity {
    @Override
    public void writeToParcel(Parcel dest, int flags) {
        if (DBG) log("writeToParcel(Parcel, int): " + toString());
        super.writeToParcel(dest, TYPE_CDMA);
        super.writeToParcel(dest, CellInfo.TYPE_CDMA);
        dest.writeInt(mNetworkId);
        dest.writeInt(mSystemId);
        dest.writeInt(mBasestationId);
@@ -223,7 +223,7 @@ public final class CellIdentityCdma extends CellIdentity {

    /** Construct from Parcel, type has already been processed */
    private CellIdentityCdma(Parcel in) {
        super(TAG, TYPE_CDMA, in);
        super(TAG, CellInfo.TYPE_CDMA, in);
        mNetworkId = in.readInt();
        mSystemId = in.readInt();
        mBasestationId = in.readInt();
+4 −4
Original line number Diff line number Diff line
@@ -42,7 +42,7 @@ public final class CellIdentityGsm extends CellIdentity {
     * @hide
     */
    public CellIdentityGsm() {
        super(TAG, TYPE_GSM, null, null, null, null);
        super(TAG, CellInfo.TYPE_GSM, null, null, null, null);
        mLac = Integer.MAX_VALUE;
        mCid = Integer.MAX_VALUE;
        mArfcn = Integer.MAX_VALUE;
@@ -92,7 +92,7 @@ public final class CellIdentityGsm extends CellIdentity {
     */
    public CellIdentityGsm(int lac, int cid, int arfcn, int bsic, String mccStr,
                            String mncStr, String alphal, String alphas) {
        super(TAG, TYPE_GSM, mccStr, mncStr, alphal, alphas);
        super(TAG, CellInfo.TYPE_GSM, mccStr, mncStr, alphal, alphas);
        mLac = lac;
        mCid = cid;
        mArfcn = arfcn;
@@ -237,7 +237,7 @@ public final class CellIdentityGsm extends CellIdentity {
    @Override
    public void writeToParcel(Parcel dest, int flags) {
        if (DBG) log("writeToParcel(Parcel, int): " + toString());
        super.writeToParcel(dest, TYPE_GSM);
        super.writeToParcel(dest, CellInfo.TYPE_GSM);
        dest.writeInt(mLac);
        dest.writeInt(mCid);
        dest.writeInt(mArfcn);
@@ -246,7 +246,7 @@ public final class CellIdentityGsm extends CellIdentity {

    /** Construct from Parcel, type has already been processed */
    private CellIdentityGsm(Parcel in) {
        super(TAG, TYPE_GSM, in);
        super(TAG, CellInfo.TYPE_GSM, in);
        mLac = in.readInt();
        mCid = in.readInt();
        mArfcn = in.readInt();
+4 −4
Original line number Diff line number Diff line
@@ -44,7 +44,7 @@ public final class CellIdentityLte extends CellIdentity {
     * @hide
     */
    public CellIdentityLte() {
        super(TAG, TYPE_LTE, null, null, null, null);
        super(TAG, CellInfo.TYPE_LTE, null, null, null, null);
        mCi = Integer.MAX_VALUE;
        mPci = Integer.MAX_VALUE;
        mTac = Integer.MAX_VALUE;
@@ -99,7 +99,7 @@ public final class CellIdentityLte extends CellIdentity {
     */
    public CellIdentityLte(int ci, int pci, int tac, int earfcn, int bandwidth, String mccStr,
            String mncStr, String alphal, String alphas) {
        super(TAG, TYPE_LTE, mccStr, mncStr, alphal, alphas);
        super(TAG, CellInfo.TYPE_LTE, mccStr, mncStr, alphal, alphas);
        mCi = ci;
        mPci = pci;
        mTac = tac;
@@ -241,7 +241,7 @@ public final class CellIdentityLte extends CellIdentity {
    @Override
    public void writeToParcel(Parcel dest, int flags) {
        if (DBG) log("writeToParcel(Parcel, int): " + toString());
        super.writeToParcel(dest, TYPE_LTE);
        super.writeToParcel(dest, CellInfo.TYPE_LTE);
        dest.writeInt(mCi);
        dest.writeInt(mPci);
        dest.writeInt(mTac);
@@ -251,7 +251,7 @@ public final class CellIdentityLte extends CellIdentity {

    /** Construct from Parcel, type has already been processed */
    private CellIdentityLte(Parcel in) {
        super(TAG, TYPE_LTE, in);
        super(TAG, CellInfo.TYPE_LTE, in);
        mCi = in.readInt();
        mPci = in.readInt();
        mTac = in.readInt();
+4 −4
Original line number Diff line number Diff line
@@ -40,7 +40,7 @@ public final class CellIdentityTdscdma extends CellIdentity {
     * @hide
     */
    public CellIdentityTdscdma() {
        super(TAG, TYPE_TDSCDMA, null, null, null, null);
        super(TAG, CellInfo.TYPE_TDSCDMA, null, null, null, null);
        mLac = Integer.MAX_VALUE;
        mCid = Integer.MAX_VALUE;
        mCpid = Integer.MAX_VALUE;
@@ -75,7 +75,7 @@ public final class CellIdentityTdscdma extends CellIdentity {
     */
    public CellIdentityTdscdma(String mcc, String mnc, int lac, int cid, int cpid, int uarfcn,
            String alphal, String alphas) {
        super(TAG, TYPE_TDSCDMA, mcc, mnc, alphal, alphas);
        super(TAG, CellInfo.TYPE_TDSCDMA, mcc, mnc, alphal, alphas);
        mLac = lac;
        mCid = cid;
        mCpid = cpid;
@@ -175,7 +175,7 @@ public final class CellIdentityTdscdma extends CellIdentity {
    @Override
    public void writeToParcel(Parcel dest, int flags) {
        if (DBG) log("writeToParcel(Parcel, int): " + toString());
        super.writeToParcel(dest, TYPE_TDSCDMA);
        super.writeToParcel(dest, CellInfo.TYPE_TDSCDMA);
        dest.writeInt(mLac);
        dest.writeInt(mCid);
        dest.writeInt(mCpid);
@@ -184,7 +184,7 @@ public final class CellIdentityTdscdma extends CellIdentity {

    /** Construct from Parcel, type has already been processed */
    private CellIdentityTdscdma(Parcel in) {
        super(TAG, TYPE_TDSCDMA, in);
        super(TAG, CellInfo.TYPE_TDSCDMA, in);
        mLac = in.readInt();
        mCid = in.readInt();
        mCpid = in.readInt();
Loading