Merge changes from topics "multi-plmn", "nr_band"

* changes:
  Added NR band support
  Multi-Plmn and CSG Support For CellInfo
This commit is contained in:
Sarah Chin
2020-01-29 15:56:09 +00:00
committed by Gerrit Code Review
11 changed files with 632 additions and 34 deletions

View File

@@ -44962,6 +44962,7 @@ package android.telephony {
} }
public final class CellIdentityGsm extends android.telephony.CellIdentity { public final class CellIdentityGsm extends android.telephony.CellIdentity {
method @NonNull public java.util.List<java.lang.String> getAdditionalPlmns();
method public int getArfcn(); method public int getArfcn();
method public int getBsic(); method public int getBsic();
method public int getCid(); method public int getCid();
@@ -44977,8 +44978,10 @@ package android.telephony {
} }
public final class CellIdentityLte extends android.telephony.CellIdentity { public final class CellIdentityLte extends android.telephony.CellIdentity {
method @NonNull public java.util.List<java.lang.String> getAdditionalPlmns();
method public int getBandwidth(); method public int getBandwidth();
method public int getCi(); method public int getCi();
method @Nullable public android.telephony.ClosedSubscriberGroupInfo getClosedSubscriberGroupInfo();
method public int getEarfcn(); method public int getEarfcn();
method @Deprecated public int getMcc(); method @Deprecated public int getMcc();
method @Nullable public String getMccString(); method @Nullable public String getMccString();
@@ -44992,6 +44995,8 @@ package android.telephony {
} }
public final class CellIdentityNr extends android.telephony.CellIdentity { public final class CellIdentityNr extends android.telephony.CellIdentity {
method @NonNull public java.util.List<java.lang.String> getAdditionalPlmns();
method public int getBand();
method @Nullable public String getMccString(); method @Nullable public String getMccString();
method @Nullable public String getMncString(); method @Nullable public String getMncString();
method public long getNci(); method public long getNci();
@@ -45003,7 +45008,9 @@ package android.telephony {
} }
public final class CellIdentityTdscdma extends android.telephony.CellIdentity { public final class CellIdentityTdscdma extends android.telephony.CellIdentity {
method @NonNull public java.util.List<java.lang.String> getAdditionalPlmns();
method public int getCid(); method public int getCid();
method @Nullable public android.telephony.ClosedSubscriberGroupInfo getClosedSubscriberGroupInfo();
method public int getCpid(); method public int getCpid();
method public int getLac(); method public int getLac();
method @Nullable public String getMccString(); method @Nullable public String getMccString();
@@ -45015,7 +45022,9 @@ package android.telephony {
} }
public final class CellIdentityWcdma extends android.telephony.CellIdentity { public final class CellIdentityWcdma extends android.telephony.CellIdentity {
method @NonNull public java.util.List<java.lang.String> getAdditionalPlmns();
method public int getCid(); method public int getCid();
method @Nullable public android.telephony.ClosedSubscriberGroupInfo getClosedSubscriberGroupInfo();
method public int getLac(); method public int getLac();
method @Deprecated public int getMcc(); method @Deprecated public int getMcc();
method @Nullable public String getMccString(); method @Nullable public String getMccString();
@@ -45185,6 +45194,15 @@ package android.telephony {
field @NonNull public static final android.os.Parcelable.Creator<android.telephony.CellSignalStrengthWcdma> CREATOR; field @NonNull public static final android.os.Parcelable.Creator<android.telephony.CellSignalStrengthWcdma> CREATOR;
} }
public final class ClosedSubscriberGroupInfo implements android.os.Parcelable {
method public int describeContents();
method @IntRange(from=0, to=134217727) public int getCsgIdentity();
method public boolean getCsgIndicator();
method @NonNull public String getHomeNodebName();
method public void writeToParcel(@NonNull android.os.Parcel, int);
field @NonNull public static final android.os.Parcelable.Creator<android.telephony.ClosedSubscriberGroupInfo> CREATOR;
}
public class IccOpenLogicalChannelResponse implements android.os.Parcelable { public class IccOpenLogicalChannelResponse implements android.os.Parcelable {
method public int describeContents(); method public int describeContents();
method public int getChannel(); method public int getChannel();

View File

@@ -8391,6 +8391,13 @@ package android.telephony {
field public static final int TRANSPORT_TYPE_INVALID = -1; // 0xffffffff field public static final int TRANSPORT_TYPE_INVALID = -1; // 0xffffffff
} }
public static final class AccessNetworkConstants.NgranBands {
method public static int getFrequencyRangeGroup(int);
field public static final int FREQUENCY_RANGE_GROUP_1 = 1; // 0x1
field public static final int FREQUENCY_RANGE_GROUP_2 = 2; // 0x2
field public static final int FREQUENCY_RANGE_GROUP_UNKNOWN = 0; // 0x0
}
public final class CallAttributes implements android.os.Parcelable { public final class CallAttributes implements android.os.Parcelable {
ctor public CallAttributes(@NonNull android.telephony.PreciseCallState, int, @NonNull android.telephony.CallQuality); ctor public CallAttributes(@NonNull android.telephony.PreciseCallState, int, @NonNull android.telephony.CallQuality);
method public int describeContents(); method public int describeContents();

View File

@@ -3036,6 +3036,13 @@ package android.telephony {
field public static final int TRANSPORT_TYPE_INVALID = -1; // 0xffffffff field public static final int TRANSPORT_TYPE_INVALID = -1; // 0xffffffff
} }
public static final class AccessNetworkConstants.NgranBands {
method public static int getFrequencyRangeGroup(int);
field public static final int FREQUENCY_RANGE_GROUP_1 = 1; // 0x1
field public static final int FREQUENCY_RANGE_GROUP_2 = 2; // 0x2
field public static final int FREQUENCY_RANGE_GROUP_UNKNOWN = 0; // 0x0
}
public final class CallQuality implements android.os.Parcelable { public final class CallQuality implements android.os.Parcelable {
ctor public CallQuality(int, int, int, int, int, int, int, int, int, int, int); ctor public CallQuality(int, int, int, int, int, int, int, int, int, int, int);
method public int describeContents(); method public int describeContents();

View File

@@ -317,6 +317,159 @@ public final class AccessNetworkConstants {
public static final int BAND_260 = 260; public static final int BAND_260 = 260;
public static final int BAND_261 = 261; public static final int BAND_261 = 261;
/**
* NR Bands
*
* @hide */
@Retention(RetentionPolicy.SOURCE)
@IntDef(prefix = {"BAND_"},
value = {BAND_1,
BAND_2,
BAND_3,
BAND_5,
BAND_7,
BAND_8,
BAND_12,
BAND_14,
BAND_18,
BAND_20,
BAND_25,
BAND_28,
BAND_29,
BAND_30,
BAND_34,
BAND_38,
BAND_39,
BAND_40,
BAND_41,
BAND_48,
BAND_50,
BAND_51,
BAND_65,
BAND_66,
BAND_70,
BAND_71,
BAND_74,
BAND_75,
BAND_76,
BAND_77,
BAND_78,
BAND_79,
BAND_80,
BAND_81,
BAND_82,
BAND_83,
BAND_84,
BAND_86,
BAND_90,
BAND_257,
BAND_258,
BAND_260,
BAND_261})
public @interface NgranBand {}
/**
* Unknown NR frequency.
*
* @hide
*/
@SystemApi
@TestApi
public static final int FREQUENCY_RANGE_GROUP_UNKNOWN = 0;
/**
* NR frequency group 1 defined in 3GPP TS 38.101-1 table 5.2-1
*
* @hide
*/
@SystemApi
@TestApi
public static final int FREQUENCY_RANGE_GROUP_1 = 1;
/**
* NR frequency group 2 defined in 3GPP TS 38.101-2 table 5.2-1
*
* @hide
*/
@SystemApi
@TestApi
public static final int FREQUENCY_RANGE_GROUP_2 = 2;
/**
* Radio frequency range group
*
* @hide
*/
@Retention(RetentionPolicy.SOURCE)
@IntDef(prefix = {"FREQUENCY_RANGE_GROUP_"},
value = {
FREQUENCY_RANGE_GROUP_UNKNOWN,
FREQUENCY_RANGE_GROUP_1,
FREQUENCY_RANGE_GROUP_2})
public @interface FrequencyRangeGroup {}
/**
* Get frequency range group
*
* @param band NR band
* @return The frequency range group
*
* @hide
*/
@SystemApi
@TestApi
public static @FrequencyRangeGroup int getFrequencyRangeGroup(@NgranBand int band) {
switch (band) {
case BAND_1:
case BAND_2:
case BAND_3:
case BAND_5:
case BAND_7:
case BAND_8:
case BAND_12:
case BAND_14:
case BAND_18:
case BAND_20:
case BAND_25:
case BAND_28:
case BAND_29:
case BAND_30:
case BAND_34:
case BAND_38:
case BAND_39:
case BAND_40:
case BAND_41:
case BAND_48:
case BAND_50:
case BAND_51:
case BAND_65:
case BAND_66:
case BAND_70:
case BAND_71:
case BAND_74:
case BAND_75:
case BAND_76:
case BAND_77:
case BAND_78:
case BAND_79:
case BAND_80:
case BAND_81:
case BAND_82:
case BAND_83:
case BAND_84:
case BAND_86:
case BAND_90:
return FREQUENCY_RANGE_GROUP_1;
case BAND_257:
case BAND_258:
case BAND_260:
case BAND_261:
return FREQUENCY_RANGE_GROUP_2;
default:
return FREQUENCY_RANGE_GROUP_UNKNOWN;
}
};
/** @hide */ /** @hide */
private NgranBands() {} private NgranBands() {}
} }

View File

@@ -23,6 +23,8 @@ import android.os.Parcel;
import android.telephony.gsm.GsmCellLocation; import android.telephony.gsm.GsmCellLocation;
import android.text.TextUtils; import android.text.TextUtils;
import java.util.Collections;
import java.util.List;
import java.util.Objects; import java.util.Objects;
/** /**
@@ -46,6 +48,9 @@ public final class CellIdentityGsm extends CellIdentity {
// 6-bit Base Station Identity Code // 6-bit Base Station Identity Code
private final int mBsic; private final int mBsic;
// a list of additional PLMN-IDs reported for this cell
private final List<String> mAdditionalPlmns;
/** /**
* @hide * @hide
*/ */
@@ -56,6 +61,7 @@ public final class CellIdentityGsm extends CellIdentity {
mCid = CellInfo.UNAVAILABLE; mCid = CellInfo.UNAVAILABLE;
mArfcn = CellInfo.UNAVAILABLE; mArfcn = CellInfo.UNAVAILABLE;
mBsic = CellInfo.UNAVAILABLE; mBsic = CellInfo.UNAVAILABLE;
mAdditionalPlmns = Collections.emptyList();
} }
/** /**
@@ -68,35 +74,48 @@ public final class CellIdentityGsm extends CellIdentity {
* @param mncStr 2 or 3-digit Mobile Network Code in string format * @param mncStr 2 or 3-digit Mobile Network Code in string format
* @param alphal long alpha Operator Name String or Enhanced Operator Name String * @param alphal long alpha Operator Name String or Enhanced Operator Name String
* @param alphas short alpha Operator Name String or Enhanced Operator Name String * @param alphas short alpha Operator Name String or Enhanced Operator Name String
* @param additionalPlmns a list of additional PLMN IDs broadcast by the cell
* *
* @hide * @hide
*/ */
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,
List<String> additionalPlmns) {
super(TAG, CellInfo.TYPE_GSM, mccStr, mncStr, alphal, alphas); super(TAG, CellInfo.TYPE_GSM, mccStr, mncStr, alphal, alphas);
mLac = inRangeOrUnavailable(lac, 0, MAX_LAC); mLac = inRangeOrUnavailable(lac, 0, MAX_LAC);
mCid = inRangeOrUnavailable(cid, 0, MAX_CID); mCid = inRangeOrUnavailable(cid, 0, MAX_CID);
mArfcn = inRangeOrUnavailable(arfcn, 0, MAX_ARFCN); mArfcn = inRangeOrUnavailable(arfcn, 0, MAX_ARFCN);
mBsic = inRangeOrUnavailable(bsic, 0, MAX_BSIC); mBsic = inRangeOrUnavailable(bsic, 0, MAX_BSIC);
mAdditionalPlmns = additionalPlmns;
} }
/** @hide */ /** @hide */
public CellIdentityGsm(android.hardware.radio.V1_0.CellIdentityGsm cid) { public CellIdentityGsm(android.hardware.radio.V1_0.CellIdentityGsm cid) {
this(cid.lac, cid.cid, cid.arfcn, this(cid.lac, cid.cid, cid.arfcn,
cid.bsic == (byte) 0xFF ? CellInfo.UNAVAILABLE : cid.bsic, cid.bsic == (byte) 0xFF ? CellInfo.UNAVAILABLE : cid.bsic,
cid.mcc, cid.mnc, "", ""); cid.mcc, cid.mnc, "", "", Collections.emptyList());
} }
/** @hide */ /** @hide */
public CellIdentityGsm(android.hardware.radio.V1_2.CellIdentityGsm cid) { public CellIdentityGsm(android.hardware.radio.V1_2.CellIdentityGsm cid) {
this(cid.base.lac, cid.base.cid, cid.base.arfcn, this(cid.base.lac, cid.base.cid, cid.base.arfcn,
cid.base.bsic == (byte) 0xFF ? CellInfo.UNAVAILABLE : cid.base.bsic, cid.base.mcc, cid.base.bsic == (byte) 0xFF ? CellInfo.UNAVAILABLE : cid.base.bsic, cid.base.mcc,
cid.base.mnc, cid.operatorNames.alphaLong, cid.operatorNames.alphaShort); cid.base.mnc, cid.operatorNames.alphaLong, cid.operatorNames.alphaShort,
Collections.emptyList());
}
/** @hide */
public CellIdentityGsm(android.hardware.radio.V1_5.CellIdentityGsm cid) {
this(cid.base.base.lac, cid.base.base.cid, cid.base.base.arfcn,
cid.base.base.bsic == (byte) 0xFF ? CellInfo.UNAVAILABLE
: cid.base.base.bsic, cid.base.base.mcc,
cid.base.base.mnc, cid.base.operatorNames.alphaLong,
cid.base.operatorNames.alphaShort, cid.additionalPlmns);
} }
private CellIdentityGsm(CellIdentityGsm cid) { private CellIdentityGsm(CellIdentityGsm cid) {
this(cid.mLac, cid.mCid, cid.mArfcn, cid.mBsic, cid.mMccStr, this(cid.mLac, cid.mCid, cid.mArfcn, cid.mBsic, cid.mMccStr,
cid.mMncStr, cid.mAlphaLong, cid.mAlphaShort); cid.mMncStr, cid.mAlphaLong, cid.mAlphaShort, cid.mAdditionalPlmns);
} }
CellIdentityGsm copy() { CellIdentityGsm copy() {
@@ -107,7 +126,7 @@ public final class CellIdentityGsm extends CellIdentity {
@Override @Override
public @NonNull CellIdentityGsm sanitizeLocationInfo() { public @NonNull CellIdentityGsm sanitizeLocationInfo() {
return new CellIdentityGsm(CellInfo.UNAVAILABLE, CellInfo.UNAVAILABLE, CellInfo.UNAVAILABLE, return new CellIdentityGsm(CellInfo.UNAVAILABLE, CellInfo.UNAVAILABLE, CellInfo.UNAVAILABLE,
CellInfo.UNAVAILABLE, mMccStr, mMncStr, mAlphaLong, mAlphaShort); CellInfo.UNAVAILABLE, mMccStr, mMncStr, mAlphaLong, mAlphaShort, mAdditionalPlmns);
} }
/** /**
@@ -192,6 +211,14 @@ public final class CellIdentityGsm extends CellIdentity {
return mArfcn; return mArfcn;
} }
/**
* @return a list of additional PLMN IDs supported by this cell.
*/
@NonNull
public List<String> getAdditionalPlmns() {
return mAdditionalPlmns;
}
/** /**
* @deprecated Primary Scrambling Code is not applicable to GSM. * @deprecated Primary Scrambling Code is not applicable to GSM.
* @return {@link android.telephony.CellInfo#UNAVAILABLE UNAVAILABLE} - undefined for GSM * @return {@link android.telephony.CellInfo#UNAVAILABLE UNAVAILABLE} - undefined for GSM
@@ -215,7 +242,7 @@ public final class CellIdentityGsm extends CellIdentity {
@Override @Override
public int hashCode() { public int hashCode() {
return Objects.hash(mLac, mCid, super.hashCode()); return Objects.hash(mLac, mCid, mAdditionalPlmns.hashCode(), super.hashCode());
} }
@Override @Override
@@ -235,6 +262,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)
&& mAdditionalPlmns.equals(o.mAdditionalPlmns)
&& super.equals(other); && super.equals(other);
} }
@@ -249,6 +277,7 @@ public final class CellIdentityGsm extends CellIdentity {
.append(" mMnc=").append(mMncStr) .append(" mMnc=").append(mMncStr)
.append(" mAlphaLong=").append(mAlphaLong) .append(" mAlphaLong=").append(mAlphaLong)
.append(" mAlphaShort=").append(mAlphaShort) .append(" mAlphaShort=").append(mAlphaShort)
.append(" mAdditionalPlmns=").append(mAdditionalPlmns)
.append("}").toString(); .append("}").toString();
} }
@@ -261,6 +290,7 @@ 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.writeList(mAdditionalPlmns);
} }
/** Construct from Parcel, type has already been processed */ /** Construct from Parcel, type has already been processed */
@@ -270,6 +300,7 @@ public final class CellIdentityGsm extends CellIdentity {
mCid = in.readInt(); mCid = in.readInt();
mArfcn = in.readInt(); mArfcn = in.readInt();
mBsic = in.readInt(); mBsic = in.readInt();
mAdditionalPlmns = in.readArrayList(null);
if (DBG) log(toString()); if (DBG) log(toString());
} }

View File

@@ -24,6 +24,8 @@ import android.os.Parcel;
import android.telephony.gsm.GsmCellLocation; import android.telephony.gsm.GsmCellLocation;
import android.text.TextUtils; import android.text.TextUtils;
import java.util.Collections;
import java.util.List;
import java.util.Objects; import java.util.Objects;
/** /**
@@ -50,6 +52,11 @@ public final class CellIdentityLte extends CellIdentity {
// cell bandwidth, in kHz // cell bandwidth, in kHz
private final int mBandwidth; private final int mBandwidth;
// a list of additional PLMN-IDs reported for this cell
private final List<String> mAdditionalPlmns;
private ClosedSubscriberGroupInfo mCsgInfo;
/** /**
* @hide * @hide
*/ */
@@ -61,6 +68,8 @@ public final class CellIdentityLte extends CellIdentity {
mTac = CellInfo.UNAVAILABLE; mTac = CellInfo.UNAVAILABLE;
mEarfcn = CellInfo.UNAVAILABLE; mEarfcn = CellInfo.UNAVAILABLE;
mBandwidth = CellInfo.UNAVAILABLE; mBandwidth = CellInfo.UNAVAILABLE;
mAdditionalPlmns = Collections.emptyList();
mCsgInfo = null;
} }
/** /**
@@ -76,7 +85,7 @@ public final class CellIdentityLte extends CellIdentity {
@UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P, trackingBug = 115609023) @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P, trackingBug = 115609023)
public CellIdentityLte(int mcc, int mnc, int ci, int pci, int tac) { public CellIdentityLte(int mcc, int mnc, int ci, int pci, int tac) {
this(ci, pci, tac, CellInfo.UNAVAILABLE, CellInfo.UNAVAILABLE, String.valueOf(mcc), this(ci, pci, tac, CellInfo.UNAVAILABLE, CellInfo.UNAVAILABLE, String.valueOf(mcc),
String.valueOf(mnc), null, null); String.valueOf(mnc), null, null, Collections.emptyList(), null);
} }
/** /**
@@ -90,34 +99,49 @@ public final class CellIdentityLte extends CellIdentity {
* @param mncStr 2 or 3-digit Mobile Network Code in string format * @param mncStr 2 or 3-digit Mobile Network Code in string format
* @param alphal long alpha Operator Name String or Enhanced Operator Name String * @param alphal long alpha Operator Name String or Enhanced Operator Name String
* @param alphas short alpha Operator Name String or Enhanced Operator Name String * @param alphas short alpha Operator Name String or Enhanced Operator Name String
* @param additionalPlmns a list of additional PLMN IDs broadcast by the cell
* @param csgInfo info about the closed subscriber group broadcast by the cell
* *
* @hide * @hide
*/ */
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, List<String> additionalPlmns,
ClosedSubscriberGroupInfo csgInfo) {
super(TAG, CellInfo.TYPE_LTE, mccStr, mncStr, alphal, alphas); super(TAG, CellInfo.TYPE_LTE, mccStr, mncStr, alphal, alphas);
mCi = inRangeOrUnavailable(ci, 0, MAX_CI); mCi = inRangeOrUnavailable(ci, 0, MAX_CI);
mPci = inRangeOrUnavailable(pci, 0, MAX_PCI); mPci = inRangeOrUnavailable(pci, 0, MAX_PCI);
mTac = inRangeOrUnavailable(tac, 0, MAX_TAC); mTac = inRangeOrUnavailable(tac, 0, MAX_TAC);
mEarfcn = inRangeOrUnavailable(earfcn, 0, MAX_EARFCN); mEarfcn = inRangeOrUnavailable(earfcn, 0, MAX_EARFCN);
mBandwidth = inRangeOrUnavailable(bandwidth, 0, MAX_BANDWIDTH); mBandwidth = inRangeOrUnavailable(bandwidth, 0, MAX_BANDWIDTH);
mAdditionalPlmns = additionalPlmns;
mCsgInfo = csgInfo;
} }
/** @hide */ /** @hide */
public CellIdentityLte(android.hardware.radio.V1_0.CellIdentityLte cid) { public CellIdentityLte(android.hardware.radio.V1_0.CellIdentityLte cid) {
this(cid.ci, cid.pci, cid.tac, cid.earfcn, CellInfo.UNAVAILABLE, cid.mcc, cid.mnc, "", ""); this(cid.ci, cid.pci, cid.tac, cid.earfcn,
CellInfo.UNAVAILABLE, cid.mcc, cid.mnc, "", "", Collections.emptyList(), null);
} }
/** @hide */ /** @hide */
public CellIdentityLte(android.hardware.radio.V1_2.CellIdentityLte cid) { public CellIdentityLte(android.hardware.radio.V1_2.CellIdentityLte cid) {
this(cid.base.ci, cid.base.pci, cid.base.tac, cid.base.earfcn, cid.bandwidth, this(cid.base.ci, cid.base.pci, cid.base.tac, cid.base.earfcn, cid.bandwidth,
cid.base.mcc, cid.base.mnc, cid.operatorNames.alphaLong, cid.base.mcc, cid.base.mnc, cid.operatorNames.alphaLong,
cid.operatorNames.alphaShort); cid.operatorNames.alphaShort, Collections.emptyList(), null);
}
/** @hide */
public CellIdentityLte(android.hardware.radio.V1_5.CellIdentityLte cid) {
this(cid.base.base.ci, cid.base.base.pci, cid.base.base.tac, cid.base.base.earfcn,
cid.base.bandwidth, cid.base.base.mcc, cid.base.base.mnc,
cid.base.operatorNames.alphaLong, cid.base.operatorNames.alphaShort,
cid.additionalPlmns, cid.optionalCsgInfo.csgInfo() != null
? new ClosedSubscriberGroupInfo(cid.optionalCsgInfo.csgInfo()) : null);
} }
private CellIdentityLte(CellIdentityLte cid) { private CellIdentityLte(CellIdentityLte cid) {
this(cid.mCi, cid.mPci, cid.mTac, cid.mEarfcn, cid.mBandwidth, cid.mMccStr, this(cid.mCi, cid.mPci, cid.mTac, cid.mEarfcn, cid.mBandwidth, cid.mMccStr,
cid.mMncStr, cid.mAlphaLong, cid.mAlphaShort); cid.mMncStr, cid.mAlphaLong, cid.mAlphaShort, cid.mAdditionalPlmns, cid.mCsgInfo);
} }
/** @hide */ /** @hide */
@@ -125,7 +149,7 @@ public final class CellIdentityLte extends CellIdentity {
public @NonNull CellIdentityLte sanitizeLocationInfo() { public @NonNull CellIdentityLte sanitizeLocationInfo() {
return new CellIdentityLte(CellInfo.UNAVAILABLE, CellInfo.UNAVAILABLE, CellInfo.UNAVAILABLE, return new CellIdentityLte(CellInfo.UNAVAILABLE, CellInfo.UNAVAILABLE, CellInfo.UNAVAILABLE,
CellInfo.UNAVAILABLE, CellInfo.UNAVAILABLE, CellInfo.UNAVAILABLE, CellInfo.UNAVAILABLE,
mMccStr, mMncStr, mAlphaLong, mAlphaShort); mMccStr, mMncStr, mAlphaLong, mAlphaShort, mAdditionalPlmns, null);
} }
CellIdentityLte copy() { CellIdentityLte copy() {
@@ -222,6 +246,22 @@ public final class CellIdentityLte extends CellIdentity {
return mEarfcn; return mEarfcn;
} }
/**
* @return a list of additional PLMN IDs supported by this cell.
*/
@NonNull
public List<String> getAdditionalPlmns() {
return mAdditionalPlmns;
}
/**
* @return closed subscriber group information about the cell if available, otherwise null.
*/
@Nullable
public ClosedSubscriberGroupInfo getClosedSubscriberGroupInfo() {
return mCsgInfo;
}
/** /**
* A hack to allow tunneling of LTE information via GsmCellLocation * A hack to allow tunneling of LTE information via GsmCellLocation
* so that older Network Location Providers can return some information * so that older Network Location Providers can return some information
@@ -247,7 +287,8 @@ public final class CellIdentityLte extends CellIdentity {
@Override @Override
public int hashCode() { public int hashCode() {
return Objects.hash(mCi, mPci, mTac, super.hashCode()); return Objects.hash(mCi, mPci, mTac,
mAdditionalPlmns.hashCode(), mCsgInfo, super.hashCode());
} }
@Override @Override
@@ -268,6 +309,8 @@ 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)
&& mAdditionalPlmns.equals(o.mAdditionalPlmns)
&& Objects.equals(mCsgInfo, o.mCsgInfo)
&& super.equals(other); && super.equals(other);
} }
@@ -283,6 +326,8 @@ public final class CellIdentityLte extends CellIdentity {
.append(" mMnc=").append(mMncStr) .append(" mMnc=").append(mMncStr)
.append(" mAlphaLong=").append(mAlphaLong) .append(" mAlphaLong=").append(mAlphaLong)
.append(" mAlphaShort=").append(mAlphaShort) .append(" mAlphaShort=").append(mAlphaShort)
.append(" mAdditionalPlmns=").append(mAdditionalPlmns)
.append(" mCsgInfo=").append(mCsgInfo)
.append("}").toString(); .append("}").toString();
} }
@@ -296,6 +341,8 @@ 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.writeList(mAdditionalPlmns);
dest.writeParcelable(mCsgInfo, flags);
} }
/** Construct from Parcel, type has already been processed */ /** Construct from Parcel, type has already been processed */
@@ -306,7 +353,8 @@ public final class CellIdentityLte extends CellIdentity {
mTac = in.readInt(); mTac = in.readInt();
mEarfcn = in.readInt(); mEarfcn = in.readInt();
mBandwidth = in.readInt(); mBandwidth = in.readInt();
mAdditionalPlmns = in.readArrayList(null);
mCsgInfo = in.readParcelable(null);
if (DBG) log(toString()); if (DBG) log(toString());
} }

View File

@@ -20,8 +20,11 @@ import android.annotation.IntRange;
import android.annotation.NonNull; import android.annotation.NonNull;
import android.annotation.Nullable; import android.annotation.Nullable;
import android.os.Parcel; import android.os.Parcel;
import android.telephony.AccessNetworkConstants.NgranBands.NgranBand;
import android.telephony.gsm.GsmCellLocation; import android.telephony.gsm.GsmCellLocation;
import java.util.Collections;
import java.util.List;
import java.util.Objects; import java.util.Objects;
/** /**
@@ -39,40 +42,58 @@ public final class CellIdentityNr extends CellIdentity {
private final int mPci; private final int mPci;
private final int mTac; private final int mTac;
private final long mNci; private final long mNci;
private final int mBand;
// a list of additional PLMN-IDs reported for this cell
private final List<String> mAdditionalPlmns;
/** /**
* *
* @param pci Physical Cell Id in range [0, 1007]. * @param pci Physical Cell Id in range [0, 1007].
* @param tac 16-bit Tracking Area Code. * @param tac 16-bit Tracking Area Code.
* @param nrArfcn NR Absolute Radio Frequency Channel Number, in range [0, 3279165]. * @param nrArfcn NR Absolute Radio Frequency Channel Number, in range [0, 3279165].
* @param band Band number defined in 3GPP TS 38.101-1 and TS 38.101-2.
* @param mccStr 3-digit Mobile Country Code in string format. * @param mccStr 3-digit Mobile Country Code in string format.
* @param mncStr 2 or 3-digit Mobile Network Code in string format. * @param mncStr 2 or 3-digit Mobile Network Code in string format.
* @param nci The 36-bit NR Cell Identity in range [0, 68719476735]. * @param nci The 36-bit NR Cell Identity in range [0, 68719476735].
* @param alphal long alpha Operator Name String or Enhanced Operator Name String. * @param alphal long alpha Operator Name String or Enhanced Operator Name String.
* @param alphas short alpha Operator Name String or Enhanced Operator Name String. * @param alphas short alpha Operator Name String or Enhanced Operator Name String.
* @param additionalPlmns a list of additional PLMN IDs broadcast by the cell
* *
* @hide * @hide
*/ */
public CellIdentityNr(int pci, int tac, int nrArfcn, String mccStr, String mncStr, public CellIdentityNr(int pci, int tac, int nrArfcn, @NgranBand int band, String mccStr,
long nci, String alphal, String alphas) { String mncStr, long nci, String alphal, String alphas, List<String> additionalPlmns) {
super(TAG, CellInfo.TYPE_NR, mccStr, mncStr, alphal, alphas); super(TAG, CellInfo.TYPE_NR, mccStr, mncStr, alphal, alphas);
mPci = inRangeOrUnavailable(pci, 0, MAX_PCI); mPci = inRangeOrUnavailable(pci, 0, MAX_PCI);
mTac = inRangeOrUnavailable(tac, 0, MAX_TAC); mTac = inRangeOrUnavailable(tac, 0, MAX_TAC);
mNrArfcn = inRangeOrUnavailable(nrArfcn, 0, MAX_NRARFCN); mNrArfcn = inRangeOrUnavailable(nrArfcn, 0, MAX_NRARFCN);
mBand = inRangeOrUnavailable(band, AccessNetworkConstants.NgranBands.BAND_1,
AccessNetworkConstants.NgranBands.BAND_261);
mNci = inRangeOrUnavailable(nci, 0, MAX_NCI); mNci = inRangeOrUnavailable(nci, 0, MAX_NCI);
mAdditionalPlmns = additionalPlmns;
} }
/** @hide */ /** @hide */
public CellIdentityNr(android.hardware.radio.V1_4.CellIdentityNr cid) { public CellIdentityNr(android.hardware.radio.V1_4.CellIdentityNr cid) {
this(cid.pci, cid.tac, cid.nrarfcn, cid.mcc, cid.mnc, cid.nci, cid.operatorNames.alphaLong, this(cid.pci, cid.tac, cid.nrarfcn, 0, cid.mcc, cid.mnc, cid.nci,
cid.operatorNames.alphaShort); cid.operatorNames.alphaLong, cid.operatorNames.alphaShort,
Collections.emptyList());
}
/** @hide */
public CellIdentityNr(android.hardware.radio.V1_5.CellIdentityNr cid) {
this(cid.base.pci, cid.base.tac, cid.base.nrarfcn, cid.band, cid.base.mcc, cid.base.mnc,
cid.base.nci, cid.base.operatorNames.alphaLong,
cid.base.operatorNames.alphaShort, cid.additionalPlmns);
} }
/** @hide */ /** @hide */
@Override @Override
public @NonNull CellIdentityNr sanitizeLocationInfo() { public @NonNull CellIdentityNr sanitizeLocationInfo() {
return new CellIdentityNr(CellInfo.UNAVAILABLE, CellInfo.UNAVAILABLE, CellInfo.UNAVAILABLE, return new CellIdentityNr(CellInfo.UNAVAILABLE, CellInfo.UNAVAILABLE, mNrArfcn,
mMccStr, mMncStr, CellInfo.UNAVAILABLE, mAlphaLong, mAlphaShort); mBand, mMccStr, mMncStr, CellInfo.UNAVAILABLE, mAlphaLong, mAlphaShort,
mAdditionalPlmns);
} }
/** /**
@@ -87,7 +108,8 @@ public final class CellIdentityNr extends CellIdentity {
@Override @Override
public int hashCode() { public int hashCode() {
return Objects.hash(super.hashCode(), mPci, mTac, mNrArfcn, mNci); return Objects.hash(super.hashCode(), mPci, mTac,
mNrArfcn, mBand, mNci, mAdditionalPlmns.hashCode());
} }
@Override @Override
@@ -98,7 +120,8 @@ public final class CellIdentityNr extends CellIdentity {
CellIdentityNr o = (CellIdentityNr) other; CellIdentityNr o = (CellIdentityNr) other;
return super.equals(o) && mPci == o.mPci && mTac == o.mTac && mNrArfcn == o.mNrArfcn return super.equals(o) && mPci == o.mPci && mTac == o.mTac && mNrArfcn == o.mNrArfcn
&& mNci == o.mNci; && mBand == o.mBand && mNci == o.mNci
&& mAdditionalPlmns.equals(o.mAdditionalPlmns);
} }
/** /**
@@ -124,6 +147,19 @@ public final class CellIdentityNr extends CellIdentity {
return mNrArfcn; return mNrArfcn;
} }
/**
* Get band of the cell
*
* Reference: TS 38.101-1 table 5.2-1
* Reference: TS 38.101-2 table 5.2-1
*
* @return band number or {@link CellInfo@UNAVAILABLE} if not available.
*/
@NgranBand
public int getBand() {
return mBand;
}
/** /**
* Get the physical cell id. * Get the physical cell id.
* @return Integer value in range [0, 1007] or {@link CellInfo#UNAVAILABLE} if unknown. * @return Integer value in range [0, 1007] or {@link CellInfo#UNAVAILABLE} if unknown.
@@ -158,17 +194,33 @@ public final class CellIdentityNr extends CellIdentity {
return mMncStr; return mMncStr;
} }
/** @hide */
@Override
public int getChannelNumber() {
return mNrArfcn;
}
/**
* @return a list of additional PLMN IDs supported by this cell.
*/
@NonNull
public List<String> getAdditionalPlmns() {
return mAdditionalPlmns;
}
@Override @Override
public String toString() { public String toString() {
return new StringBuilder(TAG + ":{") return new StringBuilder(TAG + ":{")
.append(" mPci = ").append(mPci) .append(" mPci = ").append(mPci)
.append(" mTac = ").append(mTac) .append(" mTac = ").append(mTac)
.append(" mNrArfcn = ").append(mNrArfcn) .append(" mNrArfcn = ").append(mNrArfcn)
.append(" mBand = ").append(mBand)
.append(" mMcc = ").append(mMccStr) .append(" mMcc = ").append(mMccStr)
.append(" mMnc = ").append(mMncStr) .append(" mMnc = ").append(mMncStr)
.append(" mNci = ").append(mNci) .append(" mNci = ").append(mNci)
.append(" mAlphaLong = ").append(mAlphaLong) .append(" mAlphaLong = ").append(mAlphaLong)
.append(" mAlphaShort = ").append(mAlphaShort) .append(" mAlphaShort = ").append(mAlphaShort)
.append(" mAdditionalPlmns = ").append(mAdditionalPlmns)
.append(" }") .append(" }")
.toString(); .toString();
} }
@@ -179,7 +231,9 @@ public final class CellIdentityNr extends CellIdentity {
dest.writeInt(mPci); dest.writeInt(mPci);
dest.writeInt(mTac); dest.writeInt(mTac);
dest.writeInt(mNrArfcn); dest.writeInt(mNrArfcn);
dest.writeInt(mBand);
dest.writeLong(mNci); dest.writeLong(mNci);
dest.writeList(mAdditionalPlmns);
} }
/** Construct from Parcel, type has already been processed */ /** Construct from Parcel, type has already been processed */
@@ -188,7 +242,9 @@ public final class CellIdentityNr extends CellIdentity {
mPci = in.readInt(); mPci = in.readInt();
mTac = in.readInt(); mTac = in.readInt();
mNrArfcn = in.readInt(); mNrArfcn = in.readInt();
mBand = in.readInt();
mNci = in.readLong(); mNci = in.readLong();
mAdditionalPlmns = in.readArrayList(null);
} }
/** Implement the Parcelable interface */ /** Implement the Parcelable interface */

View File

@@ -21,6 +21,8 @@ import android.annotation.Nullable;
import android.os.Parcel; import android.os.Parcel;
import android.telephony.gsm.GsmCellLocation; import android.telephony.gsm.GsmCellLocation;
import java.util.Collections;
import java.util.List;
import java.util.Objects; import java.util.Objects;
/** /**
@@ -46,6 +48,11 @@ public final class CellIdentityTdscdma extends CellIdentity {
// 16-bit UMTS Absolute RF Channel Number described in TS 25.101 sec. 5.4.3 // 16-bit UMTS Absolute RF Channel Number described in TS 25.101 sec. 5.4.3
private final int mUarfcn; private final int mUarfcn;
// a list of additional PLMN-IDs reported for this cell
private final List<String> mAdditionalPlmns;
private ClosedSubscriberGroupInfo mCsgInfo;
/** /**
* @hide * @hide
*/ */
@@ -55,6 +62,8 @@ public final class CellIdentityTdscdma extends CellIdentity {
mCid = CellInfo.UNAVAILABLE; mCid = CellInfo.UNAVAILABLE;
mCpid = CellInfo.UNAVAILABLE; mCpid = CellInfo.UNAVAILABLE;
mUarfcn = CellInfo.UNAVAILABLE; mUarfcn = CellInfo.UNAVAILABLE;
mAdditionalPlmns = Collections.emptyList();
mCsgInfo = null;
} }
/** /**
@@ -68,39 +77,57 @@ public final class CellIdentityTdscdma extends CellIdentity {
* @param uarfcn 16-bit UMTS Absolute RF Channel Number described in TS 25.101 sec. 5.4.3 * @param uarfcn 16-bit UMTS Absolute RF Channel Number described in TS 25.101 sec. 5.4.3
* @param alphal long alpha Operator Name String or Enhanced Operator Name String * @param alphal long alpha Operator Name String or Enhanced Operator Name String
* @param alphas short alpha Operator Name String or Enhanced Operator Name String * @param alphas short alpha Operator Name String or Enhanced Operator Name String
* @param additionalPlmns a list of additional PLMN IDs broadcast by the cell
* @param csgInfo info about the closed subscriber group broadcast by the cell
* *
* @hide * @hide
*/ */
public CellIdentityTdscdma(String mcc, String mnc, int lac, int cid, int cpid, int uarfcn, public CellIdentityTdscdma(String mcc, String mnc, int lac, int cid, int cpid, int uarfcn,
String alphal, String alphas) { String alphal, String alphas, @NonNull List<String> additionalPlmns,
ClosedSubscriberGroupInfo csgInfo) {
super(TAG, CellInfo.TYPE_TDSCDMA, mcc, mnc, alphal, alphas); super(TAG, CellInfo.TYPE_TDSCDMA, mcc, mnc, alphal, alphas);
mLac = inRangeOrUnavailable(lac, 0, MAX_LAC); mLac = inRangeOrUnavailable(lac, 0, MAX_LAC);
mCid = inRangeOrUnavailable(cid, 0, MAX_CID); mCid = inRangeOrUnavailable(cid, 0, MAX_CID);
mCpid = inRangeOrUnavailable(cpid, 0, MAX_CPID); mCpid = inRangeOrUnavailable(cpid, 0, MAX_CPID);
mUarfcn = inRangeOrUnavailable(uarfcn, 0, MAX_UARFCN); mUarfcn = inRangeOrUnavailable(uarfcn, 0, MAX_UARFCN);
mAdditionalPlmns = additionalPlmns;
mCsgInfo = csgInfo;
} }
private CellIdentityTdscdma(CellIdentityTdscdma cid) { private CellIdentityTdscdma(CellIdentityTdscdma cid) {
this(cid.mMccStr, cid.mMncStr, cid.mLac, cid.mCid, this(cid.mMccStr, cid.mMncStr, cid.mLac, cid.mCid,
cid.mCpid, cid.mUarfcn, cid.mAlphaLong, cid.mAlphaShort); cid.mCpid, cid.mUarfcn, cid.mAlphaLong,
cid.mAlphaShort, cid.mAdditionalPlmns, cid.mCsgInfo);
} }
/** @hide */ /** @hide */
public CellIdentityTdscdma(android.hardware.radio.V1_0.CellIdentityTdscdma cid) { public CellIdentityTdscdma(android.hardware.radio.V1_0.CellIdentityTdscdma cid) {
this(cid.mcc, cid.mnc, cid.lac, cid.cid, cid.cpid, CellInfo.UNAVAILABLE, "", ""); this(cid.mcc, cid.mnc, cid.lac, cid.cid, cid.cpid, CellInfo.UNAVAILABLE, "", "",
Collections.emptyList(), null);
} }
/** @hide */ /** @hide */
public CellIdentityTdscdma(android.hardware.radio.V1_2.CellIdentityTdscdma cid) { public CellIdentityTdscdma(android.hardware.radio.V1_2.CellIdentityTdscdma cid) {
this(cid.base.mcc, cid.base.mnc, cid.base.lac, cid.base.cid, cid.base.cpid, this(cid.base.mcc, cid.base.mnc, cid.base.lac, cid.base.cid, cid.base.cpid,
cid.uarfcn, cid.operatorNames.alphaLong, cid.operatorNames.alphaShort); cid.uarfcn, cid.operatorNames.alphaLong, cid.operatorNames.alphaShort,
Collections.emptyList(), null);
}
/** @hide */
public CellIdentityTdscdma(android.hardware.radio.V1_5.CellIdentityTdscdma cid) {
this(cid.base.base.mcc, cid.base.base.mnc, cid.base.base.lac, cid.base.base.cid,
cid.base.base.cpid, cid.base.uarfcn, cid.base.operatorNames.alphaLong,
cid.base.operatorNames.alphaShort,
cid.additionalPlmns, cid.optionalCsgInfo.csgInfo() != null
? new ClosedSubscriberGroupInfo(cid.optionalCsgInfo.csgInfo()) : null);
} }
/** @hide */ /** @hide */
@Override @Override
public @NonNull CellIdentityTdscdma sanitizeLocationInfo() { public @NonNull CellIdentityTdscdma sanitizeLocationInfo() {
return new CellIdentityTdscdma(mMccStr, mMncStr, CellInfo.UNAVAILABLE, CellInfo.UNAVAILABLE, return new CellIdentityTdscdma(mMccStr, mMncStr, CellInfo.UNAVAILABLE, CellInfo.UNAVAILABLE,
CellInfo.UNAVAILABLE, CellInfo.UNAVAILABLE, mAlphaLong, mAlphaShort); CellInfo.UNAVAILABLE, CellInfo.UNAVAILABLE, mAlphaLong, mAlphaShort,
mAdditionalPlmns, null);
} }
CellIdentityTdscdma copy() { CellIdentityTdscdma copy() {
@@ -171,6 +198,22 @@ public final class CellIdentityTdscdma extends CellIdentity {
return mUarfcn; return mUarfcn;
} }
/**
* @return a list of additional PLMN IDs supported by this cell.
*/
@NonNull
public List<String> getAdditionalPlmns() {
return mAdditionalPlmns;
}
/**
* @return closed subscriber group information about the cell if available, otherwise null.
*/
@Nullable
public ClosedSubscriberGroupInfo getClosedSubscriberGroupInfo() {
return mCsgInfo;
}
/** @hide */ /** @hide */
@NonNull @NonNull
@Override @Override
@@ -198,12 +241,15 @@ public final class CellIdentityTdscdma extends CellIdentity {
&& mCid == o.mCid && mCid == o.mCid
&& mCpid == o.mCpid && mCpid == o.mCpid
&& mUarfcn == o.mUarfcn && mUarfcn == o.mUarfcn
&& mAdditionalPlmns.equals(o.mAdditionalPlmns)
&& Objects.equals(mCsgInfo, o.mCsgInfo)
&& super.equals(other); && super.equals(other);
} }
@Override @Override
public int hashCode() { public int hashCode() {
return Objects.hash(mLac, mCid, mCpid, mUarfcn, super.hashCode()); return Objects.hash(mLac, mCid, mCpid, mUarfcn,
mAdditionalPlmns.hashCode(), mCsgInfo, super.hashCode());
} }
@Override @Override
@@ -217,6 +263,8 @@ public final class CellIdentityTdscdma extends CellIdentity {
.append(" mCid=").append(mCid) .append(" mCid=").append(mCid)
.append(" mCpid=").append(mCpid) .append(" mCpid=").append(mCpid)
.append(" mUarfcn=").append(mUarfcn) .append(" mUarfcn=").append(mUarfcn)
.append(" mAdditionalPlmns=").append(mAdditionalPlmns)
.append(" mCsgInfo=").append(mCsgInfo)
.append("}").toString(); .append("}").toString();
} }
@@ -235,6 +283,8 @@ public final class CellIdentityTdscdma extends CellIdentity {
dest.writeInt(mCid); dest.writeInt(mCid);
dest.writeInt(mCpid); dest.writeInt(mCpid);
dest.writeInt(mUarfcn); dest.writeInt(mUarfcn);
dest.writeList(mAdditionalPlmns);
dest.writeParcelable(mCsgInfo, flags);
} }
/** Construct from Parcel, type has already been processed */ /** Construct from Parcel, type has already been processed */
@@ -244,6 +294,8 @@ public final class CellIdentityTdscdma extends CellIdentity {
mCid = in.readInt(); mCid = in.readInt();
mCpid = in.readInt(); mCpid = in.readInt();
mUarfcn = in.readInt(); mUarfcn = in.readInt();
mAdditionalPlmns = in.readArrayList(null);
mCsgInfo = in.readParcelable(null);
if (DBG) log(toString()); if (DBG) log(toString());
} }

View File

@@ -23,6 +23,8 @@ import android.os.Parcel;
import android.telephony.gsm.GsmCellLocation; import android.telephony.gsm.GsmCellLocation;
import android.text.TextUtils; import android.text.TextUtils;
import java.util.Collections;
import java.util.List;
import java.util.Objects; import java.util.Objects;
/** /**
@@ -47,6 +49,12 @@ public final class CellIdentityWcdma extends CellIdentity {
@UnsupportedAppUsage @UnsupportedAppUsage
private final int mUarfcn; private final int mUarfcn;
// a list of additional PLMN-IDs reported for this cell
private final List<String> mAdditionalPlmns;
@Nullable
private final ClosedSubscriberGroupInfo mCsgInfo;
/** /**
* @hide * @hide
*/ */
@@ -56,6 +64,8 @@ public final class CellIdentityWcdma extends CellIdentity {
mCid = CellInfo.UNAVAILABLE; mCid = CellInfo.UNAVAILABLE;
mPsc = CellInfo.UNAVAILABLE; mPsc = CellInfo.UNAVAILABLE;
mUarfcn = CellInfo.UNAVAILABLE; mUarfcn = CellInfo.UNAVAILABLE;
mAdditionalPlmns = Collections.emptyList();
mCsgInfo = null;
} }
/** /**
@@ -68,33 +78,49 @@ public final class CellIdentityWcdma extends CellIdentity {
* @param mncStr 2 or 3-digit Mobile Network Code in string format * @param mncStr 2 or 3-digit Mobile Network Code in string format
* @param alphal long alpha Operator Name String or Enhanced Operator Name String * @param alphal long alpha Operator Name String or Enhanced Operator Name String
* @param alphas short alpha Operator Name String or Enhanced Operator Name String * @param alphas short alpha Operator Name String or Enhanced Operator Name String
* @param additionalPlmns a list of additional PLMN IDs broadcast by the cell
* @param csgInfo info about the closed subscriber group broadcast by the cell
* *
* @hide * @hide
*/ */
public CellIdentityWcdma (int lac, int cid, int psc, int uarfcn, public CellIdentityWcdma (int lac, int cid, int psc, int uarfcn,
String mccStr, String mncStr, String alphal, String alphas) { String mccStr, String mncStr, String alphal, String alphas,
@NonNull List<String> additionalPlmns,
@Nullable ClosedSubscriberGroupInfo csgInfo) {
super(TAG, CellInfo.TYPE_WCDMA, mccStr, mncStr, alphal, alphas); super(TAG, CellInfo.TYPE_WCDMA, mccStr, mncStr, alphal, alphas);
mLac = inRangeOrUnavailable(lac, 0, MAX_LAC); mLac = inRangeOrUnavailable(lac, 0, MAX_LAC);
mCid = inRangeOrUnavailable(cid, 0, MAX_CID); mCid = inRangeOrUnavailable(cid, 0, MAX_CID);
mPsc = inRangeOrUnavailable(psc, 0, MAX_PSC); mPsc = inRangeOrUnavailable(psc, 0, MAX_PSC);
mUarfcn = inRangeOrUnavailable(uarfcn, 0, MAX_UARFCN); mUarfcn = inRangeOrUnavailable(uarfcn, 0, MAX_UARFCN);
mAdditionalPlmns = additionalPlmns;
mCsgInfo = csgInfo;
} }
/** @hide */ /** @hide */
public CellIdentityWcdma(android.hardware.radio.V1_0.CellIdentityWcdma cid) { public CellIdentityWcdma(android.hardware.radio.V1_0.CellIdentityWcdma cid) {
this(cid.lac, cid.cid, cid.psc, cid.uarfcn, cid.mcc, cid.mnc, "", ""); this(cid.lac, cid.cid, cid.psc, cid.uarfcn, cid.mcc, cid.mnc, "", "",
Collections.emptyList(), null);
} }
/** @hide */ /** @hide */
public CellIdentityWcdma(android.hardware.radio.V1_2.CellIdentityWcdma cid) { public CellIdentityWcdma(android.hardware.radio.V1_2.CellIdentityWcdma cid) {
this(cid.base.lac, cid.base.cid, cid.base.psc, cid.base.uarfcn, this(cid.base.lac, cid.base.cid, cid.base.psc, cid.base.uarfcn,
cid.base.mcc, cid.base.mnc, cid.operatorNames.alphaLong, cid.base.mcc, cid.base.mnc, cid.operatorNames.alphaLong,
cid.operatorNames.alphaShort); cid.operatorNames.alphaShort, Collections.emptyList(), null);
}
/** @hide */
public CellIdentityWcdma(android.hardware.radio.V1_5.CellIdentityWcdma cid) {
this(cid.base.base.lac, cid.base.base.cid, cid.base.base.psc, cid.base.base.uarfcn,
cid.base.base.mcc, cid.base.base.mnc, cid.base.operatorNames.alphaLong,
cid.base.operatorNames.alphaShort, cid.additionalPlmns,
cid.optionalCsgInfo.csgInfo() != null
? new ClosedSubscriberGroupInfo(cid.optionalCsgInfo.csgInfo()) : null);
} }
private CellIdentityWcdma(CellIdentityWcdma cid) { private CellIdentityWcdma(CellIdentityWcdma cid) {
this(cid.mLac, cid.mCid, cid.mPsc, cid.mUarfcn, cid.mMccStr, this(cid.mLac, cid.mCid, cid.mPsc, cid.mUarfcn, cid.mMccStr,
cid.mMncStr, cid.mAlphaLong, cid.mAlphaShort); cid.mMncStr, cid.mAlphaLong, cid.mAlphaShort, cid.mAdditionalPlmns, cid.mCsgInfo);
} }
/** @hide */ /** @hide */
@@ -102,7 +128,7 @@ public final class CellIdentityWcdma extends CellIdentity {
public @NonNull CellIdentityWcdma sanitizeLocationInfo() { public @NonNull CellIdentityWcdma sanitizeLocationInfo() {
return new CellIdentityWcdma(CellInfo.UNAVAILABLE, CellInfo.UNAVAILABLE, return new CellIdentityWcdma(CellInfo.UNAVAILABLE, CellInfo.UNAVAILABLE,
CellInfo.UNAVAILABLE, CellInfo.UNAVAILABLE, mMccStr, mMncStr, CellInfo.UNAVAILABLE, CellInfo.UNAVAILABLE, mMccStr, mMncStr,
mAlphaLong, mAlphaShort); mAlphaLong, mAlphaShort, mAdditionalPlmns, null);
} }
CellIdentityWcdma copy() { CellIdentityWcdma copy() {
@@ -180,7 +206,7 @@ public final class CellIdentityWcdma extends CellIdentity {
@Override @Override
public int hashCode() { public int hashCode() {
return Objects.hash(mLac, mCid, mPsc, super.hashCode()); return Objects.hash(mLac, mCid, mPsc, mAdditionalPlmns.hashCode(), super.hashCode());
} }
/** /**
@@ -197,6 +223,22 @@ public final class CellIdentityWcdma extends CellIdentity {
return mUarfcn; return mUarfcn;
} }
/**
* @return a list of additional PLMN IDs supported by this cell.
*/
@NonNull
public List<String> getAdditionalPlmns() {
return mAdditionalPlmns;
}
/**
* @return closed subscriber group information about the cell if available, otherwise null.
*/
@Nullable
public ClosedSubscriberGroupInfo getClosedSubscriberGroupInfo() {
return mCsgInfo;
}
/** @hide */ /** @hide */
@NonNull @NonNull
@Override @Override
@@ -228,6 +270,8 @@ public final class CellIdentityWcdma extends CellIdentity {
&& mUarfcn == o.mUarfcn && mUarfcn == o.mUarfcn
&& TextUtils.equals(mMccStr, o.mMccStr) && TextUtils.equals(mMccStr, o.mMccStr)
&& TextUtils.equals(mMncStr, o.mMncStr) && TextUtils.equals(mMncStr, o.mMncStr)
&& mAdditionalPlmns.equals(o.mAdditionalPlmns)
&& Objects.equals(mCsgInfo, o.mCsgInfo)
&& super.equals(other); && super.equals(other);
} }
@@ -242,6 +286,8 @@ public final class CellIdentityWcdma extends CellIdentity {
.append(" mMnc=").append(mMncStr) .append(" mMnc=").append(mMncStr)
.append(" mAlphaLong=").append(mAlphaLong) .append(" mAlphaLong=").append(mAlphaLong)
.append(" mAlphaShort=").append(mAlphaShort) .append(" mAlphaShort=").append(mAlphaShort)
.append(" mAdditionalPlmns=").append(mAdditionalPlmns)
.append(" mCsgInfo=").append(mCsgInfo)
.append("}").toString(); .append("}").toString();
} }
@@ -254,6 +300,8 @@ public final class CellIdentityWcdma extends CellIdentity {
dest.writeInt(mCid); dest.writeInt(mCid);
dest.writeInt(mPsc); dest.writeInt(mPsc);
dest.writeInt(mUarfcn); dest.writeInt(mUarfcn);
dest.writeList(mAdditionalPlmns);
dest.writeParcelable(mCsgInfo, flags);
} }
/** Construct from Parcel, type has already been processed */ /** Construct from Parcel, type has already been processed */
@@ -263,6 +311,8 @@ public final class CellIdentityWcdma extends CellIdentity {
mCid = in.readInt(); mCid = in.readInt();
mPsc = in.readInt(); mPsc = in.readInt();
mUarfcn = in.readInt(); mUarfcn = in.readInt();
mAdditionalPlmns = in.readArrayList(null);
mCsgInfo = in.readParcelable(null);
if (DBG) log(toString()); if (DBG) log(toString());
} }

View File

@@ -0,0 +1,20 @@
/*
**
** Copyright 2020, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
** http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/
package android.telephony;
parcelable ClosedSubscriberGroupInfo;

View File

@@ -0,0 +1,156 @@
/*
* Copyright (C) 2020 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package android.telephony;
import android.annotation.IntRange;
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.os.Parcel;
import android.os.Parcelable;
import java.util.Objects;
/**
* Information to represent a closed subscriber group.
*/
public final class ClosedSubscriberGroupInfo implements Parcelable {
private static final String TAG = "ClosedSubscriberGroupInfo";
private final boolean mCsgIndicator;
private final String mHomeNodebName;
private final int mCsgIdentity;
/** @hide */
public ClosedSubscriberGroupInfo(boolean csgIndicator, @Nullable String homeNodebName,
int csgIdentity) {
mCsgIndicator = csgIndicator;
mHomeNodebName = (homeNodebName == null) ? "" : homeNodebName;
mCsgIdentity = csgIdentity;
}
/** @hide */
public ClosedSubscriberGroupInfo(
@NonNull android.hardware.radio.V1_5.ClosedSubscriberGroupInfo csgInfo) {
this(csgInfo.csgIndication, csgInfo.homeNodebName, csgInfo.csgIdentity);
}
/**
* Indicates whether the cell is restricted to only CSG members.
*
* A cell not broadcasting the CSG Indication but reporting CSG information is considered a
* Hybrid Cell.
* Refer to the "csg-Indication" field in 3GPP TS 36.331 section 6.2.2
* SystemInformationBlockType1.
* Also refer to "CSG Indicator" in 3GPP TS 25.331 section 10.2.48.8.1 and TS 25.304.
*
* @return true if the cell is restricted to group members only.
*/
public boolean getCsgIndicator() {
return mCsgIndicator;
}
/**
* Returns human-readable name of the closed subscriber group operating this cell (Node-B).
*
* Refer to "hnb-Name" in TS 36.331 section 6.2.2 SystemInformationBlockType9.
* Also refer to "HNB Name" in 3GPP TS25.331 section 10.2.48.8.23 and TS 23.003 section 4.8.
*
* @return the home Node-B name if available.
*/
public @NonNull String getHomeNodebName() {
return mHomeNodebName;
}
/**
* The identity of the closed subscriber group that the cell belongs to.
*
* Refer to "CSG-Identity" in TS 36.336 section 6.3.4.
* Also refer to "CSG Identity" in 3GPP TS 25.331 section 10.3.2.8 and TS 23.003 section 4.7.
*
* @return the unique 27-bit CSG Identity.
*/
@IntRange(from = 0, to = 0x7FFFFFF)
public int getCsgIdentity() {
return mCsgIdentity;
}
@Override
public int hashCode() {
return Objects.hash(mCsgIndicator, mHomeNodebName, mCsgIdentity);
}
@Override
public boolean equals(Object other) {
if (!(other instanceof ClosedSubscriberGroupInfo)) {
return false;
}
ClosedSubscriberGroupInfo o = (ClosedSubscriberGroupInfo) other;
return mCsgIndicator == o.mCsgIndicator && mHomeNodebName == o.mHomeNodebName
&& mCsgIdentity == o.mCsgIdentity;
}
@Override
public String toString() {
return new StringBuilder(TAG + ":{")
.append(" mCsgIndicator = ").append(mCsgIndicator)
.append(" mHomeNodebName = ").append(mHomeNodebName)
.append(" mCsgIdentity = ").append(mCsgIdentity)
.toString();
}
@Override
public void writeToParcel(@NonNull Parcel dest, int type) {
dest.writeBoolean(mCsgIndicator);
dest.writeString(mHomeNodebName);
dest.writeInt(mCsgIdentity);
}
/** Construct from Parcel, type has already been processed */
private ClosedSubscriberGroupInfo(Parcel in) {
this(in.readBoolean(), in.readString(), in.readInt());
}
/**
* Implement the Parcelable interface
*/
@Override
public int describeContents() {
return 0;
}
/** Implement the Parcelable interface */
public static final @android.annotation.NonNull Creator<ClosedSubscriberGroupInfo> CREATOR =
new Creator<ClosedSubscriberGroupInfo>() {
@Override
public ClosedSubscriberGroupInfo createFromParcel(Parcel in) {
return createFromParcelBody(in);
}
@Override
public ClosedSubscriberGroupInfo[] newArray(int size) {
return new ClosedSubscriberGroupInfo[size];
}
};
/** @hide */
protected static ClosedSubscriberGroupInfo createFromParcelBody(Parcel in) {
return new ClosedSubscriberGroupInfo(in);
}
}