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

This commit is contained in:
Treehugger Robot
2018-03-29 16:45:52 +00:00
committed by Gerrit Code Review
7 changed files with 76 additions and 200 deletions

View File

@@ -40193,6 +40193,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;
}
@@ -40202,8 +40204,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;
@@ -40219,8 +40219,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;
@@ -40235,8 +40233,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);
@@ -40261,8 +40257,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);

View File

@@ -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 */

View File

@@ -16,9 +16,7 @@
package android.telephony;
import android.annotation.Nullable;
import android.os.Parcel;
import android.text.TextUtils;
import java.util.Objects;
@@ -49,23 +47,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 +92,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 +102,6 @@ public final class CellIdentityCdma extends CellIdentity {
} else {
mLongitude = mLatitude = Integer.MAX_VALUE;
}
mAlphaLong = alphal;
mAlphaShort = alphas;
}
private CellIdentityCdma(CellIdentityCdma cid) {
@@ -178,28 +168,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 +191,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 +217,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 +227,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());
}

View File

@@ -16,7 +16,6 @@
package android.telephony;
import android.annotation.Nullable;
import android.os.Parcel;
import android.text.TextUtils;
@@ -37,22 +36,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 +91,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 +178,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 +195,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 +215,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 +241,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 +250,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());
}

View File

@@ -16,7 +16,6 @@
package android.telephony;
import android.annotation.Nullable;
import android.os.Parcel;
import android.text.TextUtils;
@@ -37,10 +36,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 +43,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 +98,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 +189,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 +197,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 +218,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 +246,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 +256,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());
}

View File

@@ -16,7 +16,6 @@
package android.telephony;
import android.annotation.Nullable;
import android.os.Parcel;
import android.text.TextUtils;
@@ -35,21 +34,15 @@ public final class CellIdentityTdscdma extends CellIdentity {
private final int mCid;
// 8-bit Cell Parameters ID described in TS 25.331, 0..127, INT_MAX if unknown.
private final int mCpid;
// 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 CellIdentityTdscdma() {
super(TAG, TYPE_TDSCDMA, null, null);
super(TAG, TYPE_TDSCDMA, null, null, null, null);
mLac = Integer.MAX_VALUE;
mCid = Integer.MAX_VALUE;
mCpid = Integer.MAX_VALUE;
mAlphaLong = null;
mAlphaShort = null;
}
/**
@@ -76,12 +69,10 @@ public final class CellIdentityTdscdma extends CellIdentity {
* @hide
*/
public CellIdentityTdscdma(String mcc, String mnc, int lac, int cid, int cpid) {
super(TAG, TYPE_TDSCDMA, mcc, mnc);
super(TAG, TYPE_TDSCDMA, mcc, mnc, null, null);
mLac = lac;
mCid = cid;
mCpid = cpid;
mAlphaLong = null;
mAlphaShort = null;
}
/**
@@ -97,12 +88,10 @@ public final class CellIdentityTdscdma extends CellIdentity {
*/
public CellIdentityTdscdma(String mcc, String mnc, int lac, int cid, int cpid,
String alphal, String alphas) {
super(TAG, TYPE_TDSCDMA, mcc, mnc);
super(TAG, TYPE_TDSCDMA, mcc, mnc, alphal, alphas);
mLac = lac;
mCid = cid;
mCpid = cpid;
mAlphaLong = alphal;
mAlphaShort = alphas;
}
private CellIdentityTdscdma(CellIdentityTdscdma cid) {
@@ -151,31 +140,9 @@ public final class CellIdentityTdscdma extends CellIdentity {
return mCpid;
}
/**
* @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.
*
* @hide
*/
@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.
*
* @hide
*/
@Nullable
public CharSequence getOperatorAlphaShort() {
return mAlphaShort;
}
@Override
public int hashCode() {
return Objects.hash(mMccStr, mMncStr, mLac, mCid, mCpid, mAlphaLong, mAlphaShort);
return Objects.hash(mLac, mCid, mCpid, super.hashCode());
}
@Override
@@ -194,8 +161,7 @@ public final class CellIdentityTdscdma extends CellIdentity {
&& mLac == o.mLac
&& mCid == o.mCid
&& mCpid == o.mCpid
&& mAlphaLong == o.mAlphaLong
&& mAlphaShort == o.mAlphaShort;
&& super.equals(other);
}
@Override
@@ -219,8 +185,6 @@ public final class CellIdentityTdscdma extends CellIdentity {
dest.writeInt(mLac);
dest.writeInt(mCid);
dest.writeInt(mCpid);
dest.writeString(mAlphaLong);
dest.writeString(mAlphaShort);
}
/** Construct from Parcel, type has already been processed */
@@ -229,8 +193,6 @@ public final class CellIdentityTdscdma extends CellIdentity {
mLac = in.readInt();
mCid = in.readInt();
mCpid = in.readInt();
mAlphaLong = in.readString();
mAlphaShort = in.readString();
if (DBG) log(toString());
}

View File

@@ -16,7 +16,6 @@
package android.telephony;
import android.annotation.Nullable;
import android.os.Parcel;
import android.text.TextUtils;
@@ -37,22 +36,16 @@ public final class CellIdentityWcdma extends CellIdentity {
private final int mPsc;
// 16-bit UMTS Absolute RF Channel Number
private final int mUarfcn;
// 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 CellIdentityWcdma() {
super(TAG, TYPE_TDSCDMA, null, null);
super(TAG, TYPE_TDSCDMA, null, null, null, null);
mLac = Integer.MAX_VALUE;
mCid = Integer.MAX_VALUE;
mPsc = Integer.MAX_VALUE;
mUarfcn = Integer.MAX_VALUE;
mAlphaLong = null;
mAlphaShort = null;
}
/**
* public constructor
@@ -99,13 +92,11 @@ public final class CellIdentityWcdma extends CellIdentity {
*/
public CellIdentityWcdma (int lac, int cid, int psc, int uarfcn,
String mccStr, String mncStr, String alphal, String alphas) {
super(TAG, TYPE_WCDMA, mccStr, mncStr);
super(TAG, TYPE_WCDMA, mccStr, mncStr, alphal, alphas);
mLac = lac;
mCid = cid;
mPsc = psc;
mUarfcn = uarfcn;
mAlphaLong = alphal;
mAlphaShort = alphas;
}
private CellIdentityWcdma(CellIdentityWcdma cid) {
@@ -179,27 +170,9 @@ public final class CellIdentityWcdma 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;
}
@Override
public int hashCode() {
return Objects.hash(mMccStr, mMncStr, mLac, mCid, mPsc, mAlphaLong, mAlphaShort);
return Objects.hash(mLac, mCid, mPsc, super.hashCode());
}
/**
@@ -232,8 +205,7 @@ public final class CellIdentityWcdma extends CellIdentity {
&& mUarfcn == o.mUarfcn
&& TextUtils.equals(mMccStr, o.mMccStr)
&& TextUtils.equals(mMncStr, o.mMncStr)
&& TextUtils.equals(mAlphaLong, o.mAlphaLong)
&& TextUtils.equals(mAlphaShort, o.mAlphaShort);
&& super.equals(other);
}
@Override
@@ -259,8 +231,6 @@ public final class CellIdentityWcdma extends CellIdentity {
dest.writeInt(mCid);
dest.writeInt(mPsc);
dest.writeInt(mUarfcn);
dest.writeString(mAlphaLong);
dest.writeString(mAlphaShort);
}
/** Construct from Parcel, type has already been processed */
@@ -270,8 +240,6 @@ public final class CellIdentityWcdma extends CellIdentity {
mCid = in.readInt();
mPsc = in.readInt();
mUarfcn = in.readInt();
mAlphaLong = in.readString();
mAlphaShort = in.readString();
if (DBG) log(toString());
}
@@ -295,4 +263,4 @@ public final class CellIdentityWcdma extends CellIdentity {
protected static CellIdentityWcdma createFromParcelBody(Parcel in) {
return new CellIdentityWcdma(in);
}
}
}