diff options
| author | 2018-08-10 19:08:11 -0700 | |
|---|---|---|
| committer | 2018-08-10 19:08:11 -0700 | |
| commit | d827e4b6ada409f14f3a93f9f19ad40f8d6c8c3a (patch) | |
| tree | 249d3550e41f4e691cb58eb639b8c16cbc896ec2 | |
| parent | 1fb65f179887f4f3227ea32b368e309434eb4ac0 (diff) | |
| parent | d21d85593217b5c161cdefc055f81c8ac6dfbff2 (diff) | |
Merge "Merge CellInfo TYPE Enums" am: d3395b08c2
am: d21d855932
Change-Id: I6c6ac9d9d7808997d62130afa20ac3f9c088c4d7
8 files changed, 69 insertions, 80 deletions
diff --git a/telephony/java/android/telephony/CellIdentity.java b/telephony/java/android/telephony/CellIdentity.java index 2a41829dcc2f..c240dbb684e6 100644 --- a/telephony/java/android/telephony/CellIdentity.java +++ b/telephony/java/android/telephony/CellIdentity.java @@ -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"); } } diff --git a/telephony/java/android/telephony/CellIdentityCdma.java b/telephony/java/android/telephony/CellIdentityCdma.java index 58a2c455636b..28090666ea68 100644 --- a/telephony/java/android/telephony/CellIdentityCdma.java +++ b/telephony/java/android/telephony/CellIdentityCdma.java @@ -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(); diff --git a/telephony/java/android/telephony/CellIdentityGsm.java b/telephony/java/android/telephony/CellIdentityGsm.java index c697880faced..4031254ab071 100644 --- a/telephony/java/android/telephony/CellIdentityGsm.java +++ b/telephony/java/android/telephony/CellIdentityGsm.java @@ -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(); diff --git a/telephony/java/android/telephony/CellIdentityLte.java b/telephony/java/android/telephony/CellIdentityLte.java index 177fcedf8c15..52573727e1c6 100644 --- a/telephony/java/android/telephony/CellIdentityLte.java +++ b/telephony/java/android/telephony/CellIdentityLte.java @@ -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(); diff --git a/telephony/java/android/telephony/CellIdentityTdscdma.java b/telephony/java/android/telephony/CellIdentityTdscdma.java index b99fe466ec46..21b9601bcad9 100644 --- a/telephony/java/android/telephony/CellIdentityTdscdma.java +++ b/telephony/java/android/telephony/CellIdentityTdscdma.java @@ -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(); diff --git a/telephony/java/android/telephony/CellIdentityWcdma.java b/telephony/java/android/telephony/CellIdentityWcdma.java index 43f9406be79e..a4ac8e30d02e 100644 --- a/telephony/java/android/telephony/CellIdentityWcdma.java +++ b/telephony/java/android/telephony/CellIdentityWcdma.java @@ -42,7 +42,7 @@ public final class CellIdentityWcdma extends CellIdentity { * @hide */ public CellIdentityWcdma() { - super(TAG, TYPE_TDSCDMA, null, null, null, null); + super(TAG, CellInfo.TYPE_WCDMA, null, null, null, null); mLac = Integer.MAX_VALUE; mCid = Integer.MAX_VALUE; mPsc = Integer.MAX_VALUE; @@ -93,7 +93,7 @@ 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, alphal, alphas); + super(TAG, CellInfo.TYPE_WCDMA, mccStr, mncStr, alphal, alphas); mLac = lac; mCid = cid; mPsc = psc; @@ -227,7 +227,7 @@ public final class CellIdentityWcdma extends CellIdentity { @Override public void writeToParcel(Parcel dest, int flags) { if (DBG) log("writeToParcel(Parcel, int): " + toString()); - super.writeToParcel(dest, TYPE_WCDMA); + super.writeToParcel(dest, CellInfo.TYPE_WCDMA); dest.writeInt(mLac); dest.writeInt(mCid); dest.writeInt(mPsc); @@ -236,7 +236,7 @@ public final class CellIdentityWcdma extends CellIdentity { /** Construct from Parcel, type has already been processed */ private CellIdentityWcdma(Parcel in) { - super(TAG, TYPE_WCDMA, in); + super(TAG, CellInfo.TYPE_WCDMA, in); mLac = in.readInt(); mCid = in.readInt(); mPsc = in.readInt(); diff --git a/telephony/java/android/telephony/CellInfo.java b/telephony/java/android/telephony/CellInfo.java index bffeb170792e..6b320f4352cc 100644 --- a/telephony/java/android/telephony/CellInfo.java +++ b/telephony/java/android/telephony/CellInfo.java @@ -29,17 +29,43 @@ import java.lang.annotation.RetentionPolicy; */ public abstract class CellInfo implements Parcelable { - // Type fields for parceling - /** @hide */ - protected static final int TYPE_GSM = 1; - /** @hide */ - protected static final int TYPE_CDMA = 2; - /** @hide */ - protected static final int TYPE_LTE = 3; - /** @hide */ - protected static final int TYPE_WCDMA = 4; - /** @hide */ - protected static final int TYPE_TDCDMA = 5; + /** + * 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; + /** + * TD-SCDMA cell identity type + * @hide + */ + public static final int TYPE_TDSCDMA = 5; // Type to distinguish where time stamp gets recorded. @@ -161,6 +187,7 @@ public abstract class CellInfo implements Parcelable { public int getTimeStampType() { return mTimeStampType; } + /** @hide */ public void setTimeStampType(int timeStampType) { if (timeStampType < TIMESTAMP_TYPE_UNKNOWN || timeStampType > TIMESTAMP_TYPE_JAVA_RIL) { @@ -272,7 +299,7 @@ public abstract class CellInfo implements Parcelable { case TYPE_CDMA: return CellInfoCdma.createFromParcelBody(in); case TYPE_LTE: return CellInfoLte.createFromParcelBody(in); case TYPE_WCDMA: return CellInfoWcdma.createFromParcelBody(in); - case TYPE_TDCDMA: return CellInfoTdscdma.createFromParcelBody(in); + case TYPE_TDSCDMA: return CellInfoTdscdma.createFromParcelBody(in); default: throw new RuntimeException("Bad CellInfo Parcel"); } } diff --git a/telephony/java/android/telephony/CellInfoTdscdma.java b/telephony/java/android/telephony/CellInfoTdscdma.java index 4fb1bce1cb8f..40cadde364dc 100644 --- a/telephony/java/android/telephony/CellInfoTdscdma.java +++ b/telephony/java/android/telephony/CellInfoTdscdma.java @@ -110,7 +110,7 @@ public final class CellInfoTdscdma extends CellInfo implements Parcelable { /** Implement the Parcelable interface */ @Override public void writeToParcel(Parcel dest, int flags) { - super.writeToParcel(dest, flags, TYPE_TDCDMA); + super.writeToParcel(dest, flags, TYPE_TDSCDMA); mCellIdentityTdscdma.writeToParcel(dest, flags); mCellSignalStrengthTdscdma.writeToParcel(dest, flags); } |