diff options
| -rw-r--r-- | api/current.txt | 10 | ||||
| -rw-r--r-- | telephony/java/android/telephony/CellIdentityGsm.java | 25 | ||||
| -rw-r--r-- | telephony/java/android/telephony/CellIdentityLte.java | 26 | ||||
| -rw-r--r-- | telephony/java/android/telephony/CellIdentityNr.java | 19 | ||||
| -rw-r--r-- | telephony/java/android/telephony/CellIdentityTdscdma.java | 22 | ||||
| -rw-r--r-- | telephony/java/android/telephony/CellIdentityWcdma.java | 26 |
6 files changed, 69 insertions, 59 deletions
diff --git a/api/current.txt b/api/current.txt index 5540a3e89ae5..b826c848a386 100644 --- a/api/current.txt +++ b/api/current.txt @@ -46891,7 +46891,7 @@ package android.telephony { } public final class CellIdentityGsm extends android.telephony.CellIdentity { - method @NonNull public java.util.List<java.lang.String> getAdditionalPlmns(); + method @NonNull public java.util.Set<java.lang.String> getAdditionalPlmns(); method public int getArfcn(); method public int getBsic(); method public int getCid(); @@ -46907,7 +46907,7 @@ package android.telephony { } public final class CellIdentityLte extends android.telephony.CellIdentity { - method @NonNull public java.util.List<java.lang.String> getAdditionalPlmns(); + method @NonNull public java.util.Set<java.lang.String> getAdditionalPlmns(); method @NonNull public java.util.List<java.lang.Integer> getBands(); method public int getBandwidth(); method public int getCi(); @@ -46925,7 +46925,7 @@ package android.telephony { } public final class CellIdentityNr extends android.telephony.CellIdentity { - method @NonNull public java.util.List<java.lang.String> getAdditionalPlmns(); + method @NonNull public java.util.Set<java.lang.String> getAdditionalPlmns(); method @NonNull public java.util.List<java.lang.Integer> getBands(); method @Nullable public String getMccString(); method @Nullable public String getMncString(); @@ -46938,7 +46938,7 @@ package android.telephony { } public final class CellIdentityTdscdma extends android.telephony.CellIdentity { - method @NonNull public java.util.List<java.lang.String> getAdditionalPlmns(); + method @NonNull public java.util.Set<java.lang.String> getAdditionalPlmns(); method public int getCid(); method @Nullable public android.telephony.ClosedSubscriberGroupInfo getClosedSubscriberGroupInfo(); method public int getCpid(); @@ -46952,7 +46952,7 @@ package android.telephony { } public final class CellIdentityWcdma extends android.telephony.CellIdentity { - method @NonNull public java.util.List<java.lang.String> getAdditionalPlmns(); + method @NonNull public java.util.Set<java.lang.String> getAdditionalPlmns(); method public int getCid(); method @Nullable public android.telephony.ClosedSubscriberGroupInfo getClosedSubscriberGroupInfo(); method public int getLac(); diff --git a/telephony/java/android/telephony/CellIdentityGsm.java b/telephony/java/android/telephony/CellIdentityGsm.java index 9f2537c7ed10..203047fb111d 100644 --- a/telephony/java/android/telephony/CellIdentityGsm.java +++ b/telephony/java/android/telephony/CellIdentityGsm.java @@ -22,11 +22,12 @@ import android.compat.annotation.UnsupportedAppUsage; import android.os.Parcel; import android.telephony.gsm.GsmCellLocation; import android.text.TextUtils; +import android.util.ArraySet; -import java.util.ArrayList; +import java.util.Collection; import java.util.Collections; -import java.util.List; import java.util.Objects; +import java.util.Set; /** * CellIdentity to represent a unique GSM cell @@ -50,7 +51,7 @@ public final class CellIdentityGsm extends CellIdentity { private final int mBsic; // a list of additional PLMN-IDs reported for this cell - private final List<String> mAdditionalPlmns; + private final ArraySet<String> mAdditionalPlmns; /** * @hide @@ -62,7 +63,7 @@ public final class CellIdentityGsm extends CellIdentity { mCid = CellInfo.UNAVAILABLE; mArfcn = CellInfo.UNAVAILABLE; mBsic = CellInfo.UNAVAILABLE; - mAdditionalPlmns = Collections.emptyList(); + mAdditionalPlmns = new ArraySet<>(); } /** @@ -81,13 +82,13 @@ public final class CellIdentityGsm extends CellIdentity { */ public CellIdentityGsm(int lac, int cid, int arfcn, int bsic, @Nullable String mccStr, @Nullable String mncStr, @Nullable String alphal, @Nullable String alphas, - @NonNull List<String> additionalPlmns) { + @NonNull Collection<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 = new ArrayList<>(additionalPlmns.size()); + mAdditionalPlmns = new ArraySet<>(additionalPlmns.size()); for (String plmn : additionalPlmns) { if (isValidPlmn(plmn)) { mAdditionalPlmns.add(plmn); @@ -99,7 +100,7 @@ public final class CellIdentityGsm extends CellIdentity { public CellIdentityGsm(@NonNull 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, "", "", Collections.emptyList()); + cid.mcc, cid.mnc, "", "", new ArraySet<>()); } /** @hide */ @@ -107,7 +108,7 @@ public final class CellIdentityGsm extends CellIdentity { 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, - Collections.emptyList()); + new ArraySet<>()); } /** @hide */ @@ -221,8 +222,8 @@ public final class CellIdentityGsm extends CellIdentity { * @return a list of additional PLMN IDs supported by this cell. */ @NonNull - public List<String> getAdditionalPlmns() { - return mAdditionalPlmns; + public Set<String> getAdditionalPlmns() { + return Collections.unmodifiableSet(mAdditionalPlmns); } /** @@ -296,7 +297,7 @@ public final class CellIdentityGsm extends CellIdentity { dest.writeInt(mCid); dest.writeInt(mArfcn); dest.writeInt(mBsic); - dest.writeList(mAdditionalPlmns); + dest.writeArraySet(mAdditionalPlmns); } /** Construct from Parcel, type has already been processed */ @@ -306,7 +307,7 @@ public final class CellIdentityGsm extends CellIdentity { mCid = in.readInt(); mArfcn = in.readInt(); mBsic = in.readInt(); - mAdditionalPlmns = in.readArrayList(null); + mAdditionalPlmns = (ArraySet<String>) in.readArraySet(null); if (DBG) log(toString()); } diff --git a/telephony/java/android/telephony/CellIdentityLte.java b/telephony/java/android/telephony/CellIdentityLte.java index a194ae35216c..e4198d1c519c 100644 --- a/telephony/java/android/telephony/CellIdentityLte.java +++ b/telephony/java/android/telephony/CellIdentityLte.java @@ -23,11 +23,13 @@ import android.os.Build; import android.os.Parcel; import android.telephony.gsm.GsmCellLocation; import android.text.TextUtils; +import android.util.ArraySet; -import java.util.ArrayList; +import java.util.Collection; import java.util.Collections; import java.util.List; import java.util.Objects; +import java.util.Set; /** * CellIdentity is to represent a unique LTE cell @@ -54,7 +56,7 @@ public final class CellIdentityLte extends CellIdentity { private final int mBandwidth; // a list of additional PLMN-IDs reported for this cell - private final List<String> mAdditionalPlmns; + private final ArraySet<String> mAdditionalPlmns; private ClosedSubscriberGroupInfo mCsgInfo; @@ -69,7 +71,7 @@ public final class CellIdentityLte extends CellIdentity { mTac = CellInfo.UNAVAILABLE; mEarfcn = CellInfo.UNAVAILABLE; mBandwidth = CellInfo.UNAVAILABLE; - mAdditionalPlmns = Collections.emptyList(); + mAdditionalPlmns = new ArraySet<>(); mCsgInfo = null; } @@ -86,7 +88,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, Collections.emptyList(), null); + String.valueOf(mnc), null, null, new ArraySet<>(), null); } /** @@ -107,7 +109,7 @@ public final class CellIdentityLte extends CellIdentity { */ public CellIdentityLte(int ci, int pci, int tac, int earfcn, int bandwidth, @Nullable String mccStr, @Nullable String mncStr, @Nullable String alphal, - @Nullable String alphas, @NonNull List<String> additionalPlmns, + @Nullable String alphas, @NonNull Collection<String> additionalPlmns, @Nullable ClosedSubscriberGroupInfo csgInfo) { super(TAG, CellInfo.TYPE_LTE, mccStr, mncStr, alphal, alphas); mCi = inRangeOrUnavailable(ci, 0, MAX_CI); @@ -115,7 +117,7 @@ public final class CellIdentityLte extends CellIdentity { mTac = inRangeOrUnavailable(tac, 0, MAX_TAC); mEarfcn = inRangeOrUnavailable(earfcn, 0, MAX_EARFCN); mBandwidth = inRangeOrUnavailable(bandwidth, 0, MAX_BANDWIDTH); - mAdditionalPlmns = new ArrayList<>(additionalPlmns.size()); + mAdditionalPlmns = new ArraySet<>(additionalPlmns.size()); for (String plmn : additionalPlmns) { if (isValidPlmn(plmn)) { mAdditionalPlmns.add(plmn); @@ -127,14 +129,14 @@ public final class CellIdentityLte extends CellIdentity { /** @hide */ public CellIdentityLte(@NonNull android.hardware.radio.V1_0.CellIdentityLte cid) { this(cid.ci, cid.pci, cid.tac, cid.earfcn, - CellInfo.UNAVAILABLE, cid.mcc, cid.mnc, "", "", Collections.emptyList(), null); + CellInfo.UNAVAILABLE, cid.mcc, cid.mnc, "", "", new ArraySet<>(), null); } /** @hide */ public CellIdentityLte(@NonNull 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, Collections.emptyList(), null); + cid.operatorNames.alphaShort, new ArraySet<>(), null); } /** @hide */ @@ -270,8 +272,8 @@ public final class CellIdentityLte extends CellIdentity { * @return a list of additional PLMN IDs supported by this cell. */ @NonNull - public List<String> getAdditionalPlmns() { - return mAdditionalPlmns; + public Set<String> getAdditionalPlmns() { + return Collections.unmodifiableSet(mAdditionalPlmns); } /** @@ -361,7 +363,7 @@ public final class CellIdentityLte extends CellIdentity { dest.writeInt(mTac); dest.writeInt(mEarfcn); dest.writeInt(mBandwidth); - dest.writeList(mAdditionalPlmns); + dest.writeArraySet(mAdditionalPlmns); dest.writeParcelable(mCsgInfo, flags); } @@ -373,7 +375,7 @@ public final class CellIdentityLte extends CellIdentity { mTac = in.readInt(); mEarfcn = in.readInt(); mBandwidth = in.readInt(); - mAdditionalPlmns = in.readArrayList(null); + mAdditionalPlmns = (ArraySet<String>) in.readArraySet(null); mCsgInfo = in.readParcelable(null); if (DBG) log(toString()); } diff --git a/telephony/java/android/telephony/CellIdentityNr.java b/telephony/java/android/telephony/CellIdentityNr.java index a0ef5aa2feae..cba500a00d3a 100644 --- a/telephony/java/android/telephony/CellIdentityNr.java +++ b/telephony/java/android/telephony/CellIdentityNr.java @@ -22,11 +22,14 @@ import android.annotation.Nullable; import android.os.Parcel; import android.telephony.AccessNetworkConstants.NgranBands.NgranBand; import android.telephony.gsm.GsmCellLocation; +import android.util.ArraySet; import java.util.ArrayList; +import java.util.Collection; import java.util.Collections; import java.util.List; import java.util.Objects; +import java.util.Set; /** * Information to represent a unique NR(New Radio 5G) cell. @@ -46,7 +49,7 @@ public final class CellIdentityNr extends CellIdentity { private final List<Integer> mBands; // a list of additional PLMN-IDs reported for this cell - private final List<String> mAdditionalPlmns; + private final ArraySet<String> mAdditionalPlmns; /** * @@ -66,14 +69,14 @@ public final class CellIdentityNr extends CellIdentity { public CellIdentityNr(int pci, int tac, int nrArfcn, @NgranBand List<Integer> bands, @Nullable String mccStr, @Nullable String mncStr, long nci, @Nullable String alphal, @Nullable String alphas, - @NonNull List<String> additionalPlmns) { + @NonNull Collection<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); mBands = new ArrayList<>(bands); mNci = inRangeOrUnavailable(nci, 0, MAX_NCI); - mAdditionalPlmns = new ArrayList<>(additionalPlmns.size()); + mAdditionalPlmns = new ArraySet<>(additionalPlmns.size()); for (String plmn : additionalPlmns) { if (isValidPlmn(plmn)) { mAdditionalPlmns.add(plmn); @@ -85,7 +88,7 @@ public final class CellIdentityNr extends CellIdentity { public CellIdentityNr(@NonNull android.hardware.radio.V1_4.CellIdentityNr cid) { this(cid.pci, cid.tac, cid.nrarfcn, Collections.emptyList(), cid.mcc, cid.mnc, cid.nci, cid.operatorNames.alphaLong, cid.operatorNames.alphaShort, - Collections.emptyList()); + new ArraySet<>()); } /** @hide */ @@ -212,8 +215,8 @@ public final class CellIdentityNr extends CellIdentity { * @return a list of additional PLMN IDs supported by this cell. */ @NonNull - public List<String> getAdditionalPlmns() { - return Collections.unmodifiableList(mAdditionalPlmns); + public Set<String> getAdditionalPlmns() { + return Collections.unmodifiableSet(mAdditionalPlmns); } @Override @@ -241,7 +244,7 @@ public final class CellIdentityNr extends CellIdentity { dest.writeInt(mNrArfcn); dest.writeList(mBands); dest.writeLong(mNci); - dest.writeList(mAdditionalPlmns); + dest.writeArraySet(mAdditionalPlmns); } /** Construct from Parcel, type has already been processed */ @@ -252,7 +255,7 @@ public final class CellIdentityNr extends CellIdentity { mNrArfcn = in.readInt(); mBands = in.readArrayList(null); mNci = in.readLong(); - mAdditionalPlmns = in.readArrayList(null); + mAdditionalPlmns = (ArraySet<String>) in.readArraySet(null); } /** Implement the Parcelable interface */ diff --git a/telephony/java/android/telephony/CellIdentityTdscdma.java b/telephony/java/android/telephony/CellIdentityTdscdma.java index 531487a313d9..30f98bc57458 100644 --- a/telephony/java/android/telephony/CellIdentityTdscdma.java +++ b/telephony/java/android/telephony/CellIdentityTdscdma.java @@ -20,11 +20,12 @@ import android.annotation.NonNull; import android.annotation.Nullable; import android.os.Parcel; import android.telephony.gsm.GsmCellLocation; +import android.util.ArraySet; -import java.util.ArrayList; +import java.util.Collection; import java.util.Collections; -import java.util.List; import java.util.Objects; +import java.util.Set; /** * CellIdentity is to represent a unique TD-SCDMA cell @@ -50,7 +51,7 @@ public final class CellIdentityTdscdma extends CellIdentity { private final int mUarfcn; // a list of additional PLMN-IDs reported for this cell - private final List<String> mAdditionalPlmns; + private final ArraySet<String> mAdditionalPlmns; private ClosedSubscriberGroupInfo mCsgInfo; @@ -63,7 +64,7 @@ public final class CellIdentityTdscdma extends CellIdentity { mCid = CellInfo.UNAVAILABLE; mCpid = CellInfo.UNAVAILABLE; mUarfcn = CellInfo.UNAVAILABLE; - mAdditionalPlmns = Collections.emptyList(); + mAdditionalPlmns = new ArraySet<>(); mCsgInfo = null; } @@ -85,13 +86,14 @@ public final class CellIdentityTdscdma extends CellIdentity { */ public CellIdentityTdscdma(@Nullable String mcc, @Nullable String mnc, int lac, int cid, int cpid, int uarfcn, @Nullable String alphal, @Nullable String alphas, - @NonNull List<String> additionalPlmns, @Nullable ClosedSubscriberGroupInfo csgInfo) { + @NonNull Collection<String> additionalPlmns, + @Nullable 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 = new ArrayList<>(additionalPlmns.size()); + mAdditionalPlmns = new ArraySet<>(additionalPlmns.size()); for (String plmn : additionalPlmns) { if (isValidPlmn(plmn)) { mAdditionalPlmns.add(plmn); @@ -208,8 +210,8 @@ public final class CellIdentityTdscdma extends CellIdentity { * @return a list of additional PLMN IDs supported by this cell. */ @NonNull - public List<String> getAdditionalPlmns() { - return mAdditionalPlmns; + public Set<String> getAdditionalPlmns() { + return Collections.unmodifiableSet(mAdditionalPlmns); } /** @@ -289,7 +291,7 @@ public final class CellIdentityTdscdma extends CellIdentity { dest.writeInt(mCid); dest.writeInt(mCpid); dest.writeInt(mUarfcn); - dest.writeList(mAdditionalPlmns); + dest.writeArraySet(mAdditionalPlmns); dest.writeParcelable(mCsgInfo, flags); } @@ -300,7 +302,7 @@ public final class CellIdentityTdscdma extends CellIdentity { mCid = in.readInt(); mCpid = in.readInt(); mUarfcn = in.readInt(); - mAdditionalPlmns = in.readArrayList(null); + mAdditionalPlmns = (ArraySet<String>) in.readArraySet(null); mCsgInfo = in.readParcelable(null); if (DBG) log(toString()); } diff --git a/telephony/java/android/telephony/CellIdentityWcdma.java b/telephony/java/android/telephony/CellIdentityWcdma.java index 15e491b66575..9d2cb74bac23 100644 --- a/telephony/java/android/telephony/CellIdentityWcdma.java +++ b/telephony/java/android/telephony/CellIdentityWcdma.java @@ -22,11 +22,12 @@ import android.compat.annotation.UnsupportedAppUsage; import android.os.Parcel; import android.telephony.gsm.GsmCellLocation; import android.text.TextUtils; +import android.util.ArraySet; -import java.util.ArrayList; +import java.util.Collection; import java.util.Collections; -import java.util.List; import java.util.Objects; +import java.util.Set; /** * CellIdentity to represent a unique UMTS cell @@ -51,7 +52,7 @@ public final class CellIdentityWcdma extends CellIdentity { private final int mUarfcn; // a list of additional PLMN-IDs reported for this cell - private final List<String> mAdditionalPlmns; + private final ArraySet<String> mAdditionalPlmns; @Nullable private final ClosedSubscriberGroupInfo mCsgInfo; @@ -65,7 +66,7 @@ public final class CellIdentityWcdma extends CellIdentity { mCid = CellInfo.UNAVAILABLE; mPsc = CellInfo.UNAVAILABLE; mUarfcn = CellInfo.UNAVAILABLE; - mAdditionalPlmns = Collections.emptyList(); + mAdditionalPlmns = new ArraySet<>(); mCsgInfo = null; } @@ -86,13 +87,14 @@ public final class CellIdentityWcdma extends CellIdentity { */ public CellIdentityWcdma(int lac, int cid, int psc, int uarfcn, @Nullable String mccStr, @Nullable String mncStr, @Nullable String alphal, @Nullable String alphas, - @NonNull List<String> additionalPlmns, @Nullable ClosedSubscriberGroupInfo csgInfo) { + @NonNull Collection<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 = new ArrayList<>(additionalPlmns.size()); + mAdditionalPlmns = new ArraySet<>(additionalPlmns.size()); for (String plmn : additionalPlmns) { if (isValidPlmn(plmn)) { mAdditionalPlmns.add(plmn); @@ -104,14 +106,14 @@ public final class CellIdentityWcdma extends CellIdentity { /** @hide */ public CellIdentityWcdma(@NonNull android.hardware.radio.V1_0.CellIdentityWcdma cid) { this(cid.lac, cid.cid, cid.psc, cid.uarfcn, cid.mcc, cid.mnc, "", "", - Collections.emptyList(), null); + new ArraySet<>(), null); } /** @hide */ public CellIdentityWcdma(@NonNull 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, Collections.emptyList(), null); + cid.operatorNames.alphaShort, new ArraySet<>(), null); } /** @hide */ @@ -232,8 +234,8 @@ public final class CellIdentityWcdma extends CellIdentity { * @return a list of additional PLMN IDs supported by this cell. */ @NonNull - public List<String> getAdditionalPlmns() { - return mAdditionalPlmns; + public Set<String> getAdditionalPlmns() { + return Collections.unmodifiableSet(mAdditionalPlmns); } /** @@ -305,7 +307,7 @@ public final class CellIdentityWcdma extends CellIdentity { dest.writeInt(mCid); dest.writeInt(mPsc); dest.writeInt(mUarfcn); - dest.writeList(mAdditionalPlmns); + dest.writeArraySet(mAdditionalPlmns); dest.writeParcelable(mCsgInfo, flags); } @@ -316,7 +318,7 @@ public final class CellIdentityWcdma extends CellIdentity { mCid = in.readInt(); mPsc = in.readInt(); mUarfcn = in.readInt(); - mAdditionalPlmns = in.readArrayList(null); + mAdditionalPlmns = (ArraySet<String>) in.readArraySet(null); mCsgInfo = in.readParcelable(null); if (DBG) log(toString()); } |