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

Commit c2bdecb8 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Move alpha long/short to the base CellIdentity according API Review." into pi-dev

parents ee7802f5 21ed3c58
Loading
Loading
Loading
Loading
+2 −8
Original line number Diff line number Diff line
@@ -41651,6 +41651,8 @@ package android.telephony {
  public abstract class CellIdentity implements android.os.Parcelable {
    method public int describeContents();
    method public java.lang.CharSequence getOperatorAlphaLong();
    method public java.lang.CharSequence getOperatorAlphaShort();
    method public void writeToParcel(android.os.Parcel, int);
    field public static final android.os.Parcelable.Creator<android.telephony.CellIdentity> CREATOR;
  }
@@ -41660,8 +41662,6 @@ package android.telephony {
    method public int getLatitude();
    method public int getLongitude();
    method public int getNetworkId();
    method public java.lang.CharSequence getOperatorAlphaLong();
    method public java.lang.CharSequence getOperatorAlphaShort();
    method public int getSystemId();
    method public void writeToParcel(android.os.Parcel, int);
    field public static final android.os.Parcelable.Creator<android.telephony.CellIdentityCdma> CREATOR;
@@ -41677,8 +41677,6 @@ package android.telephony {
    method public deprecated int getMnc();
    method public java.lang.String getMncString();
    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 void writeToParcel(android.os.Parcel, int);
    field public static final android.os.Parcelable.Creator<android.telephony.CellIdentityGsm> CREATOR;
@@ -41693,8 +41691,6 @@ package android.telephony {
    method public deprecated int getMnc();
    method public java.lang.String getMncString();
    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 getTac();
    method public void writeToParcel(android.os.Parcel, int);
@@ -41719,8 +41715,6 @@ package android.telephony {
    method public deprecated int getMnc();
    method public java.lang.String getMncString();
    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 getUarfcn();
    method public void writeToParcel(android.os.Parcel, int);
+52 −2
Original line number Diff line number Diff line
@@ -18,11 +18,14 @@ 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;

/**
 * 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 */
    protected final String mMncStr;

    // long alpha Operator Name String or Enhanced Operator Name String
    /** @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;
        mType = type;

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

    /** Implement the Parcelable interface */
@@ -137,6 +150,40 @@ public abstract class CellIdentity implements Parcelable {
        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.
     *
@@ -147,6 +194,8 @@ public abstract class CellIdentity implements Parcelable {
        dest.writeInt(type);
        dest.writeString(mMccStr);
        dest.writeString(mMncStr);
        dest.writeString(mAlphaLong);
        dest.writeString(mAlphaShort);
    }

    /**
@@ -154,7 +203,8 @@ public abstract class CellIdentity implements Parcelable {
     * @hide
     */
    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 */
+4 −35
Original line number Diff line number Diff line
@@ -49,23 +49,17 @@ public final class CellIdentityCdma extends CellIdentity {
     * to +90 degrees).
     */
    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
     */
    public CellIdentityCdma() {
        super(TAG, TYPE_CDMA, null, null);
        super(TAG, TYPE_CDMA, null, null, null, null);
        mNetworkId = Integer.MAX_VALUE;
        mSystemId = Integer.MAX_VALUE;
        mBasestationId = Integer.MAX_VALUE;
        mLongitude = Integer.MAX_VALUE;
        mLatitude = Integer.MAX_VALUE;
        mAlphaLong = null;
        mAlphaShort = null;
    }

    /**
@@ -100,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);
        super(TAG, TYPE_CDMA, null, null, alphal, alphas);
        mNetworkId = nid;
        mSystemId = sid;
        mBasestationId = bid;
@@ -110,8 +104,6 @@ public final class CellIdentityCdma extends CellIdentity {
        } else {
            mLongitude = mLatitude = Integer.MAX_VALUE;
        }
        mAlphaLong = alphal;
        mAlphaShort = alphas;
    }

    private CellIdentityCdma(CellIdentityCdma cid) {
@@ -178,28 +170,10 @@ public final class CellIdentityCdma extends CellIdentity {
        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
    public int hashCode() {
        return Objects.hash(mNetworkId, mSystemId, mBasestationId, mLatitude, mLongitude,
                mAlphaLong, mAlphaShort);
                super.hashCode());
    }

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

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

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

        if (DBG) log(toString());
    }
+4 −36
Original line number Diff line number Diff line
@@ -37,22 +37,16 @@ public final class CellIdentityGsm extends CellIdentity {
    private final int mArfcn;
    // 6-bit Base Station Identity Code
    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
     */
    public CellIdentityGsm() {
        super(TAG, TYPE_GSM, null, null);
        super(TAG, TYPE_GSM, null, null, null, null);
        mLac = Integer.MAX_VALUE;
        mCid = Integer.MAX_VALUE;
        mArfcn = Integer.MAX_VALUE;
        mBsic = Integer.MAX_VALUE;
        mAlphaLong = null;
        mAlphaShort = null;
    }
    /**
     * public constructor
@@ -98,16 +92,13 @@ 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);
        super(TAG, TYPE_GSM, mccStr, mncStr, alphal, alphas);
        mLac = lac;
        mCid = cid;
        mArfcn = arfcn;
        // In RIL BSIC is a UINT8, so 0xFF is the 'INVALID' designator
        // for inbound parcels
        mBsic = (bsic == 0xFF) ? Integer.MAX_VALUE : bsic;

        mAlphaLong = alphal;
        mAlphaShort = alphas;
    }

    private CellIdentityGsm(CellIdentityGsm cid) {
@@ -188,24 +179,6 @@ public final class CellIdentityGsm extends CellIdentity {
        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 */
    @Override
    public int getChannelNumber() {
@@ -223,7 +196,7 @@ public final class CellIdentityGsm extends CellIdentity {

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

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

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

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

        if (DBG) log(toString());
    }
+4 −35
Original line number Diff line number Diff line
@@ -37,10 +37,6 @@ public final class CellIdentityLte extends CellIdentity {
    private final int mTac;
    // 18-bit Absolute RF Channel Number
    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
    private final int mBandwidth;

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

    /**
@@ -105,14 +99,12 @@ 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);
        super(TAG, TYPE_LTE, mccStr, mncStr, alphal, alphas);
        mCi = ci;
        mPci = pci;
        mTac = tac;
        mEarfcn = earfcn;
        mBandwidth = bandwidth;
        mAlphaLong = alphal;
        mAlphaShort = alphas;
    }

    private CellIdentityLte(CellIdentityLte cid) {
@@ -198,24 +190,6 @@ public final class CellIdentityLte extends CellIdentity {
        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 */
    @Override
    public int getChannelNumber() {
@@ -224,7 +198,7 @@ public final class CellIdentityLte extends CellIdentity {

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

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

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

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

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