Merge "Add Nullability Annotations and verification to CellIdentity" am: bf003b77a2 am: a48e8b71fb
Change-Id: I9d396a49b8e20aabd5d5590ccc38c1ed1a008555
This commit is contained in:
@@ -16,8 +16,6 @@
|
|||||||
|
|
||||||
package android.telephony;
|
package android.telephony;
|
||||||
|
|
||||||
import com.android.telephony.Rlog;
|
|
||||||
|
|
||||||
import android.annotation.CallSuper;
|
import android.annotation.CallSuper;
|
||||||
import android.annotation.NonNull;
|
import android.annotation.NonNull;
|
||||||
import android.annotation.Nullable;
|
import android.annotation.Nullable;
|
||||||
@@ -71,8 +69,8 @@ public abstract class CellIdentity implements Parcelable {
|
|||||||
protected String mAlphaShort;
|
protected String mAlphaShort;
|
||||||
|
|
||||||
/** @hide */
|
/** @hide */
|
||||||
protected CellIdentity(String tag, int type, String mcc, String mnc, String alphal,
|
protected CellIdentity(@Nullable String tag, int type, @Nullable String mcc,
|
||||||
String alphas) {
|
@Nullable String mnc, @Nullable String alphal, @Nullable String alphas) {
|
||||||
mTag = tag;
|
mTag = tag;
|
||||||
mType = type;
|
mType = type;
|
||||||
|
|
||||||
|
|||||||
@@ -17,6 +17,7 @@
|
|||||||
package android.telephony;
|
package android.telephony;
|
||||||
|
|
||||||
import android.annotation.NonNull;
|
import android.annotation.NonNull;
|
||||||
|
import android.annotation.Nullable;
|
||||||
import android.os.Parcel;
|
import android.os.Parcel;
|
||||||
import android.telephony.cdma.CdmaCellLocation;
|
import android.telephony.cdma.CdmaCellLocation;
|
||||||
|
|
||||||
@@ -90,8 +91,8 @@ public final class CellIdentityCdma extends CellIdentity {
|
|||||||
*
|
*
|
||||||
* @hide
|
* @hide
|
||||||
*/
|
*/
|
||||||
public CellIdentityCdma(
|
public CellIdentityCdma(int nid, int sid, int bid, int lon, int lat,
|
||||||
int nid, int sid, int bid, int lon, int lat, String alphal, String alphas) {
|
@Nullable String alphal, @Nullable String alphas) {
|
||||||
super(TAG, CellInfo.TYPE_CDMA, null, null, alphal, alphas);
|
super(TAG, CellInfo.TYPE_CDMA, null, null, alphal, alphas);
|
||||||
mNetworkId = inRangeOrUnavailable(nid, 0, NETWORK_ID_MAX);
|
mNetworkId = inRangeOrUnavailable(nid, 0, NETWORK_ID_MAX);
|
||||||
mSystemId = inRangeOrUnavailable(sid, 0, SYSTEM_ID_MAX);
|
mSystemId = inRangeOrUnavailable(sid, 0, SYSTEM_ID_MAX);
|
||||||
@@ -108,22 +109,22 @@ public final class CellIdentityCdma extends CellIdentity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** @hide */
|
/** @hide */
|
||||||
public CellIdentityCdma(android.hardware.radio.V1_0.CellIdentityCdma cid) {
|
public CellIdentityCdma(@NonNull android.hardware.radio.V1_0.CellIdentityCdma cid) {
|
||||||
this(cid.networkId, cid.systemId, cid.baseStationId, cid.longitude, cid.latitude, "", "");
|
this(cid.networkId, cid.systemId, cid.baseStationId, cid.longitude, cid.latitude, "", "");
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @hide */
|
/** @hide */
|
||||||
public CellIdentityCdma(android.hardware.radio.V1_2.CellIdentityCdma cid) {
|
public CellIdentityCdma(@NonNull android.hardware.radio.V1_2.CellIdentityCdma cid) {
|
||||||
this(cid.base.networkId, cid.base.systemId, cid.base.baseStationId, cid.base.longitude,
|
this(cid.base.networkId, cid.base.systemId, cid.base.baseStationId, cid.base.longitude,
|
||||||
cid.base.latitude, cid.operatorNames.alphaLong, cid.operatorNames.alphaShort);
|
cid.base.latitude, cid.operatorNames.alphaLong, cid.operatorNames.alphaShort);
|
||||||
}
|
}
|
||||||
|
|
||||||
private CellIdentityCdma(CellIdentityCdma cid) {
|
private CellIdentityCdma(@NonNull CellIdentityCdma cid) {
|
||||||
this(cid.mNetworkId, cid.mSystemId, cid.mBasestationId, cid.mLongitude, cid.mLatitude,
|
this(cid.mNetworkId, cid.mSystemId, cid.mBasestationId, cid.mLongitude, cid.mLatitude,
|
||||||
cid.mAlphaLong, cid.mAlphaShort);
|
cid.mAlphaLong, cid.mAlphaShort);
|
||||||
}
|
}
|
||||||
|
|
||||||
CellIdentityCdma copy() {
|
@NonNull CellIdentityCdma copy() {
|
||||||
return new CellIdentityCdma(this);
|
return new CellIdentityCdma(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ import android.os.Parcel;
|
|||||||
import android.telephony.gsm.GsmCellLocation;
|
import android.telephony.gsm.GsmCellLocation;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
@@ -78,26 +79,31 @@ public final class CellIdentityGsm extends CellIdentity {
|
|||||||
*
|
*
|
||||||
* @hide
|
* @hide
|
||||||
*/
|
*/
|
||||||
public CellIdentityGsm(int lac, int cid, int arfcn, int bsic, String mccStr,
|
public CellIdentityGsm(int lac, int cid, int arfcn, int bsic, @Nullable String mccStr,
|
||||||
String mncStr, String alphal, String alphas,
|
@Nullable String mncStr, @Nullable String alphal, @Nullable String alphas,
|
||||||
List<String> additionalPlmns) {
|
@NonNull List<String> additionalPlmns) {
|
||||||
super(TAG, CellInfo.TYPE_GSM, mccStr, mncStr, alphal, alphas);
|
super(TAG, CellInfo.TYPE_GSM, mccStr, mncStr, alphal, alphas);
|
||||||
mLac = inRangeOrUnavailable(lac, 0, MAX_LAC);
|
mLac = inRangeOrUnavailable(lac, 0, MAX_LAC);
|
||||||
mCid = inRangeOrUnavailable(cid, 0, MAX_CID);
|
mCid = inRangeOrUnavailable(cid, 0, MAX_CID);
|
||||||
mArfcn = inRangeOrUnavailable(arfcn, 0, MAX_ARFCN);
|
mArfcn = inRangeOrUnavailable(arfcn, 0, MAX_ARFCN);
|
||||||
mBsic = inRangeOrUnavailable(bsic, 0, MAX_BSIC);
|
mBsic = inRangeOrUnavailable(bsic, 0, MAX_BSIC);
|
||||||
mAdditionalPlmns = additionalPlmns;
|
mAdditionalPlmns = new ArrayList<>(additionalPlmns.size());
|
||||||
|
for (String plmn : additionalPlmns) {
|
||||||
|
if (isValidPlmn(plmn)) {
|
||||||
|
mAdditionalPlmns.add(plmn);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @hide */
|
/** @hide */
|
||||||
public CellIdentityGsm(android.hardware.radio.V1_0.CellIdentityGsm cid) {
|
public CellIdentityGsm(@NonNull android.hardware.radio.V1_0.CellIdentityGsm cid) {
|
||||||
this(cid.lac, cid.cid, cid.arfcn,
|
this(cid.lac, cid.cid, cid.arfcn,
|
||||||
cid.bsic == (byte) 0xFF ? CellInfo.UNAVAILABLE : cid.bsic,
|
cid.bsic == (byte) 0xFF ? CellInfo.UNAVAILABLE : cid.bsic,
|
||||||
cid.mcc, cid.mnc, "", "", Collections.emptyList());
|
cid.mcc, cid.mnc, "", "", Collections.emptyList());
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @hide */
|
/** @hide */
|
||||||
public CellIdentityGsm(android.hardware.radio.V1_2.CellIdentityGsm cid) {
|
public CellIdentityGsm(@NonNull android.hardware.radio.V1_2.CellIdentityGsm cid) {
|
||||||
this(cid.base.lac, cid.base.cid, cid.base.arfcn,
|
this(cid.base.lac, cid.base.cid, cid.base.arfcn,
|
||||||
cid.base.bsic == (byte) 0xFF ? CellInfo.UNAVAILABLE : cid.base.bsic, cid.base.mcc,
|
cid.base.bsic == (byte) 0xFF ? CellInfo.UNAVAILABLE : cid.base.bsic, cid.base.mcc,
|
||||||
cid.base.mnc, cid.operatorNames.alphaLong, cid.operatorNames.alphaShort,
|
cid.base.mnc, cid.operatorNames.alphaLong, cid.operatorNames.alphaShort,
|
||||||
@@ -105,7 +111,7 @@ public final class CellIdentityGsm extends CellIdentity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** @hide */
|
/** @hide */
|
||||||
public CellIdentityGsm(android.hardware.radio.V1_5.CellIdentityGsm cid) {
|
public CellIdentityGsm(@NonNull android.hardware.radio.V1_5.CellIdentityGsm cid) {
|
||||||
this(cid.base.base.lac, cid.base.base.cid, cid.base.base.arfcn,
|
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 == (byte) 0xFF ? CellInfo.UNAVAILABLE
|
||||||
: cid.base.base.bsic, cid.base.base.mcc,
|
: cid.base.base.bsic, cid.base.base.mcc,
|
||||||
@@ -113,12 +119,12 @@ public final class CellIdentityGsm extends CellIdentity {
|
|||||||
cid.base.operatorNames.alphaShort, cid.additionalPlmns);
|
cid.base.operatorNames.alphaShort, cid.additionalPlmns);
|
||||||
}
|
}
|
||||||
|
|
||||||
private CellIdentityGsm(CellIdentityGsm cid) {
|
private CellIdentityGsm(@NonNull CellIdentityGsm cid) {
|
||||||
this(cid.mLac, cid.mCid, cid.mArfcn, cid.mBsic, cid.mMccStr,
|
this(cid.mLac, cid.mCid, cid.mArfcn, cid.mBsic, cid.mMccStr,
|
||||||
cid.mMncStr, cid.mAlphaLong, cid.mAlphaShort, cid.mAdditionalPlmns);
|
cid.mMncStr, cid.mAlphaLong, cid.mAlphaShort, cid.mAdditionalPlmns);
|
||||||
}
|
}
|
||||||
|
|
||||||
CellIdentityGsm copy() {
|
@NonNull CellIdentityGsm copy() {
|
||||||
return new CellIdentityGsm(this);
|
return new CellIdentityGsm(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ import android.os.Parcel;
|
|||||||
import android.telephony.gsm.GsmCellLocation;
|
import android.telephony.gsm.GsmCellLocation;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
@@ -104,34 +105,40 @@ public final class CellIdentityLte extends CellIdentity {
|
|||||||
*
|
*
|
||||||
* @hide
|
* @hide
|
||||||
*/
|
*/
|
||||||
public CellIdentityLte(int ci, int pci, int tac, int earfcn, int bandwidth, String mccStr,
|
public CellIdentityLte(int ci, int pci, int tac, int earfcn, int bandwidth,
|
||||||
String mncStr, String alphal, String alphas, List<String> additionalPlmns,
|
@Nullable String mccStr, @Nullable String mncStr, @Nullable String alphal,
|
||||||
ClosedSubscriberGroupInfo csgInfo) {
|
@Nullable String alphas, @NonNull List<String> additionalPlmns,
|
||||||
|
@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);
|
||||||
mBandwidth = inRangeOrUnavailable(bandwidth, 0, MAX_BANDWIDTH);
|
mBandwidth = inRangeOrUnavailable(bandwidth, 0, MAX_BANDWIDTH);
|
||||||
mAdditionalPlmns = additionalPlmns;
|
mAdditionalPlmns = new ArrayList<>(additionalPlmns.size());
|
||||||
|
for (String plmn : additionalPlmns) {
|
||||||
|
if (isValidPlmn(plmn)) {
|
||||||
|
mAdditionalPlmns.add(plmn);
|
||||||
|
}
|
||||||
|
}
|
||||||
mCsgInfo = csgInfo;
|
mCsgInfo = csgInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @hide */
|
/** @hide */
|
||||||
public CellIdentityLte(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,
|
this(cid.ci, cid.pci, cid.tac, cid.earfcn,
|
||||||
CellInfo.UNAVAILABLE, cid.mcc, cid.mnc, "", "", Collections.emptyList(), null);
|
CellInfo.UNAVAILABLE, cid.mcc, cid.mnc, "", "", Collections.emptyList(), null);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @hide */
|
/** @hide */
|
||||||
public CellIdentityLte(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, cid.bandwidth,
|
this(cid.base.ci, cid.base.pci, cid.base.tac, cid.base.earfcn, cid.bandwidth,
|
||||||
cid.base.mcc, cid.base.mnc, cid.operatorNames.alphaLong,
|
cid.base.mcc, cid.base.mnc, cid.operatorNames.alphaLong,
|
||||||
cid.operatorNames.alphaShort, Collections.emptyList(), null);
|
cid.operatorNames.alphaShort, Collections.emptyList(), null);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @hide */
|
/** @hide */
|
||||||
public CellIdentityLte(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.base.bandwidth, cid.base.base.mcc, cid.base.base.mnc,
|
cid.base.bandwidth, cid.base.base.mcc, cid.base.base.mnc,
|
||||||
cid.base.operatorNames.alphaLong, cid.base.operatorNames.alphaShort,
|
cid.base.operatorNames.alphaLong, cid.base.operatorNames.alphaShort,
|
||||||
@@ -139,7 +146,7 @@ public final class CellIdentityLte extends CellIdentity {
|
|||||||
? new ClosedSubscriberGroupInfo(cid.optionalCsgInfo.csgInfo()) : null);
|
? new ClosedSubscriberGroupInfo(cid.optionalCsgInfo.csgInfo()) : null);
|
||||||
}
|
}
|
||||||
|
|
||||||
private CellIdentityLte(CellIdentityLte cid) {
|
private CellIdentityLte(@NonNull CellIdentityLte cid) {
|
||||||
this(cid.mCi, cid.mPci, cid.mTac, cid.mEarfcn, cid.mBandwidth, cid.mMccStr,
|
this(cid.mCi, cid.mPci, cid.mTac, cid.mEarfcn, cid.mBandwidth, cid.mMccStr,
|
||||||
cid.mMncStr, cid.mAlphaLong, cid.mAlphaShort, cid.mAdditionalPlmns, cid.mCsgInfo);
|
cid.mMncStr, cid.mAlphaLong, cid.mAlphaShort, cid.mAdditionalPlmns, cid.mCsgInfo);
|
||||||
}
|
}
|
||||||
@@ -152,7 +159,7 @@ public final class CellIdentityLte extends CellIdentity {
|
|||||||
mMccStr, mMncStr, mAlphaLong, mAlphaShort, mAdditionalPlmns, null);
|
mMccStr, mMncStr, mAlphaLong, mAlphaShort, mAdditionalPlmns, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
CellIdentityLte copy() {
|
@NonNull CellIdentityLte copy() {
|
||||||
return new CellIdentityLte(this);
|
return new CellIdentityLte(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -64,26 +64,32 @@ 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, @NgranBand List<Integer> bands,
|
||||||
String mccStr, String mncStr, long nci, String alphal, String alphas,
|
@Nullable String mccStr, @Nullable String mncStr, long nci,
|
||||||
List<String> additionalPlmns) {
|
@Nullable String alphal, @Nullable String alphas,
|
||||||
|
@NonNull List<String> additionalPlmns) {
|
||||||
super(TAG, CellInfo.TYPE_NR, mccStr, mncStr, alphal, alphas);
|
super(TAG, CellInfo.TYPE_NR, mccStr, mncStr, alphal, alphas);
|
||||||
mPci = inRangeOrUnavailable(pci, 0, MAX_PCI);
|
mPci = inRangeOrUnavailable(pci, 0, MAX_PCI);
|
||||||
mTac = inRangeOrUnavailable(tac, 0, MAX_TAC);
|
mTac = inRangeOrUnavailable(tac, 0, MAX_TAC);
|
||||||
mNrArfcn = inRangeOrUnavailable(nrArfcn, 0, MAX_NRARFCN);
|
mNrArfcn = inRangeOrUnavailable(nrArfcn, 0, MAX_NRARFCN);
|
||||||
mBands = new ArrayList<>(bands);
|
mBands = new ArrayList<>(bands);
|
||||||
mNci = inRangeOrUnavailable(nci, 0, MAX_NCI);
|
mNci = inRangeOrUnavailable(nci, 0, MAX_NCI);
|
||||||
mAdditionalPlmns = new ArrayList<>(additionalPlmns);
|
mAdditionalPlmns = new ArrayList<>(additionalPlmns.size());
|
||||||
|
for (String plmn : additionalPlmns) {
|
||||||
|
if (isValidPlmn(plmn)) {
|
||||||
|
mAdditionalPlmns.add(plmn);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @hide */
|
/** @hide */
|
||||||
public CellIdentityNr(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, Collections.emptyList(), cid.mcc, cid.mnc, cid.nci,
|
||||||
cid.operatorNames.alphaLong, cid.operatorNames.alphaShort,
|
cid.operatorNames.alphaLong, cid.operatorNames.alphaShort,
|
||||||
Collections.emptyList());
|
Collections.emptyList());
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @hide */
|
/** @hide */
|
||||||
public CellIdentityNr(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.bands, cid.base.mcc, cid.base.mnc,
|
||||||
cid.base.nci, cid.base.operatorNames.alphaLong,
|
cid.base.nci, cid.base.operatorNames.alphaLong,
|
||||||
cid.base.operatorNames.alphaShort, cid.additionalPlmns);
|
cid.base.operatorNames.alphaShort, cid.additionalPlmns);
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ import android.annotation.Nullable;
|
|||||||
import android.os.Parcel;
|
import android.os.Parcel;
|
||||||
import android.telephony.gsm.GsmCellLocation;
|
import android.telephony.gsm.GsmCellLocation;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
@@ -82,39 +83,44 @@ public final class CellIdentityTdscdma extends CellIdentity {
|
|||||||
*
|
*
|
||||||
* @hide
|
* @hide
|
||||||
*/
|
*/
|
||||||
public CellIdentityTdscdma(String mcc, String mnc, int lac, int cid, int cpid, int uarfcn,
|
public CellIdentityTdscdma(@Nullable String mcc, @Nullable String mnc, int lac, int cid,
|
||||||
String alphal, String alphas, @NonNull List<String> additionalPlmns,
|
int cpid, int uarfcn, @Nullable String alphal, @Nullable String alphas,
|
||||||
ClosedSubscriberGroupInfo csgInfo) {
|
@NonNull List<String> additionalPlmns, @Nullable ClosedSubscriberGroupInfo csgInfo) {
|
||||||
super(TAG, CellInfo.TYPE_TDSCDMA, mcc, mnc, alphal, alphas);
|
super(TAG, CellInfo.TYPE_TDSCDMA, mcc, mnc, alphal, alphas);
|
||||||
mLac = inRangeOrUnavailable(lac, 0, MAX_LAC);
|
mLac = inRangeOrUnavailable(lac, 0, MAX_LAC);
|
||||||
mCid = inRangeOrUnavailable(cid, 0, MAX_CID);
|
mCid = inRangeOrUnavailable(cid, 0, MAX_CID);
|
||||||
mCpid = inRangeOrUnavailable(cpid, 0, MAX_CPID);
|
mCpid = inRangeOrUnavailable(cpid, 0, MAX_CPID);
|
||||||
mUarfcn = inRangeOrUnavailable(uarfcn, 0, MAX_UARFCN);
|
mUarfcn = inRangeOrUnavailable(uarfcn, 0, MAX_UARFCN);
|
||||||
mAdditionalPlmns = additionalPlmns;
|
mAdditionalPlmns = new ArrayList<>(additionalPlmns.size());
|
||||||
|
for (String plmn : additionalPlmns) {
|
||||||
|
if (isValidPlmn(plmn)) {
|
||||||
|
mAdditionalPlmns.add(plmn);
|
||||||
|
}
|
||||||
|
}
|
||||||
mCsgInfo = csgInfo;
|
mCsgInfo = csgInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
private CellIdentityTdscdma(CellIdentityTdscdma cid) {
|
private CellIdentityTdscdma(@NonNull CellIdentityTdscdma cid) {
|
||||||
this(cid.mMccStr, cid.mMncStr, cid.mLac, cid.mCid,
|
this(cid.mMccStr, cid.mMncStr, cid.mLac, cid.mCid,
|
||||||
cid.mCpid, cid.mUarfcn, cid.mAlphaLong,
|
cid.mCpid, cid.mUarfcn, cid.mAlphaLong,
|
||||||
cid.mAlphaShort, cid.mAdditionalPlmns, cid.mCsgInfo);
|
cid.mAlphaShort, cid.mAdditionalPlmns, cid.mCsgInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @hide */
|
/** @hide */
|
||||||
public CellIdentityTdscdma(android.hardware.radio.V1_0.CellIdentityTdscdma cid) {
|
public CellIdentityTdscdma(@NonNull 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);
|
Collections.emptyList(), null);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @hide */
|
/** @hide */
|
||||||
public CellIdentityTdscdma(android.hardware.radio.V1_2.CellIdentityTdscdma cid) {
|
public CellIdentityTdscdma(@NonNull android.hardware.radio.V1_2.CellIdentityTdscdma cid) {
|
||||||
this(cid.base.mcc, cid.base.mnc, cid.base.lac, cid.base.cid, cid.base.cpid,
|
this(cid.base.mcc, cid.base.mnc, cid.base.lac, cid.base.cid, cid.base.cpid,
|
||||||
cid.uarfcn, cid.operatorNames.alphaLong, cid.operatorNames.alphaShort,
|
cid.uarfcn, cid.operatorNames.alphaLong, cid.operatorNames.alphaShort,
|
||||||
Collections.emptyList(), null);
|
Collections.emptyList(), null);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @hide */
|
/** @hide */
|
||||||
public CellIdentityTdscdma(android.hardware.radio.V1_5.CellIdentityTdscdma cid) {
|
public CellIdentityTdscdma(@NonNull android.hardware.radio.V1_5.CellIdentityTdscdma cid) {
|
||||||
this(cid.base.base.mcc, cid.base.base.mnc, cid.base.base.lac, cid.base.base.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.base.cpid, cid.base.uarfcn, cid.base.operatorNames.alphaLong,
|
||||||
cid.base.operatorNames.alphaShort,
|
cid.base.operatorNames.alphaShort,
|
||||||
@@ -130,7 +136,7 @@ public final class CellIdentityTdscdma extends CellIdentity {
|
|||||||
mAdditionalPlmns, null);
|
mAdditionalPlmns, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
CellIdentityTdscdma copy() {
|
@NonNull CellIdentityTdscdma copy() {
|
||||||
return new CellIdentityTdscdma(this);
|
return new CellIdentityTdscdma(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ import android.os.Parcel;
|
|||||||
import android.telephony.gsm.GsmCellLocation;
|
import android.telephony.gsm.GsmCellLocation;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
@@ -83,34 +84,38 @@ public final class CellIdentityWcdma extends CellIdentity {
|
|||||||
*
|
*
|
||||||
* @hide
|
* @hide
|
||||||
*/
|
*/
|
||||||
public CellIdentityWcdma (int lac, int cid, int psc, int uarfcn,
|
public CellIdentityWcdma(int lac, int cid, int psc, int uarfcn, @Nullable String mccStr,
|
||||||
String mccStr, String mncStr, String alphal, String alphas,
|
@Nullable String mncStr, @Nullable String alphal, @Nullable String alphas,
|
||||||
@NonNull List<String> additionalPlmns,
|
@NonNull List<String> additionalPlmns, @Nullable ClosedSubscriberGroupInfo csgInfo) {
|
||||||
@Nullable ClosedSubscriberGroupInfo csgInfo) {
|
|
||||||
super(TAG, CellInfo.TYPE_WCDMA, mccStr, mncStr, alphal, alphas);
|
super(TAG, CellInfo.TYPE_WCDMA, mccStr, mncStr, alphal, alphas);
|
||||||
mLac = inRangeOrUnavailable(lac, 0, MAX_LAC);
|
mLac = inRangeOrUnavailable(lac, 0, MAX_LAC);
|
||||||
mCid = inRangeOrUnavailable(cid, 0, MAX_CID);
|
mCid = inRangeOrUnavailable(cid, 0, MAX_CID);
|
||||||
mPsc = inRangeOrUnavailable(psc, 0, MAX_PSC);
|
mPsc = inRangeOrUnavailable(psc, 0, MAX_PSC);
|
||||||
mUarfcn = inRangeOrUnavailable(uarfcn, 0, MAX_UARFCN);
|
mUarfcn = inRangeOrUnavailable(uarfcn, 0, MAX_UARFCN);
|
||||||
mAdditionalPlmns = additionalPlmns;
|
mAdditionalPlmns = new ArrayList<>(additionalPlmns.size());
|
||||||
|
for (String plmn : additionalPlmns) {
|
||||||
|
if (isValidPlmn(plmn)) {
|
||||||
|
mAdditionalPlmns.add(plmn);
|
||||||
|
}
|
||||||
|
}
|
||||||
mCsgInfo = csgInfo;
|
mCsgInfo = csgInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @hide */
|
/** @hide */
|
||||||
public CellIdentityWcdma(android.hardware.radio.V1_0.CellIdentityWcdma cid) {
|
public CellIdentityWcdma(@NonNull 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);
|
Collections.emptyList(), null);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @hide */
|
/** @hide */
|
||||||
public CellIdentityWcdma(android.hardware.radio.V1_2.CellIdentityWcdma cid) {
|
public CellIdentityWcdma(@NonNull android.hardware.radio.V1_2.CellIdentityWcdma cid) {
|
||||||
this(cid.base.lac, cid.base.cid, cid.base.psc, cid.base.uarfcn,
|
this(cid.base.lac, cid.base.cid, cid.base.psc, cid.base.uarfcn,
|
||||||
cid.base.mcc, cid.base.mnc, cid.operatorNames.alphaLong,
|
cid.base.mcc, cid.base.mnc, cid.operatorNames.alphaLong,
|
||||||
cid.operatorNames.alphaShort, Collections.emptyList(), null);
|
cid.operatorNames.alphaShort, Collections.emptyList(), null);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @hide */
|
/** @hide */
|
||||||
public CellIdentityWcdma(android.hardware.radio.V1_5.CellIdentityWcdma cid) {
|
public CellIdentityWcdma(@NonNull android.hardware.radio.V1_5.CellIdentityWcdma cid) {
|
||||||
this(cid.base.base.lac, cid.base.base.cid, cid.base.base.psc, cid.base.base.uarfcn,
|
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.base.mcc, cid.base.base.mnc, cid.base.operatorNames.alphaLong,
|
||||||
cid.base.operatorNames.alphaShort, cid.additionalPlmns,
|
cid.base.operatorNames.alphaShort, cid.additionalPlmns,
|
||||||
@@ -118,7 +123,7 @@ public final class CellIdentityWcdma extends CellIdentity {
|
|||||||
? new ClosedSubscriberGroupInfo(cid.optionalCsgInfo.csgInfo()) : null);
|
? new ClosedSubscriberGroupInfo(cid.optionalCsgInfo.csgInfo()) : null);
|
||||||
}
|
}
|
||||||
|
|
||||||
private CellIdentityWcdma(CellIdentityWcdma cid) {
|
private CellIdentityWcdma(@NonNull CellIdentityWcdma cid) {
|
||||||
this(cid.mLac, cid.mCid, cid.mPsc, cid.mUarfcn, cid.mMccStr,
|
this(cid.mLac, cid.mCid, cid.mPsc, cid.mUarfcn, cid.mMccStr,
|
||||||
cid.mMncStr, cid.mAlphaLong, cid.mAlphaShort, cid.mAdditionalPlmns, cid.mCsgInfo);
|
cid.mMncStr, cid.mAlphaLong, cid.mAlphaShort, cid.mAdditionalPlmns, cid.mCsgInfo);
|
||||||
}
|
}
|
||||||
@@ -131,7 +136,7 @@ public final class CellIdentityWcdma extends CellIdentity {
|
|||||||
mAlphaLong, mAlphaShort, mAdditionalPlmns, null);
|
mAlphaLong, mAlphaShort, mAdditionalPlmns, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
CellIdentityWcdma copy() {
|
@NonNull CellIdentityWcdma copy() {
|
||||||
return new CellIdentityWcdma(this);
|
return new CellIdentityWcdma(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user