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

Commit ae2b65a9 authored by Cassie's avatar Cassie Committed by Cassie Han
Browse files

Move alpha long/short to the base CellIdentity according API Review.

Bug: 74831568
Test: Telephony sanity
Change-Id: I0ef69e3f18fca111191e1c6329ae13c0860869ba
Merged-In: I0ef69e3f18fca111191e1c6329ae13c0860869ba
parent 76f64641
Loading
Loading
Loading
Loading
+2 −8
Original line number Original line Diff line number Diff line
@@ -40197,6 +40197,8 @@ package android.telephony {
  public abstract class CellIdentity implements android.os.Parcelable {
  public abstract class CellIdentity implements android.os.Parcelable {
    method public int describeContents();
    method public int describeContents();
    method public java.lang.CharSequence getOperatorAlphaLong();
    method public java.lang.CharSequence getOperatorAlphaShort();
    method public void writeToParcel(android.os.Parcel, int);
    method public void writeToParcel(android.os.Parcel, int);
    field public static final android.os.Parcelable.Creator<android.telephony.CellIdentity> CREATOR;
    field public static final android.os.Parcelable.Creator<android.telephony.CellIdentity> CREATOR;
  }
  }
@@ -40206,8 +40208,6 @@ package android.telephony {
    method public int getLatitude();
    method public int getLatitude();
    method public int getLongitude();
    method public int getLongitude();
    method public int getNetworkId();
    method public int getNetworkId();
    method public java.lang.CharSequence getOperatorAlphaLong();
    method public java.lang.CharSequence getOperatorAlphaShort();
    method public int getSystemId();
    method public int getSystemId();
    method public void writeToParcel(android.os.Parcel, int);
    method public void writeToParcel(android.os.Parcel, int);
    field public static final android.os.Parcelable.Creator<android.telephony.CellIdentityCdma> CREATOR;
    field public static final android.os.Parcelable.Creator<android.telephony.CellIdentityCdma> CREATOR;
@@ -40223,8 +40223,6 @@ package android.telephony {
    method public deprecated int getMnc();
    method public deprecated int getMnc();
    method public java.lang.String getMncString();
    method public java.lang.String getMncString();
    method public java.lang.String getMobileNetworkOperator();
    method public java.lang.String getMobileNetworkOperator();
    method public java.lang.CharSequence getOperatorAlphaLong();
    method public java.lang.CharSequence getOperatorAlphaShort();
    method public deprecated int getPsc();
    method public deprecated int getPsc();
    method public void writeToParcel(android.os.Parcel, int);
    method public void writeToParcel(android.os.Parcel, int);
    field public static final android.os.Parcelable.Creator<android.telephony.CellIdentityGsm> CREATOR;
    field public static final android.os.Parcelable.Creator<android.telephony.CellIdentityGsm> CREATOR;
@@ -40239,8 +40237,6 @@ package android.telephony {
    method public deprecated int getMnc();
    method public deprecated int getMnc();
    method public java.lang.String getMncString();
    method public java.lang.String getMncString();
    method public java.lang.String getMobileNetworkOperator();
    method public java.lang.String getMobileNetworkOperator();
    method public java.lang.CharSequence getOperatorAlphaLong();
    method public java.lang.CharSequence getOperatorAlphaShort();
    method public int getPci();
    method public int getPci();
    method public int getTac();
    method public int getTac();
    method public void writeToParcel(android.os.Parcel, int);
    method public void writeToParcel(android.os.Parcel, int);
@@ -40265,8 +40261,6 @@ package android.telephony {
    method public deprecated int getMnc();
    method public deprecated int getMnc();
    method public java.lang.String getMncString();
    method public java.lang.String getMncString();
    method public java.lang.String getMobileNetworkOperator();
    method public java.lang.String getMobileNetworkOperator();
    method public java.lang.CharSequence getOperatorAlphaLong();
    method public java.lang.CharSequence getOperatorAlphaShort();
    method public int getPsc();
    method public int getPsc();
    method public int getUarfcn();
    method public int getUarfcn();
    method public void writeToParcel(android.os.Parcel, int);
    method public void writeToParcel(android.os.Parcel, int);
+52 −2
Original line number Original line Diff line number Diff line
@@ -18,11 +18,14 @@ package android.telephony;


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


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


/**
/**
 * CellIdentity represents the identity of a unique cell. This is the base class for
 * CellIdentity represents the identity of a unique cell. This is the base class for
@@ -84,8 +87,16 @@ public abstract class CellIdentity implements Parcelable {
    /** @hide */
    /** @hide */
    protected final String mMncStr;
    protected final String mMncStr;


    // long alpha Operator Name String or Enhanced Operator Name String
    /** @hide */
    /** @hide */
    protected CellIdentity(String tag, int type, String mcc, String mnc) {
    protected final String mAlphaLong;
    // short alpha Operator Name String or Enhanced Operator Name String
    /** @hide */
    protected final String mAlphaShort;

    /** @hide */
    protected CellIdentity(String tag, int type, String mcc, String mnc, String alphal,
                           String alphas) {
        mTag = tag;
        mTag = tag;
        mType = type;
        mType = type;


@@ -113,6 +124,8 @@ public abstract class CellIdentity implements Parcelable {
            mMncStr = null;
            mMncStr = null;
            log("invalid MNC format: " + mnc);
            log("invalid MNC format: " + mnc);
        }
        }
        mAlphaLong = alphal;
        mAlphaShort = alphas;
    }
    }


    /** Implement the Parcelable interface */
    /** Implement the Parcelable interface */
@@ -137,6 +150,40 @@ public abstract class CellIdentity implements Parcelable {
        return INVALID_CHANNEL_NUMBER;
        return INVALID_CHANNEL_NUMBER;
    }
    }


    /**
     * @return The long alpha tag associated with the current scan result (may be the operator
     * name string or extended operator name string). May be null if unknown.
     */
    @Nullable
    public CharSequence getOperatorAlphaLong() {
        return mAlphaLong;
    }

    /**
     * @return The short alpha tag associated with the current scan result (may be the operator
     * name string or extended operator name string).  May be null if unknown.
     */
    @Nullable
    public CharSequence getOperatorAlphaShort() {
        return mAlphaShort;
    }

    @Override
    public boolean equals(Object other) {
        if (!(other instanceof CellIdentity)) {
            return false;
        }

        CellIdentity o = (CellIdentity) other;
        return TextUtils.equals(mAlphaLong, o.mAlphaLong)
                && TextUtils.equals(mAlphaShort, o.mAlphaShort);
    }

    @Override
    public int hashCode() {
        return Objects.hash(mAlphaLong, mAlphaShort, mMccStr, mMncStr, mType);
    }

    /**
    /**
     * Used by child classes for parceling.
     * Used by child classes for parceling.
     *
     *
@@ -147,6 +194,8 @@ public abstract class CellIdentity implements Parcelable {
        dest.writeInt(type);
        dest.writeInt(type);
        dest.writeString(mMccStr);
        dest.writeString(mMccStr);
        dest.writeString(mMncStr);
        dest.writeString(mMncStr);
        dest.writeString(mAlphaLong);
        dest.writeString(mAlphaShort);
    }
    }


    /**
    /**
@@ -154,7 +203,8 @@ public abstract class CellIdentity implements Parcelable {
     * @hide
     * @hide
     */
     */
    protected CellIdentity(String tag, int type, Parcel source) {
    protected CellIdentity(String tag, int type, Parcel source) {
        this(tag, type, source.readString(), source.readString());
        this(tag, type, source.readString(), source.readString(),
                source.readString(), source.readString());
    }
    }


    /** Implement the Parcelable interface */
    /** Implement the Parcelable interface */
+4 −37
Original line number Original line Diff line number Diff line
@@ -16,9 +16,7 @@


package android.telephony;
package android.telephony;


import android.annotation.Nullable;
import android.os.Parcel;
import android.os.Parcel;
import android.text.TextUtils;


import java.util.Objects;
import java.util.Objects;


@@ -49,23 +47,17 @@ public final class CellIdentityCdma extends CellIdentity {
     * to +90 degrees).
     * to +90 degrees).
     */
     */
    private final int mLatitude;
    private final int mLatitude;
    // long alpha Operator Name String or Enhanced Operator Name String
    private final String mAlphaLong;
    // short alpha Operator Name String or Enhanced Operator Name String
    private final String mAlphaShort;


    /**
    /**
     * @hide
     * @hide
     */
     */
    public CellIdentityCdma() {
    public CellIdentityCdma() {
        super(TAG, TYPE_CDMA, null, null);
        super(TAG, TYPE_CDMA, null, null, null, null);
        mNetworkId = Integer.MAX_VALUE;
        mNetworkId = Integer.MAX_VALUE;
        mSystemId = Integer.MAX_VALUE;
        mSystemId = Integer.MAX_VALUE;
        mBasestationId = Integer.MAX_VALUE;
        mBasestationId = Integer.MAX_VALUE;
        mLongitude = Integer.MAX_VALUE;
        mLongitude = Integer.MAX_VALUE;
        mLatitude = Integer.MAX_VALUE;
        mLatitude = Integer.MAX_VALUE;
        mAlphaLong = null;
        mAlphaShort = null;
    }
    }


    /**
    /**
@@ -100,7 +92,7 @@ public final class CellIdentityCdma extends CellIdentity {
     */
     */
    public CellIdentityCdma(int nid, int sid, int bid, int lon, int lat, String alphal,
    public CellIdentityCdma(int nid, int sid, int bid, int lon, int lat, String alphal,
                             String alphas) {
                             String alphas) {
        super(TAG, TYPE_CDMA, null, null);
        super(TAG, TYPE_CDMA, null, null, alphal, alphas);
        mNetworkId = nid;
        mNetworkId = nid;
        mSystemId = sid;
        mSystemId = sid;
        mBasestationId = bid;
        mBasestationId = bid;
@@ -110,8 +102,6 @@ public final class CellIdentityCdma extends CellIdentity {
        } else {
        } else {
            mLongitude = mLatitude = Integer.MAX_VALUE;
            mLongitude = mLatitude = Integer.MAX_VALUE;
        }
        }
        mAlphaLong = alphal;
        mAlphaShort = alphas;
    }
    }


    private CellIdentityCdma(CellIdentityCdma cid) {
    private CellIdentityCdma(CellIdentityCdma cid) {
@@ -178,28 +168,10 @@ public final class CellIdentityCdma extends CellIdentity {
        return mLatitude;
        return mLatitude;
    }
    }


    /**
     * @return The long alpha tag associated with the current scan result (may be the operator
     * name string or extended operator name string). May be null if unknown.
     */
    @Nullable
    public CharSequence getOperatorAlphaLong() {
        return mAlphaLong;
    }

    /**
     * @return The short alpha tag associated with the current scan result (may be the operator
     * name string or extended operator name string).  May be null if unknown.
     */
    @Nullable
    public CharSequence getOperatorAlphaShort() {
        return mAlphaShort;
    }

    @Override
    @Override
    public int hashCode() {
    public int hashCode() {
        return Objects.hash(mNetworkId, mSystemId, mBasestationId, mLatitude, mLongitude,
        return Objects.hash(mNetworkId, mSystemId, mBasestationId, mLatitude, mLongitude,
                mAlphaLong, mAlphaShort);
                super.hashCode());
    }
    }


    @Override
    @Override
@@ -219,8 +191,7 @@ public final class CellIdentityCdma extends CellIdentity {
                && mBasestationId == o.mBasestationId
                && mBasestationId == o.mBasestationId
                && mLatitude == o.mLatitude
                && mLatitude == o.mLatitude
                && mLongitude == o.mLongitude
                && mLongitude == o.mLongitude
                && TextUtils.equals(mAlphaLong, o.mAlphaLong)
                && super.equals(other);
                && TextUtils.equals(mAlphaShort, o.mAlphaShort);
    }
    }


    @Override
    @Override
@@ -246,8 +217,6 @@ public final class CellIdentityCdma extends CellIdentity {
        dest.writeInt(mBasestationId);
        dest.writeInt(mBasestationId);
        dest.writeInt(mLongitude);
        dest.writeInt(mLongitude);
        dest.writeInt(mLatitude);
        dest.writeInt(mLatitude);
        dest.writeString(mAlphaLong);
        dest.writeString(mAlphaShort);
    }
    }


    /** Construct from Parcel, type has already been processed */
    /** Construct from Parcel, type has already been processed */
@@ -258,8 +227,6 @@ public final class CellIdentityCdma extends CellIdentity {
        mBasestationId = in.readInt();
        mBasestationId = in.readInt();
        mLongitude = in.readInt();
        mLongitude = in.readInt();
        mLatitude = in.readInt();
        mLatitude = in.readInt();
        mAlphaLong = in.readString();
        mAlphaShort = in.readString();


        if (DBG) log(toString());
        if (DBG) log(toString());
    }
    }
+4 −37
Original line number Original line Diff line number Diff line
@@ -16,7 +16,6 @@


package android.telephony;
package android.telephony;


import android.annotation.Nullable;
import android.os.Parcel;
import android.os.Parcel;
import android.text.TextUtils;
import android.text.TextUtils;


@@ -37,22 +36,16 @@ public final class CellIdentityGsm extends CellIdentity {
    private final int mArfcn;
    private final int mArfcn;
    // 6-bit Base Station Identity Code
    // 6-bit Base Station Identity Code
    private final int mBsic;
    private final int mBsic;
    // long alpha Operator Name String or Enhanced Operator Name String
    private final String mAlphaLong;
    // short alpha Operator Name String or Enhanced Operator Name String
    private final String mAlphaShort;


    /**
    /**
     * @hide
     * @hide
     */
     */
    public CellIdentityGsm() {
    public CellIdentityGsm() {
        super(TAG, TYPE_GSM, null, null);
        super(TAG, TYPE_GSM, null, null, null, null);
        mLac = Integer.MAX_VALUE;
        mLac = Integer.MAX_VALUE;
        mCid = Integer.MAX_VALUE;
        mCid = Integer.MAX_VALUE;
        mArfcn = Integer.MAX_VALUE;
        mArfcn = Integer.MAX_VALUE;
        mBsic = Integer.MAX_VALUE;
        mBsic = Integer.MAX_VALUE;
        mAlphaLong = null;
        mAlphaShort = null;
    }
    }
    /**
    /**
     * public constructor
     * public constructor
@@ -98,16 +91,13 @@ public final class CellIdentityGsm extends CellIdentity {
     */
     */
    public CellIdentityGsm(int lac, int cid, int arfcn, int bsic, String mccStr,
    public CellIdentityGsm(int lac, int cid, int arfcn, int bsic, String mccStr,
                            String mncStr, String alphal, String alphas) {
                            String mncStr, String alphal, String alphas) {
        super(TAG, TYPE_GSM, mccStr, mncStr);
        super(TAG, TYPE_GSM, mccStr, mncStr, alphal, alphas);
        mLac = lac;
        mLac = lac;
        mCid = cid;
        mCid = cid;
        mArfcn = arfcn;
        mArfcn = arfcn;
        // In RIL BSIC is a UINT8, so 0xFF is the 'INVALID' designator
        // In RIL BSIC is a UINT8, so 0xFF is the 'INVALID' designator
        // for inbound parcels
        // for inbound parcels
        mBsic = (bsic == 0xFF) ? Integer.MAX_VALUE : bsic;
        mBsic = (bsic == 0xFF) ? Integer.MAX_VALUE : bsic;

        mAlphaLong = alphal;
        mAlphaShort = alphas;
    }
    }


    private CellIdentityGsm(CellIdentityGsm cid) {
    private CellIdentityGsm(CellIdentityGsm cid) {
@@ -188,24 +178,6 @@ public final class CellIdentityGsm extends CellIdentity {
        return mMncStr;
        return mMncStr;
    }
    }


    /**
     * @return The long alpha tag associated with the current scan result (may be the operator
     * name string or extended operator name string). May be null if unknown.
     */
    @Nullable
    public CharSequence getOperatorAlphaLong() {
        return mAlphaLong;
    }

    /**
     * @return The short alpha tag associated with the current scan result (may be the operator
     * name string or extended operator name string).  May be null if unknown.
     */
    @Nullable
    public CharSequence getOperatorAlphaShort() {
        return mAlphaShort;
    }

    /** @hide */
    /** @hide */
    @Override
    @Override
    public int getChannelNumber() {
    public int getChannelNumber() {
@@ -223,7 +195,7 @@ public final class CellIdentityGsm extends CellIdentity {


    @Override
    @Override
    public int hashCode() {
    public int hashCode() {
        return Objects.hash(mMccStr, mMncStr, mLac, mCid, mAlphaLong, mAlphaShort);
        return Objects.hash(mLac, mCid, super.hashCode());
    }
    }


    @Override
    @Override
@@ -243,8 +215,7 @@ public final class CellIdentityGsm extends CellIdentity {
                && mBsic == o.mBsic
                && mBsic == o.mBsic
                && TextUtils.equals(mMccStr, o.mMccStr)
                && TextUtils.equals(mMccStr, o.mMccStr)
                && TextUtils.equals(mMncStr, o.mMncStr)
                && TextUtils.equals(mMncStr, o.mMncStr)
                && TextUtils.equals(mAlphaLong, o.mAlphaLong)
                && super.equals(other);
                && TextUtils.equals(mAlphaShort, o.mAlphaShort);
    }
    }


    @Override
    @Override
@@ -270,8 +241,6 @@ public final class CellIdentityGsm extends CellIdentity {
        dest.writeInt(mCid);
        dest.writeInt(mCid);
        dest.writeInt(mArfcn);
        dest.writeInt(mArfcn);
        dest.writeInt(mBsic);
        dest.writeInt(mBsic);
        dest.writeString(mAlphaLong);
        dest.writeString(mAlphaShort);
    }
    }


    /** Construct from Parcel, type has already been processed */
    /** Construct from Parcel, type has already been processed */
@@ -281,8 +250,6 @@ public final class CellIdentityGsm extends CellIdentity {
        mCid = in.readInt();
        mCid = in.readInt();
        mArfcn = in.readInt();
        mArfcn = in.readInt();
        mBsic = in.readInt();
        mBsic = in.readInt();
        mAlphaLong = in.readString();
        mAlphaShort = in.readString();


        if (DBG) log(toString());
        if (DBG) log(toString());
    }
    }
+4 −36
Original line number Original line Diff line number Diff line
@@ -16,7 +16,6 @@


package android.telephony;
package android.telephony;


import android.annotation.Nullable;
import android.os.Parcel;
import android.os.Parcel;
import android.text.TextUtils;
import android.text.TextUtils;


@@ -37,10 +36,6 @@ public final class CellIdentityLte extends CellIdentity {
    private final int mTac;
    private final int mTac;
    // 18-bit Absolute RF Channel Number
    // 18-bit Absolute RF Channel Number
    private final int mEarfcn;
    private final int mEarfcn;
    // long alpha Operator Name String or Enhanced Operator Name String
    private final String mAlphaLong;
    // short alpha Operator Name String or Enhanced Operator Name String
    private final String mAlphaShort;
    // cell bandwidth, in kHz
    // cell bandwidth, in kHz
    private final int mBandwidth;
    private final int mBandwidth;


@@ -48,14 +43,12 @@ public final class CellIdentityLte extends CellIdentity {
     * @hide
     * @hide
     */
     */
    public CellIdentityLte() {
    public CellIdentityLte() {
        super(TAG, TYPE_LTE, null, null);
        super(TAG, TYPE_LTE, null, null, null, null);
        mCi = Integer.MAX_VALUE;
        mCi = Integer.MAX_VALUE;
        mPci = Integer.MAX_VALUE;
        mPci = Integer.MAX_VALUE;
        mTac = Integer.MAX_VALUE;
        mTac = Integer.MAX_VALUE;
        mEarfcn = Integer.MAX_VALUE;
        mEarfcn = Integer.MAX_VALUE;
        mBandwidth = Integer.MAX_VALUE;
        mBandwidth = Integer.MAX_VALUE;
        mAlphaLong = null;
        mAlphaShort = null;
    }
    }


    /**
    /**
@@ -105,14 +98,12 @@ public final class CellIdentityLte extends CellIdentity {
     */
     */
    public CellIdentityLte(int ci, int pci, int tac, int earfcn, int bandwidth, String mccStr,
    public CellIdentityLte(int ci, int pci, int tac, int earfcn, int bandwidth, String mccStr,
            String mncStr, String alphal, String alphas) {
            String mncStr, String alphal, String alphas) {
        super(TAG, TYPE_LTE, mccStr, mncStr);
        super(TAG, TYPE_LTE, mccStr, mncStr, alphal, alphas);
        mCi = ci;
        mCi = ci;
        mPci = pci;
        mPci = pci;
        mTac = tac;
        mTac = tac;
        mEarfcn = earfcn;
        mEarfcn = earfcn;
        mBandwidth = bandwidth;
        mBandwidth = bandwidth;
        mAlphaLong = alphal;
        mAlphaShort = alphas;
    }
    }


    private CellIdentityLte(CellIdentityLte cid) {
    private CellIdentityLte(CellIdentityLte cid) {
@@ -198,24 +189,6 @@ public final class CellIdentityLte extends CellIdentity {
        return (mMccStr == null || mMncStr == null) ? null : mMccStr + mMncStr;
        return (mMccStr == null || mMncStr == null) ? null : mMccStr + mMncStr;
    }
    }


    /**
     * @return The long alpha tag associated with the current scan result (may be the operator
     * name string or extended operator name string). May be null if unknown.
     */
    @Nullable
    public CharSequence getOperatorAlphaLong() {
        return mAlphaLong;
    }

    /**
     * @return The short alpha tag associated with the current scan result (may be the operator
     * name string or extended operator name string).  May be null if unknown.
     */
    @Nullable
    public CharSequence getOperatorAlphaShort() {
        return mAlphaShort;
    }

    /** @hide */
    /** @hide */
    @Override
    @Override
    public int getChannelNumber() {
    public int getChannelNumber() {
@@ -224,7 +197,7 @@ public final class CellIdentityLte extends CellIdentity {


    @Override
    @Override
    public int hashCode() {
    public int hashCode() {
        return Objects.hash(mMccStr, mMncStr, mCi, mPci, mTac, mAlphaLong, mAlphaShort);
        return Objects.hash(mCi, mPci, mTac, super.hashCode());
    }
    }


    @Override
    @Override
@@ -245,8 +218,7 @@ public final class CellIdentityLte extends CellIdentity {
                && mBandwidth == o.mBandwidth
                && mBandwidth == o.mBandwidth
                && TextUtils.equals(mMccStr, o.mMccStr)
                && TextUtils.equals(mMccStr, o.mMccStr)
                && TextUtils.equals(mMncStr, o.mMncStr)
                && TextUtils.equals(mMncStr, o.mMncStr)
                && TextUtils.equals(mAlphaLong, o.mAlphaLong)
                && super.equals(other);
                && TextUtils.equals(mAlphaShort, o.mAlphaShort);
    }
    }


    @Override
    @Override
@@ -274,8 +246,6 @@ public final class CellIdentityLte extends CellIdentity {
        dest.writeInt(mTac);
        dest.writeInt(mTac);
        dest.writeInt(mEarfcn);
        dest.writeInt(mEarfcn);
        dest.writeInt(mBandwidth);
        dest.writeInt(mBandwidth);
        dest.writeString(mAlphaLong);
        dest.writeString(mAlphaShort);
    }
    }


    /** Construct from Parcel, type has already been processed */
    /** Construct from Parcel, type has already been processed */
@@ -286,8 +256,6 @@ public final class CellIdentityLte extends CellIdentity {
        mTac = in.readInt();
        mTac = in.readInt();
        mEarfcn = in.readInt();
        mEarfcn = in.readInt();
        mBandwidth = in.readInt();
        mBandwidth = in.readInt();
        mAlphaLong = in.readString();
        mAlphaShort = in.readString();


        if (DBG) log(toString());
        if (DBG) log(toString());
    }
    }
Loading