Merge "Merge CellInfo TYPE Enums" am: d3395b08c2

am: d21d855932

Change-Id: I6c6ac9d9d7808997d62130afa20ac3f9c088c4d7
This commit is contained in:
Nathan Harold
2018-08-10 19:08:11 -07:00
committed by android-build-merger
8 changed files with 69 additions and 80 deletions

View File

@@ -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");
}
}

View File

@@ -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();

View File

@@ -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();

View File

@@ -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();

View File

@@ -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();

View File

@@ -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();

View File

@@ -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");
}
}

View File

@@ -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);
}