Merge "Convert getBands() to int[] from List<Integer>" into rvc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
f7ed9bc589
@@ -46897,7 +46897,7 @@ package android.telephony {
|
|||||||
|
|
||||||
public final class CellIdentityLte extends android.telephony.CellIdentity {
|
public final class CellIdentityLte extends android.telephony.CellIdentity {
|
||||||
method @NonNull public java.util.Set<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 @NonNull public int[] getBands();
|
||||||
method public int getBandwidth();
|
method public int getBandwidth();
|
||||||
method public int getCi();
|
method public int getCi();
|
||||||
method @Nullable public android.telephony.ClosedSubscriberGroupInfo getClosedSubscriberGroupInfo();
|
method @Nullable public android.telephony.ClosedSubscriberGroupInfo getClosedSubscriberGroupInfo();
|
||||||
@@ -46915,7 +46915,7 @@ package android.telephony {
|
|||||||
|
|
||||||
public final class CellIdentityNr extends android.telephony.CellIdentity {
|
public final class CellIdentityNr extends android.telephony.CellIdentity {
|
||||||
method @NonNull public java.util.Set<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 @NonNull public int[] getBands();
|
||||||
method @Nullable public String getMccString();
|
method @Nullable public String getMccString();
|
||||||
method @Nullable public String getMncString();
|
method @Nullable public String getMncString();
|
||||||
method public long getNci();
|
method public long getNci();
|
||||||
|
|||||||
@@ -25,10 +25,9 @@ import android.telephony.gsm.GsmCellLocation;
|
|||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
import android.util.ArraySet;
|
import android.util.ArraySet;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.Arrays;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
@@ -56,7 +55,7 @@ public final class CellIdentityLte extends CellIdentity {
|
|||||||
// cell bandwidth, in kHz
|
// cell bandwidth, in kHz
|
||||||
private final int mBandwidth;
|
private final int mBandwidth;
|
||||||
// cell bands
|
// cell bands
|
||||||
private final List<Integer> mBands;
|
private final int[] mBands;
|
||||||
|
|
||||||
// a list of additional PLMN-IDs reported for this cell
|
// a list of additional PLMN-IDs reported for this cell
|
||||||
private final ArraySet<String> mAdditionalPlmns;
|
private final ArraySet<String> mAdditionalPlmns;
|
||||||
@@ -73,7 +72,7 @@ public final class CellIdentityLte extends CellIdentity {
|
|||||||
mPci = CellInfo.UNAVAILABLE;
|
mPci = CellInfo.UNAVAILABLE;
|
||||||
mTac = CellInfo.UNAVAILABLE;
|
mTac = CellInfo.UNAVAILABLE;
|
||||||
mEarfcn = CellInfo.UNAVAILABLE;
|
mEarfcn = CellInfo.UNAVAILABLE;
|
||||||
mBands = Collections.emptyList();
|
mBands = new int[] {};
|
||||||
mBandwidth = CellInfo.UNAVAILABLE;
|
mBandwidth = CellInfo.UNAVAILABLE;
|
||||||
mAdditionalPlmns = new ArraySet<>();
|
mAdditionalPlmns = new ArraySet<>();
|
||||||
mCsgInfo = null;
|
mCsgInfo = null;
|
||||||
@@ -91,7 +90,7 @@ public final class CellIdentityLte extends CellIdentity {
|
|||||||
*/
|
*/
|
||||||
@UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P, trackingBug = 115609023)
|
@UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P, trackingBug = 115609023)
|
||||||
public CellIdentityLte(int mcc, int mnc, int ci, int pci, int tac) {
|
public CellIdentityLte(int mcc, int mnc, int ci, int pci, int tac) {
|
||||||
this(ci, pci, tac, CellInfo.UNAVAILABLE, Collections.emptyList(), CellInfo.UNAVAILABLE,
|
this(ci, pci, tac, CellInfo.UNAVAILABLE, new int[] {}, CellInfo.UNAVAILABLE,
|
||||||
String.valueOf(mcc), String.valueOf(mnc), null, null, new ArraySet<>(),
|
String.valueOf(mcc), String.valueOf(mnc), null, null, new ArraySet<>(),
|
||||||
null);
|
null);
|
||||||
}
|
}
|
||||||
@@ -112,16 +111,17 @@ public final class CellIdentityLte extends CellIdentity {
|
|||||||
*
|
*
|
||||||
* @hide
|
* @hide
|
||||||
*/
|
*/
|
||||||
public CellIdentityLte(int ci, int pci, int tac, int earfcn, List<Integer> bands, int bandwidth,
|
public CellIdentityLte(int ci, int pci, int tac, int earfcn, @NonNull int[] bands,
|
||||||
@Nullable String mccStr, @Nullable String mncStr, @Nullable String alphal,
|
int bandwidth, @Nullable String mccStr, @Nullable String mncStr,
|
||||||
@Nullable String alphas, @NonNull Collection<String> additionalPlmns,
|
@Nullable String alphal, @Nullable String alphas,
|
||||||
|
@NonNull Collection<String> additionalPlmns,
|
||||||
@Nullable ClosedSubscriberGroupInfo csgInfo) {
|
@Nullable ClosedSubscriberGroupInfo csgInfo) {
|
||||||
super(TAG, CellInfo.TYPE_LTE, mccStr, mncStr, alphal, alphas);
|
super(TAG, CellInfo.TYPE_LTE, mccStr, mncStr, alphal, alphas);
|
||||||
mCi = inRangeOrUnavailable(ci, 0, MAX_CI);
|
mCi = inRangeOrUnavailable(ci, 0, MAX_CI);
|
||||||
mPci = inRangeOrUnavailable(pci, 0, MAX_PCI);
|
mPci = inRangeOrUnavailable(pci, 0, MAX_PCI);
|
||||||
mTac = inRangeOrUnavailable(tac, 0, MAX_TAC);
|
mTac = inRangeOrUnavailable(tac, 0, MAX_TAC);
|
||||||
mEarfcn = inRangeOrUnavailable(earfcn, 0, MAX_EARFCN);
|
mEarfcn = inRangeOrUnavailable(earfcn, 0, MAX_EARFCN);
|
||||||
mBands = new ArrayList<>(bands);
|
mBands = bands;
|
||||||
mBandwidth = inRangeOrUnavailable(bandwidth, 0, MAX_BANDWIDTH);
|
mBandwidth = inRangeOrUnavailable(bandwidth, 0, MAX_BANDWIDTH);
|
||||||
mAdditionalPlmns = new ArraySet<>(additionalPlmns.size());
|
mAdditionalPlmns = new ArraySet<>(additionalPlmns.size());
|
||||||
for (String plmn : additionalPlmns) {
|
for (String plmn : additionalPlmns) {
|
||||||
@@ -134,13 +134,13 @@ public final class CellIdentityLte extends CellIdentity {
|
|||||||
|
|
||||||
/** @hide */
|
/** @hide */
|
||||||
public CellIdentityLte(@NonNull android.hardware.radio.V1_0.CellIdentityLte cid) {
|
public CellIdentityLte(@NonNull android.hardware.radio.V1_0.CellIdentityLte cid) {
|
||||||
this(cid.ci, cid.pci, cid.tac, cid.earfcn, Collections.emptyList(),
|
this(cid.ci, cid.pci, cid.tac, cid.earfcn, new int[] {},
|
||||||
CellInfo.UNAVAILABLE, cid.mcc, cid.mnc, "", "", new ArraySet<>(), null);
|
CellInfo.UNAVAILABLE, cid.mcc, cid.mnc, "", "", new ArraySet<>(), null);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @hide */
|
/** @hide */
|
||||||
public CellIdentityLte(@NonNull android.hardware.radio.V1_2.CellIdentityLte cid) {
|
public CellIdentityLte(@NonNull android.hardware.radio.V1_2.CellIdentityLte cid) {
|
||||||
this(cid.base.ci, cid.base.pci, cid.base.tac, cid.base.earfcn, Collections.emptyList(),
|
this(cid.base.ci, cid.base.pci, cid.base.tac, cid.base.earfcn, new int[] {},
|
||||||
cid.bandwidth, cid.base.mcc, cid.base.mnc, cid.operatorNames.alphaLong,
|
cid.bandwidth, cid.base.mcc, cid.base.mnc, cid.operatorNames.alphaLong,
|
||||||
cid.operatorNames.alphaShort, new ArraySet<>(), null);
|
cid.operatorNames.alphaShort, new ArraySet<>(), null);
|
||||||
}
|
}
|
||||||
@@ -148,9 +148,10 @@ public final class CellIdentityLte extends CellIdentity {
|
|||||||
/** @hide */
|
/** @hide */
|
||||||
public CellIdentityLte(@NonNull android.hardware.radio.V1_5.CellIdentityLte cid) {
|
public CellIdentityLte(@NonNull android.hardware.radio.V1_5.CellIdentityLte cid) {
|
||||||
this(cid.base.base.ci, cid.base.base.pci, cid.base.base.tac, cid.base.base.earfcn,
|
this(cid.base.base.ci, cid.base.base.pci, cid.base.base.tac, cid.base.base.earfcn,
|
||||||
cid.bands, cid.base.bandwidth, cid.base.base.mcc, cid.base.base.mnc,
|
cid.bands.stream().mapToInt(Integer::intValue).toArray(), cid.base.bandwidth,
|
||||||
cid.base.operatorNames.alphaLong, cid.base.operatorNames.alphaShort,
|
cid.base.base.mcc, cid.base.base.mnc, cid.base.operatorNames.alphaLong,
|
||||||
cid.additionalPlmns, cid.optionalCsgInfo.csgInfo() != null
|
cid.base.operatorNames.alphaShort, cid.additionalPlmns,
|
||||||
|
cid.optionalCsgInfo.csgInfo() != null
|
||||||
? new ClosedSubscriberGroupInfo(cid.optionalCsgInfo.csgInfo()) : null);
|
? new ClosedSubscriberGroupInfo(cid.optionalCsgInfo.csgInfo()) : null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -228,11 +229,11 @@ public final class CellIdentityLte extends CellIdentity {
|
|||||||
*
|
*
|
||||||
* Reference: 3GPP TS 36.101 section 5.5
|
* Reference: 3GPP TS 36.101 section 5.5
|
||||||
*
|
*
|
||||||
* @return List of band number or empty list if not available.
|
* @return Array of band number or empty array if not available.
|
||||||
*/
|
*/
|
||||||
@NonNull
|
@NonNull
|
||||||
public List<Integer> getBands() {
|
public int[] getBands() {
|
||||||
return Collections.unmodifiableList(mBands);
|
return Arrays.copyOf(mBands, mBands.length);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -314,8 +315,8 @@ public final class CellIdentityLte extends CellIdentity {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
return Objects.hash(mCi, mPci, mTac,
|
return Objects.hash(mCi, mPci, mTac, mEarfcn, Arrays.hashCode(mBands),
|
||||||
mAdditionalPlmns.hashCode(), mCsgInfo, super.hashCode());
|
mBandwidth, mAdditionalPlmns.hashCode(), mCsgInfo, super.hashCode());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -333,6 +334,7 @@ public final class CellIdentityLte extends CellIdentity {
|
|||||||
&& mPci == o.mPci
|
&& mPci == o.mPci
|
||||||
&& mTac == o.mTac
|
&& mTac == o.mTac
|
||||||
&& mEarfcn == o.mEarfcn
|
&& mEarfcn == o.mEarfcn
|
||||||
|
&& Arrays.equals(mBands, o.mBands)
|
||||||
&& mBandwidth == o.mBandwidth
|
&& mBandwidth == o.mBandwidth
|
||||||
&& TextUtils.equals(mMccStr, o.mMccStr)
|
&& TextUtils.equals(mMccStr, o.mMccStr)
|
||||||
&& TextUtils.equals(mMncStr, o.mMncStr)
|
&& TextUtils.equals(mMncStr, o.mMncStr)
|
||||||
@@ -368,7 +370,7 @@ public final class CellIdentityLte extends CellIdentity {
|
|||||||
dest.writeInt(mPci);
|
dest.writeInt(mPci);
|
||||||
dest.writeInt(mTac);
|
dest.writeInt(mTac);
|
||||||
dest.writeInt(mEarfcn);
|
dest.writeInt(mEarfcn);
|
||||||
dest.writeList(mBands);
|
dest.writeIntArray(mBands);
|
||||||
dest.writeInt(mBandwidth);
|
dest.writeInt(mBandwidth);
|
||||||
dest.writeArraySet(mAdditionalPlmns);
|
dest.writeArraySet(mAdditionalPlmns);
|
||||||
dest.writeParcelable(mCsgInfo, flags);
|
dest.writeParcelable(mCsgInfo, flags);
|
||||||
@@ -381,7 +383,7 @@ public final class CellIdentityLte extends CellIdentity {
|
|||||||
mPci = in.readInt();
|
mPci = in.readInt();
|
||||||
mTac = in.readInt();
|
mTac = in.readInt();
|
||||||
mEarfcn = in.readInt();
|
mEarfcn = in.readInt();
|
||||||
mBands = in.readArrayList(null);
|
mBands = in.createIntArray();
|
||||||
mBandwidth = in.readInt();
|
mBandwidth = in.readInt();
|
||||||
mAdditionalPlmns = (ArraySet<String>) in.readArraySet(null);
|
mAdditionalPlmns = (ArraySet<String>) in.readArraySet(null);
|
||||||
mCsgInfo = in.readParcelable(null);
|
mCsgInfo = in.readParcelable(null);
|
||||||
|
|||||||
@@ -24,10 +24,9 @@ import android.telephony.AccessNetworkConstants.NgranBands.NgranBand;
|
|||||||
import android.telephony.gsm.GsmCellLocation;
|
import android.telephony.gsm.GsmCellLocation;
|
||||||
import android.util.ArraySet;
|
import android.util.ArraySet;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.Arrays;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
@@ -46,7 +45,7 @@ public final class CellIdentityNr extends CellIdentity {
|
|||||||
private final int mPci;
|
private final int mPci;
|
||||||
private final int mTac;
|
private final int mTac;
|
||||||
private final long mNci;
|
private final long mNci;
|
||||||
private final List<Integer> mBands;
|
private final int[] mBands;
|
||||||
|
|
||||||
// a list of additional PLMN-IDs reported for this cell
|
// a list of additional PLMN-IDs reported for this cell
|
||||||
private final ArraySet<String> mAdditionalPlmns;
|
private final ArraySet<String> mAdditionalPlmns;
|
||||||
@@ -66,7 +65,7 @@ public final class CellIdentityNr extends CellIdentity {
|
|||||||
*
|
*
|
||||||
* @hide
|
* @hide
|
||||||
*/
|
*/
|
||||||
public CellIdentityNr(int pci, int tac, int nrArfcn, @NgranBand List<Integer> bands,
|
public CellIdentityNr(int pci, int tac, int nrArfcn, @NonNull @NgranBand int[] bands,
|
||||||
@Nullable String mccStr, @Nullable String mncStr, long nci,
|
@Nullable String mccStr, @Nullable String mncStr, long nci,
|
||||||
@Nullable String alphal, @Nullable String alphas,
|
@Nullable String alphal, @Nullable String alphas,
|
||||||
@NonNull Collection<String> additionalPlmns) {
|
@NonNull Collection<String> additionalPlmns) {
|
||||||
@@ -74,7 +73,8 @@ public final class CellIdentityNr extends CellIdentity {
|
|||||||
mPci = inRangeOrUnavailable(pci, 0, MAX_PCI);
|
mPci = inRangeOrUnavailable(pci, 0, MAX_PCI);
|
||||||
mTac = inRangeOrUnavailable(tac, 0, MAX_TAC);
|
mTac = inRangeOrUnavailable(tac, 0, MAX_TAC);
|
||||||
mNrArfcn = inRangeOrUnavailable(nrArfcn, 0, MAX_NRARFCN);
|
mNrArfcn = inRangeOrUnavailable(nrArfcn, 0, MAX_NRARFCN);
|
||||||
mBands = new ArrayList<>(bands);
|
// TODO: input validation for bands
|
||||||
|
mBands = bands;
|
||||||
mNci = inRangeOrUnavailable(nci, 0, MAX_NCI);
|
mNci = inRangeOrUnavailable(nci, 0, MAX_NCI);
|
||||||
mAdditionalPlmns = new ArraySet<>(additionalPlmns.size());
|
mAdditionalPlmns = new ArraySet<>(additionalPlmns.size());
|
||||||
for (String plmn : additionalPlmns) {
|
for (String plmn : additionalPlmns) {
|
||||||
@@ -86,15 +86,16 @@ public final class CellIdentityNr extends CellIdentity {
|
|||||||
|
|
||||||
/** @hide */
|
/** @hide */
|
||||||
public CellIdentityNr(@NonNull android.hardware.radio.V1_4.CellIdentityNr cid) {
|
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,
|
this(cid.pci, cid.tac, cid.nrarfcn, new int[] {}, cid.mcc, cid.mnc, cid.nci,
|
||||||
cid.operatorNames.alphaLong, cid.operatorNames.alphaShort,
|
cid.operatorNames.alphaLong, cid.operatorNames.alphaShort,
|
||||||
new ArraySet<>());
|
new ArraySet<>());
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @hide */
|
/** @hide */
|
||||||
public CellIdentityNr(@NonNull android.hardware.radio.V1_5.CellIdentityNr cid) {
|
public CellIdentityNr(@NonNull android.hardware.radio.V1_5.CellIdentityNr cid) {
|
||||||
this(cid.base.pci, cid.base.tac, cid.base.nrarfcn, cid.bands, cid.base.mcc, cid.base.mnc,
|
this(cid.base.pci, cid.base.tac, cid.base.nrarfcn,
|
||||||
cid.base.nci, cid.base.operatorNames.alphaLong,
|
cid.bands.stream().mapToInt(Integer::intValue).toArray(), cid.base.mcc,
|
||||||
|
cid.base.mnc, cid.base.nci, cid.base.operatorNames.alphaLong,
|
||||||
cid.base.operatorNames.alphaShort, cid.additionalPlmns);
|
cid.base.operatorNames.alphaShort, cid.additionalPlmns);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -119,18 +120,22 @@ public final class CellIdentityNr extends CellIdentity {
|
|||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
return Objects.hash(super.hashCode(), mPci, mTac,
|
return Objects.hash(super.hashCode(), mPci, mTac,
|
||||||
mNrArfcn, mBands.hashCode(), mNci, mAdditionalPlmns.hashCode());
|
mNrArfcn, Arrays.hashCode(mBands), mNci, mAdditionalPlmns.hashCode());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object other) {
|
public boolean equals(Object other) {
|
||||||
|
if (this == other) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
if (!(other instanceof CellIdentityNr)) {
|
if (!(other instanceof CellIdentityNr)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
CellIdentityNr o = (CellIdentityNr) other;
|
CellIdentityNr o = (CellIdentityNr) other;
|
||||||
return super.equals(o) && mPci == o.mPci && mTac == o.mTac && mNrArfcn == o.mNrArfcn
|
return super.equals(o) && mPci == o.mPci && mTac == o.mTac && mNrArfcn == o.mNrArfcn
|
||||||
&& mBands.equals(o.mBands) && mNci == o.mNci
|
&& Arrays.equals(mBands, o.mBands) && mNci == o.mNci
|
||||||
&& mAdditionalPlmns.equals(o.mAdditionalPlmns);
|
&& mAdditionalPlmns.equals(o.mAdditionalPlmns);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -163,12 +168,12 @@ public final class CellIdentityNr extends CellIdentity {
|
|||||||
* Reference: TS 38.101-1 table 5.2-1
|
* Reference: TS 38.101-1 table 5.2-1
|
||||||
* Reference: TS 38.101-2 table 5.2-1
|
* Reference: TS 38.101-2 table 5.2-1
|
||||||
*
|
*
|
||||||
* @return List of band number or empty list if not available.
|
* @return Array of band number or empty array if not available.
|
||||||
*/
|
*/
|
||||||
@NgranBand
|
@NgranBand
|
||||||
@NonNull
|
@NonNull
|
||||||
public List<Integer> getBands() {
|
public int[] getBands() {
|
||||||
return Collections.unmodifiableList(mBands);
|
return Arrays.copyOf(mBands, mBands.length);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -242,7 +247,7 @@ public final class CellIdentityNr extends CellIdentity {
|
|||||||
dest.writeInt(mPci);
|
dest.writeInt(mPci);
|
||||||
dest.writeInt(mTac);
|
dest.writeInt(mTac);
|
||||||
dest.writeInt(mNrArfcn);
|
dest.writeInt(mNrArfcn);
|
||||||
dest.writeList(mBands);
|
dest.writeIntArray(mBands);
|
||||||
dest.writeLong(mNci);
|
dest.writeLong(mNci);
|
||||||
dest.writeArraySet(mAdditionalPlmns);
|
dest.writeArraySet(mAdditionalPlmns);
|
||||||
}
|
}
|
||||||
@@ -253,7 +258,7 @@ public final class CellIdentityNr extends CellIdentity {
|
|||||||
mPci = in.readInt();
|
mPci = in.readInt();
|
||||||
mTac = in.readInt();
|
mTac = in.readInt();
|
||||||
mNrArfcn = in.readInt();
|
mNrArfcn = in.readInt();
|
||||||
mBands = in.readArrayList(null);
|
mBands = in.createIntArray();
|
||||||
mNci = in.readLong();
|
mNci = in.readLong();
|
||||||
mAdditionalPlmns = (ArraySet<String>) in.readArraySet(null);
|
mAdditionalPlmns = (ArraySet<String>) in.readArraySet(null);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user