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 {
method @NonNull public java.util.List<java.lang.String> getAdditionalPlmns();
method public int getArfcn();
method public int getBsic();
method public int getCid();
@@ -44977,8 +44978,10 @@ package android.telephony {
}
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 getCi();
method @Nullable public android.telephony.ClosedSubscriberGroupInfo getClosedSubscriberGroupInfo();
method public int getEarfcn();
method @Deprecated public int getMcc();
method @Nullable public String getMccString();
@@ -44992,6 +44995,8 @@ package android.telephony {
}
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 getMncString();
method public long getNci();
@@ -45003,7 +45008,9 @@ package android.telephony {
}
public final class CellIdentityTdscdma extends android.telephony.CellIdentity {
method @NonNull public java.util.List<java.lang.String> getAdditionalPlmns();
method public int getCid();
method @Nullable public android.telephony.ClosedSubscriberGroupInfo getClosedSubscriberGroupInfo();
method public int getCpid();
method public int getLac();
method @Nullable public String getMccString();
@@ -45015,7 +45022,9 @@ package android.telephony {
}
public final class CellIdentityWcdma extends android.telephony.CellIdentity {
method @NonNull public java.util.List<java.lang.String> getAdditionalPlmns();
method public int getCid();
method @Nullable public android.telephony.ClosedSubscriberGroupInfo getClosedSubscriberGroupInfo();
method public int getLac();
method @Deprecated public int getMcc();
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;
}
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 {
method public int describeContents();
method public int getChannel();

View File

@@ -8391,6 +8391,13 @@ package android.telephony {
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 {
ctor public CallAttributes(@NonNull android.telephony.PreciseCallState, int, @NonNull android.telephony.CallQuality);
method public int describeContents();

View File

@@ -3036,6 +3036,13 @@ package android.telephony {
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 {
ctor public CallQuality(int, int, int, int, int, int, int, int, int, int, int);
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_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 */
private NgranBands() {}
}

View File

@@ -23,6 +23,8 @@ import android.os.Parcel;
import android.telephony.gsm.GsmCellLocation;
import android.text.TextUtils;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
/**
@@ -46,6 +48,9 @@ public final class CellIdentityGsm extends CellIdentity {
// 6-bit Base Station Identity Code
private final int mBsic;
// a list of additional PLMN-IDs reported for this cell
private final List<String> mAdditionalPlmns;
/**
* @hide
*/
@@ -56,6 +61,7 @@ public final class CellIdentityGsm extends CellIdentity {
mCid = CellInfo.UNAVAILABLE;
mArfcn = 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 alphal long 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
*/
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);
mLac = inRangeOrUnavailable(lac, 0, MAX_LAC);
mCid = inRangeOrUnavailable(cid, 0, MAX_CID);
mArfcn = inRangeOrUnavailable(arfcn, 0, MAX_ARFCN);
mBsic = inRangeOrUnavailable(bsic, 0, MAX_BSIC);
mAdditionalPlmns = additionalPlmns;
}
/** @hide */
public CellIdentityGsm(android.hardware.radio.V1_0.CellIdentityGsm cid) {
this(cid.lac, cid.cid, cid.arfcn,
cid.bsic == (byte) 0xFF ? CellInfo.UNAVAILABLE : cid.bsic,
cid.mcc, cid.mnc, "", "");
cid.mcc, cid.mnc, "", "", Collections.emptyList());
}
/** @hide */
public CellIdentityGsm(android.hardware.radio.V1_2.CellIdentityGsm cid) {
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.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) {
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() {
@@ -107,7 +126,7 @@ public final class CellIdentityGsm extends CellIdentity {
@Override
public @NonNull CellIdentityGsm sanitizeLocationInfo() {
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 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.
* @return {@link android.telephony.CellInfo#UNAVAILABLE UNAVAILABLE} - undefined for GSM
@@ -215,7 +242,7 @@ public final class CellIdentityGsm extends CellIdentity {
@Override
public int hashCode() {
return Objects.hash(mLac, mCid, super.hashCode());
return Objects.hash(mLac, mCid, mAdditionalPlmns.hashCode(), super.hashCode());
}
@Override
@@ -235,6 +262,7 @@ public final class CellIdentityGsm extends CellIdentity {
&& mBsic == o.mBsic
&& TextUtils.equals(mMccStr, o.mMccStr)
&& TextUtils.equals(mMncStr, o.mMncStr)
&& mAdditionalPlmns.equals(o.mAdditionalPlmns)
&& super.equals(other);
}
@@ -249,6 +277,7 @@ public final class CellIdentityGsm extends CellIdentity {
.append(" mMnc=").append(mMncStr)
.append(" mAlphaLong=").append(mAlphaLong)
.append(" mAlphaShort=").append(mAlphaShort)
.append(" mAdditionalPlmns=").append(mAdditionalPlmns)
.append("}").toString();
}
@@ -261,6 +290,7 @@ public final class CellIdentityGsm extends CellIdentity {
dest.writeInt(mCid);
dest.writeInt(mArfcn);
dest.writeInt(mBsic);
dest.writeList(mAdditionalPlmns);
}
/** Construct from Parcel, type has already been processed */
@@ -270,6 +300,7 @@ public final class CellIdentityGsm extends CellIdentity {
mCid = in.readInt();
mArfcn = in.readInt();
mBsic = in.readInt();
mAdditionalPlmns = in.readArrayList(null);
if (DBG) log(toString());
}

View File

@@ -24,6 +24,8 @@ import android.os.Parcel;
import android.telephony.gsm.GsmCellLocation;
import android.text.TextUtils;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
/**
@@ -50,6 +52,11 @@ public final class CellIdentityLte extends CellIdentity {
// cell bandwidth, in kHz
private final int mBandwidth;
// a list of additional PLMN-IDs reported for this cell
private final List<String> mAdditionalPlmns;
private ClosedSubscriberGroupInfo mCsgInfo;
/**
* @hide
*/
@@ -61,6 +68,8 @@ public final class CellIdentityLte extends CellIdentity {
mTac = CellInfo.UNAVAILABLE;
mEarfcn = 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)
public CellIdentityLte(int mcc, int mnc, int ci, int pci, int tac) {
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 alphal long 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
*/
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);
mCi = inRangeOrUnavailable(ci, 0, MAX_CI);
mPci = inRangeOrUnavailable(pci, 0, MAX_PCI);
mTac = inRangeOrUnavailable(tac, 0, MAX_TAC);
mEarfcn = inRangeOrUnavailable(earfcn, 0, MAX_EARFCN);
mBandwidth = inRangeOrUnavailable(bandwidth, 0, MAX_BANDWIDTH);
mAdditionalPlmns = additionalPlmns;
mCsgInfo = csgInfo;
}
/** @hide */
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 */
public CellIdentityLte(android.hardware.radio.V1_2.CellIdentityLte cid) {
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.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) {
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 */
@@ -125,7 +149,7 @@ public final class CellIdentityLte extends CellIdentity {
public @NonNull CellIdentityLte sanitizeLocationInfo() {
return new CellIdentityLte(CellInfo.UNAVAILABLE, CellInfo.UNAVAILABLE, CellInfo.UNAVAILABLE,
CellInfo.UNAVAILABLE, CellInfo.UNAVAILABLE,
mMccStr, mMncStr, mAlphaLong, mAlphaShort);
mMccStr, mMncStr, mAlphaLong, mAlphaShort, mAdditionalPlmns, null);
}
CellIdentityLte copy() {
@@ -222,6 +246,22 @@ public final class CellIdentityLte extends CellIdentity {
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
* so that older Network Location Providers can return some information
@@ -247,7 +287,8 @@ public final class CellIdentityLte extends CellIdentity {
@Override
public int hashCode() {
return Objects.hash(mCi, mPci, mTac, super.hashCode());
return Objects.hash(mCi, mPci, mTac,
mAdditionalPlmns.hashCode(), mCsgInfo, super.hashCode());
}
@Override
@@ -268,6 +309,8 @@ public final class CellIdentityLte extends CellIdentity {
&& mBandwidth == o.mBandwidth
&& TextUtils.equals(mMccStr, o.mMccStr)
&& TextUtils.equals(mMncStr, o.mMncStr)
&& mAdditionalPlmns.equals(o.mAdditionalPlmns)
&& Objects.equals(mCsgInfo, o.mCsgInfo)
&& super.equals(other);
}
@@ -283,6 +326,8 @@ public final class CellIdentityLte extends CellIdentity {
.append(" mMnc=").append(mMncStr)
.append(" mAlphaLong=").append(mAlphaLong)
.append(" mAlphaShort=").append(mAlphaShort)
.append(" mAdditionalPlmns=").append(mAdditionalPlmns)
.append(" mCsgInfo=").append(mCsgInfo)
.append("}").toString();
}
@@ -296,6 +341,8 @@ public final class CellIdentityLte extends CellIdentity {
dest.writeInt(mTac);
dest.writeInt(mEarfcn);
dest.writeInt(mBandwidth);
dest.writeList(mAdditionalPlmns);
dest.writeParcelable(mCsgInfo, flags);
}
/** Construct from Parcel, type has already been processed */
@@ -306,7 +353,8 @@ public final class CellIdentityLte extends CellIdentity {
mTac = in.readInt();
mEarfcn = in.readInt();
mBandwidth = in.readInt();
mAdditionalPlmns = in.readArrayList(null);
mCsgInfo = in.readParcelable(null);
if (DBG) log(toString());
}

View File

@@ -20,8 +20,11 @@ import android.annotation.IntRange;
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.os.Parcel;
import android.telephony.AccessNetworkConstants.NgranBands.NgranBand;
import android.telephony.gsm.GsmCellLocation;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
/**
@@ -39,40 +42,58 @@ public final class CellIdentityNr extends CellIdentity {
private final int mPci;
private final int mTac;
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 tac 16-bit Tracking Area Code.
* @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 mncStr 2 or 3-digit Mobile Network Code in string format.
* @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 alphas short alpha Operator Name String or Enhanced Operator Name String.
* @param additionalPlmns a list of additional PLMN IDs broadcast by the cell
*
* @hide
*/
public CellIdentityNr(int pci, int tac, int nrArfcn, String mccStr, String mncStr,
long nci, String alphal, String alphas) {
public CellIdentityNr(int pci, int tac, int nrArfcn, @NgranBand int band, String mccStr,
String mncStr, long nci, String alphal, String alphas, List<String> additionalPlmns) {
super(TAG, CellInfo.TYPE_NR, mccStr, mncStr, alphal, alphas);
mPci = inRangeOrUnavailable(pci, 0, MAX_PCI);
mTac = inRangeOrUnavailable(tac, 0, MAX_TAC);
mNrArfcn = inRangeOrUnavailable(nrArfcn, 0, MAX_NRARFCN);
mBand = inRangeOrUnavailable(band, AccessNetworkConstants.NgranBands.BAND_1,
AccessNetworkConstants.NgranBands.BAND_261);
mNci = inRangeOrUnavailable(nci, 0, MAX_NCI);
mAdditionalPlmns = additionalPlmns;
}
/** @hide */
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,
cid.operatorNames.alphaShort);
this(cid.pci, cid.tac, cid.nrarfcn, 0, cid.mcc, cid.mnc, cid.nci,
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 */
@Override
public @NonNull CellIdentityNr sanitizeLocationInfo() {
return new CellIdentityNr(CellInfo.UNAVAILABLE, CellInfo.UNAVAILABLE, CellInfo.UNAVAILABLE,
mMccStr, mMncStr, CellInfo.UNAVAILABLE, mAlphaLong, mAlphaShort);
return new CellIdentityNr(CellInfo.UNAVAILABLE, CellInfo.UNAVAILABLE, mNrArfcn,
mBand, mMccStr, mMncStr, CellInfo.UNAVAILABLE, mAlphaLong, mAlphaShort,
mAdditionalPlmns);
}
/**
@@ -87,7 +108,8 @@ public final class CellIdentityNr extends CellIdentity {
@Override
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
@@ -98,7 +120,8 @@ public final class CellIdentityNr extends CellIdentity {
CellIdentityNr o = (CellIdentityNr) other;
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;
}
/**
* 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.
* @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;
}
/** @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
public String toString() {
return new StringBuilder(TAG + ":{")
.append(" mPci = ").append(mPci)
.append(" mTac = ").append(mTac)
.append(" mNrArfcn = ").append(mNrArfcn)
.append(" mBand = ").append(mBand)
.append(" mMcc = ").append(mMccStr)
.append(" mMnc = ").append(mMncStr)
.append(" mNci = ").append(mNci)
.append(" mAlphaLong = ").append(mAlphaLong)
.append(" mAlphaShort = ").append(mAlphaShort)
.append(" mAdditionalPlmns = ").append(mAdditionalPlmns)
.append(" }")
.toString();
}
@@ -179,7 +231,9 @@ public final class CellIdentityNr extends CellIdentity {
dest.writeInt(mPci);
dest.writeInt(mTac);
dest.writeInt(mNrArfcn);
dest.writeInt(mBand);
dest.writeLong(mNci);
dest.writeList(mAdditionalPlmns);
}
/** Construct from Parcel, type has already been processed */
@@ -188,7 +242,9 @@ public final class CellIdentityNr extends CellIdentity {
mPci = in.readInt();
mTac = in.readInt();
mNrArfcn = in.readInt();
mBand = in.readInt();
mNci = in.readLong();
mAdditionalPlmns = in.readArrayList(null);
}
/** Implement the Parcelable interface */

View File

@@ -21,6 +21,8 @@ import android.annotation.Nullable;
import android.os.Parcel;
import android.telephony.gsm.GsmCellLocation;
import java.util.Collections;
import java.util.List;
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
private final int mUarfcn;
// a list of additional PLMN-IDs reported for this cell
private final List<String> mAdditionalPlmns;
private ClosedSubscriberGroupInfo mCsgInfo;
/**
* @hide
*/
@@ -55,6 +62,8 @@ public final class CellIdentityTdscdma extends CellIdentity {
mCid = CellInfo.UNAVAILABLE;
mCpid = 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 alphal long 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
*/
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);
mLac = inRangeOrUnavailable(lac, 0, MAX_LAC);
mCid = inRangeOrUnavailable(cid, 0, MAX_CID);
mCpid = inRangeOrUnavailable(cpid, 0, MAX_CPID);
mUarfcn = inRangeOrUnavailable(uarfcn, 0, MAX_UARFCN);
mAdditionalPlmns = additionalPlmns;
mCsgInfo = csgInfo;
}
private CellIdentityTdscdma(CellIdentityTdscdma cid) {
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 */
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 */
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,
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 */
@Override
public @NonNull CellIdentityTdscdma sanitizeLocationInfo() {
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() {
@@ -171,6 +198,22 @@ public final class CellIdentityTdscdma extends CellIdentity {
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 */
@NonNull
@Override
@@ -198,12 +241,15 @@ public final class CellIdentityTdscdma extends CellIdentity {
&& mCid == o.mCid
&& mCpid == o.mCpid
&& mUarfcn == o.mUarfcn
&& mAdditionalPlmns.equals(o.mAdditionalPlmns)
&& Objects.equals(mCsgInfo, o.mCsgInfo)
&& super.equals(other);
}
@Override
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
@@ -217,6 +263,8 @@ public final class CellIdentityTdscdma extends CellIdentity {
.append(" mCid=").append(mCid)
.append(" mCpid=").append(mCpid)
.append(" mUarfcn=").append(mUarfcn)
.append(" mAdditionalPlmns=").append(mAdditionalPlmns)
.append(" mCsgInfo=").append(mCsgInfo)
.append("}").toString();
}
@@ -235,6 +283,8 @@ public final class CellIdentityTdscdma extends CellIdentity {
dest.writeInt(mCid);
dest.writeInt(mCpid);
dest.writeInt(mUarfcn);
dest.writeList(mAdditionalPlmns);
dest.writeParcelable(mCsgInfo, flags);
}
/** Construct from Parcel, type has already been processed */
@@ -244,6 +294,8 @@ public final class CellIdentityTdscdma extends CellIdentity {
mCid = in.readInt();
mCpid = in.readInt();
mUarfcn = in.readInt();
mAdditionalPlmns = in.readArrayList(null);
mCsgInfo = in.readParcelable(null);
if (DBG) log(toString());
}

View File

@@ -23,6 +23,8 @@ import android.os.Parcel;
import android.telephony.gsm.GsmCellLocation;
import android.text.TextUtils;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
/**
@@ -47,6 +49,12 @@ public final class CellIdentityWcdma extends CellIdentity {
@UnsupportedAppUsage
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
*/
@@ -56,6 +64,8 @@ public final class CellIdentityWcdma extends CellIdentity {
mCid = CellInfo.UNAVAILABLE;
mPsc = 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 alphal long 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
*/
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);
mLac = inRangeOrUnavailable(lac, 0, MAX_LAC);
mCid = inRangeOrUnavailable(cid, 0, MAX_CID);
mPsc = inRangeOrUnavailable(psc, 0, MAX_PSC);
mUarfcn = inRangeOrUnavailable(uarfcn, 0, MAX_UARFCN);
mAdditionalPlmns = additionalPlmns;
mCsgInfo = csgInfo;
}
/** @hide */
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 */
public CellIdentityWcdma(android.hardware.radio.V1_2.CellIdentityWcdma cid) {
this(cid.base.lac, cid.base.cid, cid.base.psc, cid.base.uarfcn,
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) {
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 */
@@ -102,7 +128,7 @@ public final class CellIdentityWcdma extends CellIdentity {
public @NonNull CellIdentityWcdma sanitizeLocationInfo() {
return new CellIdentityWcdma(CellInfo.UNAVAILABLE, CellInfo.UNAVAILABLE,
CellInfo.UNAVAILABLE, CellInfo.UNAVAILABLE, mMccStr, mMncStr,
mAlphaLong, mAlphaShort);
mAlphaLong, mAlphaShort, mAdditionalPlmns, null);
}
CellIdentityWcdma copy() {
@@ -180,7 +206,7 @@ public final class CellIdentityWcdma extends CellIdentity {
@Override
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 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 */
@NonNull
@Override
@@ -228,6 +270,8 @@ public final class CellIdentityWcdma extends CellIdentity {
&& mUarfcn == o.mUarfcn
&& TextUtils.equals(mMccStr, o.mMccStr)
&& TextUtils.equals(mMncStr, o.mMncStr)
&& mAdditionalPlmns.equals(o.mAdditionalPlmns)
&& Objects.equals(mCsgInfo, o.mCsgInfo)
&& super.equals(other);
}
@@ -242,6 +286,8 @@ public final class CellIdentityWcdma extends CellIdentity {
.append(" mMnc=").append(mMncStr)
.append(" mAlphaLong=").append(mAlphaLong)
.append(" mAlphaShort=").append(mAlphaShort)
.append(" mAdditionalPlmns=").append(mAdditionalPlmns)
.append(" mCsgInfo=").append(mCsgInfo)
.append("}").toString();
}
@@ -254,6 +300,8 @@ public final class CellIdentityWcdma extends CellIdentity {
dest.writeInt(mCid);
dest.writeInt(mPsc);
dest.writeInt(mUarfcn);
dest.writeList(mAdditionalPlmns);
dest.writeParcelable(mCsgInfo, flags);
}
/** Construct from Parcel, type has already been processed */
@@ -263,6 +311,8 @@ public final class CellIdentityWcdma extends CellIdentity {
mCid = in.readInt();
mPsc = in.readInt();
mUarfcn = in.readInt();
mAdditionalPlmns = in.readArrayList(null);
mCsgInfo = in.readParcelable(null);
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);
}
}