Multi-Plmn and CSG Support For CellInfo

am: 955614761c

Change-Id: I29a783212d40f684426b1c70ab31b30ec3e5844e
This commit is contained in:
Nathan Harold
2020-01-29 08:07:53 -08:00
committed by android-build-merger
8 changed files with 437 additions and 31 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,7 @@ package android.telephony {
}
public final class CellIdentityNr extends android.telephony.CellIdentity {
method @NonNull public java.util.List<java.lang.String> getAdditionalPlmns();
method @Nullable public String getMccString();
method @Nullable public String getMncString();
method public long getNci();
@@ -45003,7 +45007,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 +45021,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 +45193,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

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

@@ -22,6 +22,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;
/**
@@ -40,6 +42,9 @@ public final class CellIdentityNr extends CellIdentity {
private final int mTac;
private final long mNci;
// a list of additional PLMN-IDs reported for this cell
private final List<String> mAdditionalPlmns;
/**
*
* @param pci Physical Cell Id in range [0, 1007].
@@ -50,29 +55,38 @@ public final class CellIdentityNr extends CellIdentity {
* @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) {
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);
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);
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.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);
mMccStr, mMncStr, CellInfo.UNAVAILABLE, mAlphaLong, mAlphaShort, mAdditionalPlmns);
}
/**
@@ -87,7 +101,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, mNci, mAdditionalPlmns.hashCode());
}
@Override
@@ -98,7 +113,7 @@ 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;
&& mNci == o.mNci && mAdditionalPlmns.equals(o.mAdditionalPlmns);
}
/**
@@ -158,6 +173,20 @@ 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 + ":{")
@@ -169,6 +198,7 @@ public final class CellIdentityNr extends CellIdentity {
.append(" mNci = ").append(mNci)
.append(" mAlphaLong = ").append(mAlphaLong)
.append(" mAlphaShort = ").append(mAlphaShort)
.append(" mAdditionalPlmns = ").append(mAdditionalPlmns)
.append(" }")
.toString();
}
@@ -180,6 +210,7 @@ public final class CellIdentityNr extends CellIdentity {
dest.writeInt(mTac);
dest.writeInt(mNrArfcn);
dest.writeLong(mNci);
dest.writeList(mAdditionalPlmns);
}
/** Construct from Parcel, type has already been processed */
@@ -189,6 +220,7 @@ public final class CellIdentityNr extends CellIdentity {
mTac = in.readInt();
mNrArfcn = 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);
}
}