Merge "Add the operator name and MCC/MNC in string format into the CellIdentity."
am: 1565803cd2
Change-Id: Ie0a1305eb73256f358a853d87778f755d3b9e4d0
This commit is contained in:
@@ -39614,6 +39614,8 @@ package android.telephony {
|
||||
method public int getLatitude();
|
||||
method public int getLongitude();
|
||||
method public int getNetworkId();
|
||||
method public java.lang.CharSequence getOperatorAlphaLong();
|
||||
method public java.lang.CharSequence getOperatorAlphaShort();
|
||||
method public int getSystemId();
|
||||
method public void writeToParcel(android.os.Parcel, int);
|
||||
field public static final android.os.Parcelable.Creator<android.telephony.CellIdentityCdma> CREATOR;
|
||||
@@ -39625,8 +39627,13 @@ package android.telephony {
|
||||
method public int getBsic();
|
||||
method public int getCid();
|
||||
method public int getLac();
|
||||
method public int getMcc();
|
||||
method public int getMnc();
|
||||
method public deprecated int getMcc();
|
||||
method public java.lang.String getMccStr();
|
||||
method public deprecated int getMnc();
|
||||
method public java.lang.String getMncStr();
|
||||
method public java.lang.String getMobileNetworkOperator();
|
||||
method public java.lang.CharSequence getOperatorAlphaLong();
|
||||
method public java.lang.CharSequence getOperatorAlphaShort();
|
||||
method public deprecated int getPsc();
|
||||
method public void writeToParcel(android.os.Parcel, int);
|
||||
field public static final android.os.Parcelable.Creator<android.telephony.CellIdentityGsm> CREATOR;
|
||||
@@ -39636,8 +39643,13 @@ package android.telephony {
|
||||
method public int describeContents();
|
||||
method public int getCi();
|
||||
method public int getEarfcn();
|
||||
method public int getMcc();
|
||||
method public int getMnc();
|
||||
method public deprecated int getMcc();
|
||||
method public java.lang.String getMccStr();
|
||||
method public deprecated int getMnc();
|
||||
method public java.lang.String getMncStr();
|
||||
method public java.lang.String getMobileNetworkOperator();
|
||||
method public java.lang.CharSequence getOperatorAlphaLong();
|
||||
method public java.lang.CharSequence getOperatorAlphaShort();
|
||||
method public int getPci();
|
||||
method public int getTac();
|
||||
method public void writeToParcel(android.os.Parcel, int);
|
||||
@@ -39648,8 +39660,13 @@ package android.telephony {
|
||||
method public int describeContents();
|
||||
method public int getCid();
|
||||
method public int getLac();
|
||||
method public int getMcc();
|
||||
method public int getMnc();
|
||||
method public deprecated int getMcc();
|
||||
method public java.lang.String getMccStr();
|
||||
method public deprecated int getMnc();
|
||||
method public java.lang.String getMncStr();
|
||||
method public java.lang.String getMobileNetworkOperator();
|
||||
method public java.lang.CharSequence getOperatorAlphaLong();
|
||||
method public java.lang.CharSequence getOperatorAlphaShort();
|
||||
method public int getPsc();
|
||||
method public int getUarfcn();
|
||||
method public void writeToParcel(android.os.Parcel, int);
|
||||
|
||||
@@ -43045,6 +43045,8 @@ package android.telephony {
|
||||
method public int getLatitude();
|
||||
method public int getLongitude();
|
||||
method public int getNetworkId();
|
||||
method public java.lang.CharSequence getOperatorAlphaLong();
|
||||
method public java.lang.CharSequence getOperatorAlphaShort();
|
||||
method public int getSystemId();
|
||||
method public void writeToParcel(android.os.Parcel, int);
|
||||
field public static final android.os.Parcelable.Creator<android.telephony.CellIdentityCdma> CREATOR;
|
||||
@@ -43056,8 +43058,13 @@ package android.telephony {
|
||||
method public int getBsic();
|
||||
method public int getCid();
|
||||
method public int getLac();
|
||||
method public int getMcc();
|
||||
method public int getMnc();
|
||||
method public deprecated int getMcc();
|
||||
method public java.lang.String getMccStr();
|
||||
method public deprecated int getMnc();
|
||||
method public java.lang.String getMncStr();
|
||||
method public java.lang.String getMobileNetworkOperator();
|
||||
method public java.lang.CharSequence getOperatorAlphaLong();
|
||||
method public java.lang.CharSequence getOperatorAlphaShort();
|
||||
method public deprecated int getPsc();
|
||||
method public void writeToParcel(android.os.Parcel, int);
|
||||
field public static final android.os.Parcelable.Creator<android.telephony.CellIdentityGsm> CREATOR;
|
||||
@@ -43067,8 +43074,13 @@ package android.telephony {
|
||||
method public int describeContents();
|
||||
method public int getCi();
|
||||
method public int getEarfcn();
|
||||
method public int getMcc();
|
||||
method public int getMnc();
|
||||
method public deprecated int getMcc();
|
||||
method public java.lang.String getMccStr();
|
||||
method public deprecated int getMnc();
|
||||
method public java.lang.String getMncStr();
|
||||
method public java.lang.String getMobileNetworkOperator();
|
||||
method public java.lang.CharSequence getOperatorAlphaLong();
|
||||
method public java.lang.CharSequence getOperatorAlphaShort();
|
||||
method public int getPci();
|
||||
method public int getTac();
|
||||
method public void writeToParcel(android.os.Parcel, int);
|
||||
@@ -43079,8 +43091,13 @@ package android.telephony {
|
||||
method public int describeContents();
|
||||
method public int getCid();
|
||||
method public int getLac();
|
||||
method public int getMcc();
|
||||
method public int getMnc();
|
||||
method public deprecated int getMcc();
|
||||
method public java.lang.String getMccStr();
|
||||
method public deprecated int getMnc();
|
||||
method public java.lang.String getMncStr();
|
||||
method public java.lang.String getMobileNetworkOperator();
|
||||
method public java.lang.CharSequence getOperatorAlphaLong();
|
||||
method public java.lang.CharSequence getOperatorAlphaShort();
|
||||
method public int getPsc();
|
||||
method public int getUarfcn();
|
||||
method public void writeToParcel(android.os.Parcel, int);
|
||||
|
||||
@@ -39838,6 +39838,8 @@ package android.telephony {
|
||||
method public int getLatitude();
|
||||
method public int getLongitude();
|
||||
method public int getNetworkId();
|
||||
method public java.lang.CharSequence getOperatorAlphaLong();
|
||||
method public java.lang.CharSequence getOperatorAlphaShort();
|
||||
method public int getSystemId();
|
||||
method public void writeToParcel(android.os.Parcel, int);
|
||||
field public static final android.os.Parcelable.Creator<android.telephony.CellIdentityCdma> CREATOR;
|
||||
@@ -39849,8 +39851,13 @@ package android.telephony {
|
||||
method public int getBsic();
|
||||
method public int getCid();
|
||||
method public int getLac();
|
||||
method public int getMcc();
|
||||
method public int getMnc();
|
||||
method public deprecated int getMcc();
|
||||
method public java.lang.String getMccStr();
|
||||
method public deprecated int getMnc();
|
||||
method public java.lang.String getMncStr();
|
||||
method public java.lang.String getMobileNetworkOperator();
|
||||
method public java.lang.CharSequence getOperatorAlphaLong();
|
||||
method public java.lang.CharSequence getOperatorAlphaShort();
|
||||
method public deprecated int getPsc();
|
||||
method public void writeToParcel(android.os.Parcel, int);
|
||||
field public static final android.os.Parcelable.Creator<android.telephony.CellIdentityGsm> CREATOR;
|
||||
@@ -39860,8 +39867,13 @@ package android.telephony {
|
||||
method public int describeContents();
|
||||
method public int getCi();
|
||||
method public int getEarfcn();
|
||||
method public int getMcc();
|
||||
method public int getMnc();
|
||||
method public deprecated int getMcc();
|
||||
method public java.lang.String getMccStr();
|
||||
method public deprecated int getMnc();
|
||||
method public java.lang.String getMncStr();
|
||||
method public java.lang.String getMobileNetworkOperator();
|
||||
method public java.lang.CharSequence getOperatorAlphaLong();
|
||||
method public java.lang.CharSequence getOperatorAlphaShort();
|
||||
method public int getPci();
|
||||
method public int getTac();
|
||||
method public void writeToParcel(android.os.Parcel, int);
|
||||
@@ -39872,8 +39884,13 @@ package android.telephony {
|
||||
method public int describeContents();
|
||||
method public int getCid();
|
||||
method public int getLac();
|
||||
method public int getMcc();
|
||||
method public int getMnc();
|
||||
method public deprecated int getMcc();
|
||||
method public java.lang.String getMccStr();
|
||||
method public deprecated int getMnc();
|
||||
method public java.lang.String getMncStr();
|
||||
method public java.lang.String getMobileNetworkOperator();
|
||||
method public java.lang.CharSequence getOperatorAlphaLong();
|
||||
method public java.lang.CharSequence getOperatorAlphaShort();
|
||||
method public int getPsc();
|
||||
method public int getUarfcn();
|
||||
method public void writeToParcel(android.os.Parcel, int);
|
||||
|
||||
@@ -19,6 +19,7 @@ package android.telephony;
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
import android.telephony.Rlog;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
@@ -50,6 +51,10 @@ public final class CellIdentityCdma implements Parcelable {
|
||||
* to +90 degrees).
|
||||
*/
|
||||
private final int mLatitude;
|
||||
// long alpha Operator Name String or Enhanced Operator Name String
|
||||
private final String mAlphaLong;
|
||||
// short alpha Operator Name String or Enhanced Operator Name String
|
||||
private final String mAlphaShort;
|
||||
|
||||
/**
|
||||
* @hide
|
||||
@@ -60,6 +65,8 @@ public final class CellIdentityCdma implements Parcelable {
|
||||
mBasestationId = Integer.MAX_VALUE;
|
||||
mLongitude = Integer.MAX_VALUE;
|
||||
mLatitude = Integer.MAX_VALUE;
|
||||
mAlphaLong = null;
|
||||
mAlphaShort = null;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -75,19 +82,37 @@ public final class CellIdentityCdma implements Parcelable {
|
||||
* @hide
|
||||
*/
|
||||
public CellIdentityCdma (int nid, int sid, int bid, int lon, int lat) {
|
||||
this(nid, sid, bid, lon, lat, null, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* public constructor
|
||||
* @param nid Network Id 0..65535
|
||||
* @param sid CDMA System Id 0..32767
|
||||
* @param bid Base Station Id 0..65535
|
||||
* @param lon Longitude is a decimal number ranges from -2592000
|
||||
* to 2592000
|
||||
* @param lat Latitude is a decimal number ranges from -1296000
|
||||
* to 1296000
|
||||
* @param alphal long alpha Operator Name String or Enhanced Operator Name String
|
||||
* @param alphas short alpha Operator Name String or Enhanced Operator Name String
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
public CellIdentityCdma (int nid, int sid, int bid, int lon, int lat, String alphal,
|
||||
String alphas) {
|
||||
mNetworkId = nid;
|
||||
mSystemId = sid;
|
||||
mBasestationId = bid;
|
||||
mLongitude = lon;
|
||||
mLatitude = lat;
|
||||
mAlphaLong = alphal;
|
||||
mAlphaShort = alphas;
|
||||
}
|
||||
|
||||
private CellIdentityCdma(CellIdentityCdma cid) {
|
||||
mNetworkId = cid.mNetworkId;
|
||||
mSystemId = cid.mSystemId;
|
||||
mBasestationId = cid.mBasestationId;
|
||||
mLongitude = cid.mLongitude;
|
||||
mLatitude = cid.mLatitude;
|
||||
this(cid.mNetworkId, cid.mSystemId, cid.mBasestationId, cid.mLongitude, cid.mLatitude,
|
||||
cid.mAlphaLong, cid.mAlphaShort);
|
||||
}
|
||||
|
||||
CellIdentityCdma copy() {
|
||||
@@ -137,9 +162,26 @@ public final class CellIdentityCdma implements Parcelable {
|
||||
return mLatitude;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return The long alpha tag associated with the current scan result (may be the operator
|
||||
* name string or extended operator name string). May be null if unknown.
|
||||
*/
|
||||
public CharSequence getOperatorAlphaLong() {
|
||||
return mAlphaLong;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return The short alpha tag associated with the current scan result (may be the operator
|
||||
* name string or extended operator name string). May be null if unknown.
|
||||
*/
|
||||
public CharSequence getOperatorAlphaShort() {
|
||||
return mAlphaShort;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(mNetworkId, mSystemId, mBasestationId, mLatitude, mLongitude);
|
||||
return Objects.hash(mNetworkId, mSystemId, mBasestationId, mLatitude, mLongitude,
|
||||
mAlphaLong, mAlphaShort);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -153,11 +195,14 @@ public final class CellIdentityCdma implements Parcelable {
|
||||
}
|
||||
|
||||
CellIdentityCdma o = (CellIdentityCdma) other;
|
||||
|
||||
return mNetworkId == o.mNetworkId &&
|
||||
mSystemId == o.mSystemId &&
|
||||
mBasestationId == o.mBasestationId &&
|
||||
mLatitude == o.mLatitude &&
|
||||
mLongitude == o.mLongitude;
|
||||
mLongitude == o.mLongitude &&
|
||||
TextUtils.equals(mAlphaLong, o.mAlphaLong) &&
|
||||
TextUtils.equals(mAlphaShort, o.mAlphaShort);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -168,6 +213,8 @@ public final class CellIdentityCdma implements Parcelable {
|
||||
sb.append(" mBasestationId="); sb.append(mBasestationId);
|
||||
sb.append(" mLongitude="); sb.append(mLongitude);
|
||||
sb.append(" mLatitude="); sb.append(mLatitude);
|
||||
sb.append(" mAlphaLong="); sb.append(mAlphaLong);
|
||||
sb.append(" mAlphaShort="); sb.append(mAlphaShort);
|
||||
sb.append("}");
|
||||
|
||||
return sb.toString();
|
||||
@@ -188,15 +235,15 @@ public final class CellIdentityCdma implements Parcelable {
|
||||
dest.writeInt(mBasestationId);
|
||||
dest.writeInt(mLongitude);
|
||||
dest.writeInt(mLatitude);
|
||||
dest.writeString(mAlphaLong);
|
||||
dest.writeString(mAlphaShort);
|
||||
}
|
||||
|
||||
/** Construct from Parcel, type has already been processed */
|
||||
private CellIdentityCdma(Parcel in) {
|
||||
mNetworkId = in.readInt();
|
||||
mSystemId = in.readInt();
|
||||
mBasestationId = in.readInt();
|
||||
mLongitude = in.readInt();
|
||||
mLatitude = in.readInt();
|
||||
this(in.readInt(), in.readInt(), in.readInt(), in.readInt(), in.readInt(),
|
||||
in.readString(), in.readString());
|
||||
|
||||
if (DBG) log("CellIdentityCdma(Parcel): " + toString());
|
||||
}
|
||||
|
||||
|
||||
@@ -19,6 +19,7 @@ package android.telephony;
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
import android.telephony.Rlog;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
@@ -30,10 +31,6 @@ public final class CellIdentityGsm implements Parcelable {
|
||||
private static final String LOG_TAG = "CellIdentityGsm";
|
||||
private static final boolean DBG = false;
|
||||
|
||||
// 3-digit Mobile Country Code, 0..999
|
||||
private final int mMcc;
|
||||
// 2 or 3-digit Mobile Network Code, 0..999
|
||||
private final int mMnc;
|
||||
// 16-bit Location Area Code, 0..65535
|
||||
private final int mLac;
|
||||
// 16-bit GSM Cell Identity described in TS 27.007, 0..65535
|
||||
@@ -42,17 +39,27 @@ public final class CellIdentityGsm implements Parcelable {
|
||||
private final int mArfcn;
|
||||
// 6-bit Base Station Identity Code
|
||||
private final int mBsic;
|
||||
// 3-digit Mobile Country Code in string format
|
||||
private final String mMccStr;
|
||||
// 2 or 3-digit Mobile Network Code in string format
|
||||
private final String mMncStr;
|
||||
// long alpha Operator Name String or Enhanced Operator Name String
|
||||
private final String mAlphaLong;
|
||||
// short alpha Operator Name String or Enhanced Operator Name String
|
||||
private final String mAlphaShort;
|
||||
|
||||
/**
|
||||
* @hide
|
||||
*/
|
||||
public CellIdentityGsm() {
|
||||
mMcc = Integer.MAX_VALUE;
|
||||
mMnc = Integer.MAX_VALUE;
|
||||
mLac = Integer.MAX_VALUE;
|
||||
mCid = Integer.MAX_VALUE;
|
||||
mArfcn = Integer.MAX_VALUE;
|
||||
mBsic = Integer.MAX_VALUE;
|
||||
mMccStr = null;
|
||||
mMncStr = null;
|
||||
mAlphaLong = null;
|
||||
mAlphaShort = null;
|
||||
}
|
||||
/**
|
||||
* public constructor
|
||||
@@ -64,7 +71,8 @@ public final class CellIdentityGsm implements Parcelable {
|
||||
* @hide
|
||||
*/
|
||||
public CellIdentityGsm (int mcc, int mnc, int lac, int cid) {
|
||||
this(mcc, mnc, lac, cid, Integer.MAX_VALUE, Integer.MAX_VALUE);
|
||||
this(lac, cid, Integer.MAX_VALUE, Integer.MAX_VALUE,
|
||||
String.valueOf(mcc), String.valueOf(mnc), null, null);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -79,39 +87,81 @@ public final class CellIdentityGsm implements Parcelable {
|
||||
* @hide
|
||||
*/
|
||||
public CellIdentityGsm (int mcc, int mnc, int lac, int cid, int arfcn, int bsic) {
|
||||
mMcc = mcc;
|
||||
mMnc = mnc;
|
||||
this(lac, cid, arfcn, bsic, String.valueOf(mcc), String.valueOf(mnc), null, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* public constructor
|
||||
* @param lac 16-bit Location Area Code, 0..65535
|
||||
* @param cid 16-bit GSM Cell Identity or 28-bit UMTS Cell Identity
|
||||
* @param arfcn 16-bit GSM Absolute RF Channel Number
|
||||
* @param bsic 6-bit Base Station Identity Code
|
||||
* @param mccStr 3-digit Mobile Country Code in string format
|
||||
* @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
|
||||
*
|
||||
* @throws IllegalArgumentException if the input MCC is not a 3-digit code or the input MNC is
|
||||
* not a 2 or 3-digit code.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
public CellIdentityGsm (int lac, int cid, int arfcn, int bsic, String mccStr,
|
||||
String mncStr, String alphal, String alphas) {
|
||||
mLac = lac;
|
||||
mCid = cid;
|
||||
mArfcn = arfcn;
|
||||
mBsic = bsic;
|
||||
// In RIL BSIC is a UINT8, so 0xFF is the 'INVALID' designator
|
||||
// for inbound parcels
|
||||
mBsic = (bsic == 0xFF) ? Integer.MAX_VALUE : bsic;
|
||||
|
||||
if (mccStr == null || mccStr.matches("^[0-9]{3}$")) {
|
||||
mMccStr = mccStr;
|
||||
} else if (mccStr.isEmpty()) {
|
||||
// If the mccStr parsed from Parcel is empty, set it as null.
|
||||
mMccStr = null;
|
||||
} else {
|
||||
throw new IllegalArgumentException("invalid MCC format");
|
||||
}
|
||||
|
||||
if (mncStr == null || mncStr.matches("^[0-9]{2,3}$")) {
|
||||
mMncStr = mncStr;
|
||||
} else if (mncStr.isEmpty()) {
|
||||
// If the mncStr parsed from Parcel is empty, set it as null.
|
||||
mMncStr = null;
|
||||
} else {
|
||||
throw new IllegalArgumentException("invalid MNC format");
|
||||
}
|
||||
|
||||
mAlphaLong = alphal;
|
||||
mAlphaShort = alphas;
|
||||
}
|
||||
|
||||
private CellIdentityGsm(CellIdentityGsm cid) {
|
||||
mMcc = cid.mMcc;
|
||||
mMnc = cid.mMnc;
|
||||
mLac = cid.mLac;
|
||||
mCid = cid.mCid;
|
||||
mArfcn = cid.mArfcn;
|
||||
mBsic = cid.mBsic;
|
||||
this(cid.mLac, cid.mCid, cid.mArfcn, cid.mBsic, cid.mMccStr,
|
||||
cid.mMncStr, cid.mAlphaLong, cid.mAlphaShort);
|
||||
}
|
||||
|
||||
CellIdentityGsm copy() {
|
||||
return new CellIdentityGsm(this);
|
||||
return new CellIdentityGsm(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return 3-digit Mobile Country Code, 0..999, Integer.MAX_VALUE if unknown
|
||||
* @deprecated Use {@link #getMccStr} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
public int getMcc() {
|
||||
return mMcc;
|
||||
return (mMccStr != null) ? Integer.valueOf(mMccStr) : Integer.MAX_VALUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return 2 or 3-digit Mobile Network Code, 0..999, Integer.MAX_VALUE if unknown
|
||||
* @deprecated Use {@link #getMncStr} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
public int getMnc() {
|
||||
return mMnc;
|
||||
return (mMncStr != null) ? Integer.valueOf(mMncStr) : Integer.MAX_VALUE;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -144,6 +194,43 @@ public final class CellIdentityGsm implements Parcelable {
|
||||
return mBsic;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return a 5 or 6 character string (MCC+MNC), null if any field is unknown
|
||||
*/
|
||||
public String getMobileNetworkOperator() {
|
||||
return (mMncStr == null || mMncStr == null) ? null : mMccStr + mMncStr;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Mobile Country Code in string format, null if unknown
|
||||
*/
|
||||
public String getMccStr() {
|
||||
return mMccStr;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Mobile Network Code in string format, null if unknown
|
||||
*/
|
||||
public String getMncStr() {
|
||||
return mMncStr;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return The long alpha tag associated with the current scan result (may be the operator
|
||||
* name string or extended operator name string). May be null if unknown.
|
||||
*/
|
||||
public CharSequence getOperatorAlphaLong() {
|
||||
return mAlphaLong;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return The short alpha tag associated with the current scan result (may be the operator
|
||||
* name string or extended operator name string). May be null if unknown.
|
||||
*/
|
||||
public CharSequence getOperatorAlphaShort() {
|
||||
return mAlphaShort;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return Integer.MAX_VALUE, undefined for GSM
|
||||
@@ -155,7 +242,7 @@ public final class CellIdentityGsm implements Parcelable {
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(mMcc, mMnc, mLac, mCid);
|
||||
return Objects.hash(mMccStr, mMncStr, mLac, mCid, mAlphaLong, mAlphaShort);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -169,23 +256,27 @@ public final class CellIdentityGsm implements Parcelable {
|
||||
}
|
||||
|
||||
CellIdentityGsm o = (CellIdentityGsm) other;
|
||||
return mMcc == o.mMcc &&
|
||||
mMnc == o.mMnc &&
|
||||
mLac == o.mLac &&
|
||||
return mLac == o.mLac &&
|
||||
mCid == o.mCid &&
|
||||
mArfcn == o.mArfcn &&
|
||||
mBsic == o.mBsic;
|
||||
mBsic == o.mBsic &&
|
||||
TextUtils.equals(mMccStr, o.mMccStr) &&
|
||||
TextUtils.equals(mMncStr, o.mMncStr) &&
|
||||
TextUtils.equals(mAlphaLong, o.mAlphaLong) &&
|
||||
TextUtils.equals(mAlphaShort, o.mAlphaShort);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder("CellIdentityGsm:{");
|
||||
sb.append(" mMcc=").append(mMcc);
|
||||
sb.append(" mMnc=").append(mMnc);
|
||||
sb.append(" mLac=").append(mLac);
|
||||
sb.append(" mCid=").append(mCid);
|
||||
sb.append(" mArfcn=").append(mArfcn);
|
||||
sb.append(" mBsic=").append("0x").append(Integer.toHexString(mBsic));
|
||||
sb.append(" mMcc=").append(mMccStr);
|
||||
sb.append(" mMnc=").append(mMncStr);
|
||||
sb.append(" mAlphaLong=").append(mAlphaLong);
|
||||
sb.append(" mAlphaShort=").append(mAlphaShort);
|
||||
sb.append("}");
|
||||
|
||||
return sb.toString();
|
||||
@@ -201,26 +292,20 @@ public final class CellIdentityGsm implements Parcelable {
|
||||
@Override
|
||||
public void writeToParcel(Parcel dest, int flags) {
|
||||
if (DBG) log("writeToParcel(Parcel, int): " + toString());
|
||||
dest.writeInt(mMcc);
|
||||
dest.writeInt(mMnc);
|
||||
dest.writeInt(mLac);
|
||||
dest.writeInt(mCid);
|
||||
dest.writeInt(mArfcn);
|
||||
dest.writeInt(mBsic);
|
||||
dest.writeString(mMccStr);
|
||||
dest.writeString(mMncStr);
|
||||
dest.writeString(mAlphaLong);
|
||||
dest.writeString(mAlphaShort);
|
||||
}
|
||||
|
||||
/** Construct from Parcel, type has already been processed */
|
||||
private CellIdentityGsm(Parcel in) {
|
||||
mMcc = in.readInt();
|
||||
mMnc = in.readInt();
|
||||
mLac = in.readInt();
|
||||
mCid = in.readInt();
|
||||
mArfcn = in.readInt();
|
||||
int bsic = in.readInt();
|
||||
// In RIL BSIC is a UINT8, so 0xFF is the 'INVALID' designator
|
||||
// for inbound parcels
|
||||
if (bsic == 0xFF) bsic = Integer.MAX_VALUE;
|
||||
mBsic = bsic;
|
||||
this(in.readInt(), in.readInt(), in.readInt(), in.readInt(), in.readString(),
|
||||
in.readString(), in.readString(), in.readString());
|
||||
|
||||
if (DBG) log("CellIdentityGsm(Parcel): " + toString());
|
||||
}
|
||||
@@ -229,16 +314,16 @@ public final class CellIdentityGsm implements Parcelable {
|
||||
@SuppressWarnings("hiding")
|
||||
public static final Creator<CellIdentityGsm> CREATOR =
|
||||
new Creator<CellIdentityGsm>() {
|
||||
@Override
|
||||
public CellIdentityGsm createFromParcel(Parcel in) {
|
||||
return new CellIdentityGsm(in);
|
||||
}
|
||||
@Override
|
||||
public CellIdentityGsm createFromParcel(Parcel in) {
|
||||
return new CellIdentityGsm(in);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CellIdentityGsm[] newArray(int size) {
|
||||
return new CellIdentityGsm[size];
|
||||
}
|
||||
};
|
||||
@Override
|
||||
public CellIdentityGsm[] newArray(int size) {
|
||||
return new CellIdentityGsm[size];
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* log
|
||||
@@ -246,4 +331,4 @@ public final class CellIdentityGsm implements Parcelable {
|
||||
private static void log(String s) {
|
||||
Rlog.w(LOG_TAG, s);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -19,6 +19,7 @@ package android.telephony;
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
import android.telephony.Rlog;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
@@ -30,10 +31,6 @@ public final class CellIdentityLte implements Parcelable {
|
||||
private static final String LOG_TAG = "CellIdentityLte";
|
||||
private static final boolean DBG = false;
|
||||
|
||||
// 3-digit Mobile Country Code, 0..999
|
||||
private final int mMcc;
|
||||
// 2 or 3-digit Mobile Network Code, 0..999
|
||||
private final int mMnc;
|
||||
// 28-bit cell identity
|
||||
private final int mCi;
|
||||
// physical cell id 0..503
|
||||
@@ -42,17 +39,27 @@ public final class CellIdentityLte implements Parcelable {
|
||||
private final int mTac;
|
||||
// 18-bit Absolute RF Channel Number
|
||||
private final int mEarfcn;
|
||||
// 3-digit Mobile Country Code in string format
|
||||
private final String mMccStr;
|
||||
// 2 or 3-digit Mobile Network Code in string format
|
||||
private final String mMncStr;
|
||||
// long alpha Operator Name String or Enhanced Operator Name String
|
||||
private final String mAlphaLong;
|
||||
// short alpha Operator Name String or Enhanced Operator Name String
|
||||
private final String mAlphaShort;
|
||||
|
||||
/**
|
||||
* @hide
|
||||
*/
|
||||
public CellIdentityLte() {
|
||||
mMcc = Integer.MAX_VALUE;
|
||||
mMnc = Integer.MAX_VALUE;
|
||||
mCi = Integer.MAX_VALUE;
|
||||
mPci = Integer.MAX_VALUE;
|
||||
mTac = Integer.MAX_VALUE;
|
||||
mEarfcn = Integer.MAX_VALUE;
|
||||
mMccStr = null;
|
||||
mMncStr = null;
|
||||
mAlphaLong = null;
|
||||
mAlphaShort = null;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -66,7 +73,7 @@ public final class CellIdentityLte implements Parcelable {
|
||||
* @hide
|
||||
*/
|
||||
public CellIdentityLte (int mcc, int mnc, int ci, int pci, int tac) {
|
||||
this(mcc, mnc, ci, pci, tac, Integer.MAX_VALUE);
|
||||
this(ci, pci, tac, Integer.MAX_VALUE, String.valueOf(mcc), String.valueOf(mnc), null, null);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -81,21 +88,57 @@ public final class CellIdentityLte implements Parcelable {
|
||||
* @hide
|
||||
*/
|
||||
public CellIdentityLte (int mcc, int mnc, int ci, int pci, int tac, int earfcn) {
|
||||
mMcc = mcc;
|
||||
mMnc = mnc;
|
||||
this(ci, pci, tac, earfcn, String.valueOf(mcc), String.valueOf(mnc), null, null);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param ci 28-bit Cell Identity
|
||||
* @param pci Physical Cell Id 0..503
|
||||
* @param tac 16-bit Tracking Area Code
|
||||
* @param earfcn 18-bit LTE Absolute RF Channel Number
|
||||
* @param mccStr 3-digit Mobile Country Code in string format
|
||||
* @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
|
||||
*
|
||||
* @throws IllegalArgumentException if the input MCC is not a 3-digit code or the input MNC is
|
||||
* not a 2 or 3-digit code.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
public CellIdentityLte (int ci, int pci, int tac, int earfcn, String mccStr,
|
||||
String mncStr, String alphal, String alphas) {
|
||||
mCi = ci;
|
||||
mPci = pci;
|
||||
mTac = tac;
|
||||
mEarfcn = earfcn;
|
||||
|
||||
if (mccStr == null || mccStr.matches("^[0-9]{3}$")) {
|
||||
mMccStr = mccStr;
|
||||
} else if (mccStr.isEmpty()) {
|
||||
// If the mccStr parsed from Parcel is empty, set it as null.
|
||||
mMccStr = null;
|
||||
} else {
|
||||
throw new IllegalArgumentException("invalid MCC format");
|
||||
}
|
||||
|
||||
if (mncStr == null || mncStr.matches("^[0-9]{2,3}$")) {
|
||||
mMncStr = mncStr;
|
||||
} else if (mncStr.isEmpty()) {
|
||||
// If the mncStr parsed from Parcel is empty, set it as null.
|
||||
mMncStr = null;
|
||||
} else {
|
||||
throw new IllegalArgumentException("invalid MNC format");
|
||||
}
|
||||
|
||||
mAlphaLong = alphal;
|
||||
mAlphaShort = alphas;
|
||||
}
|
||||
|
||||
private CellIdentityLte(CellIdentityLte cid) {
|
||||
mMcc = cid.mMcc;
|
||||
mMnc = cid.mMnc;
|
||||
mCi = cid.mCi;
|
||||
mPci = cid.mPci;
|
||||
mTac = cid.mTac;
|
||||
mEarfcn = cid.mEarfcn;
|
||||
this(cid.mCi, cid.mPci, cid.mTac, cid.mEarfcn, cid.mMccStr,
|
||||
cid.mMncStr, cid.mAlphaLong, cid.mAlphaShort);
|
||||
}
|
||||
|
||||
CellIdentityLte copy() {
|
||||
@@ -104,16 +147,20 @@ public final class CellIdentityLte implements Parcelable {
|
||||
|
||||
/**
|
||||
* @return 3-digit Mobile Country Code, 0..999, Integer.MAX_VALUE if unknown
|
||||
* @deprecated Use {@link #getMccStr} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
public int getMcc() {
|
||||
return mMcc;
|
||||
return (mMccStr != null) ? Integer.valueOf(mMccStr) : Integer.MAX_VALUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return 2 or 3-digit Mobile Network Code, 0..999, Integer.MAX_VALUE if unknown
|
||||
* @deprecated Use {@link #getMncStr} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
public int getMnc() {
|
||||
return mMnc;
|
||||
return (mMncStr != null) ? Integer.valueOf(mMncStr) : Integer.MAX_VALUE;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -144,9 +191,46 @@ public final class CellIdentityLte implements Parcelable {
|
||||
return mEarfcn;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Mobile Country Code in string format, null if unknown
|
||||
*/
|
||||
public String getMccStr() {
|
||||
return mMccStr;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Mobile Network Code in string format, null if unknown
|
||||
*/
|
||||
public String getMncStr() {
|
||||
return mMncStr;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return a 5 or 6 character string (MCC+MNC), null if any field is unknown
|
||||
*/
|
||||
public String getMobileNetworkOperator() {
|
||||
return (mMncStr == null || mMncStr == null) ? null : mMccStr + mMncStr;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return The long alpha tag associated with the current scan result (may be the operator
|
||||
* name string or extended operator name string). May be null if unknown.
|
||||
*/
|
||||
public CharSequence getOperatorAlphaLong() {
|
||||
return mAlphaLong;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return The short alpha tag associated with the current scan result (may be the operator
|
||||
* name string or extended operator name string). May be null if unknown.
|
||||
*/
|
||||
public CharSequence getOperatorAlphaShort() {
|
||||
return mAlphaShort;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(mMcc, mMnc, mCi, mPci, mTac);
|
||||
return Objects.hash(mMccStr, mMncStr, mCi, mPci, mTac, mAlphaLong, mAlphaShort);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -160,23 +244,27 @@ public final class CellIdentityLte implements Parcelable {
|
||||
}
|
||||
|
||||
CellIdentityLte o = (CellIdentityLte) other;
|
||||
return mMcc == o.mMcc &&
|
||||
mMnc == o.mMnc &&
|
||||
mCi == o.mCi &&
|
||||
return mCi == o.mCi &&
|
||||
mPci == o.mPci &&
|
||||
mTac == o.mTac &&
|
||||
mEarfcn == o.mEarfcn;
|
||||
mEarfcn == o.mEarfcn &&
|
||||
TextUtils.equals(mMccStr, o.mMccStr) &&
|
||||
TextUtils.equals(mMncStr, o.mMncStr) &&
|
||||
TextUtils.equals(mAlphaLong, o.mAlphaLong) &&
|
||||
TextUtils.equals(mAlphaShort, o.mAlphaShort);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder("CellIdentityLte:{");
|
||||
sb.append(" mMcc="); sb.append(mMcc);
|
||||
sb.append(" mMnc="); sb.append(mMnc);
|
||||
sb.append(" mCi="); sb.append(mCi);
|
||||
sb.append(" mPci="); sb.append(mPci);
|
||||
sb.append(" mTac="); sb.append(mTac);
|
||||
sb.append(" mEarfcn="); sb.append(mEarfcn);
|
||||
sb.append(" mMcc="); sb.append(mMccStr);
|
||||
sb.append(" mMnc="); sb.append(mMncStr);
|
||||
sb.append(" mAlphaLong="); sb.append(mAlphaLong);
|
||||
sb.append(" mAlphaShort="); sb.append(mAlphaShort);
|
||||
sb.append("}");
|
||||
|
||||
return sb.toString();
|
||||
@@ -192,22 +280,21 @@ public final class CellIdentityLte implements Parcelable {
|
||||
@Override
|
||||
public void writeToParcel(Parcel dest, int flags) {
|
||||
if (DBG) log("writeToParcel(Parcel, int): " + toString());
|
||||
dest.writeInt(mMcc);
|
||||
dest.writeInt(mMnc);
|
||||
dest.writeInt(mCi);
|
||||
dest.writeInt(mPci);
|
||||
dest.writeInt(mTac);
|
||||
dest.writeInt(mEarfcn);
|
||||
dest.writeString(mMccStr);
|
||||
dest.writeString(mMncStr);
|
||||
dest.writeString(mAlphaLong);
|
||||
dest.writeString(mAlphaShort);
|
||||
}
|
||||
|
||||
/** Construct from Parcel, type has already been processed */
|
||||
private CellIdentityLte(Parcel in) {
|
||||
mMcc = in.readInt();
|
||||
mMnc = in.readInt();
|
||||
mCi = in.readInt();
|
||||
mPci = in.readInt();
|
||||
mTac = in.readInt();
|
||||
mEarfcn = in.readInt();
|
||||
this(in.readInt(), in.readInt(), in.readInt(), in.readInt(), in.readString(),
|
||||
in.readString(), in.readString(), in.readString());
|
||||
|
||||
if (DBG) log("CellIdentityLte(Parcel): " + toString());
|
||||
}
|
||||
|
||||
@@ -215,16 +302,16 @@ public final class CellIdentityLte implements Parcelable {
|
||||
@SuppressWarnings("hiding")
|
||||
public static final Creator<CellIdentityLte> CREATOR =
|
||||
new Creator<CellIdentityLte>() {
|
||||
@Override
|
||||
public CellIdentityLte createFromParcel(Parcel in) {
|
||||
return new CellIdentityLte(in);
|
||||
}
|
||||
@Override
|
||||
public CellIdentityLte createFromParcel(Parcel in) {
|
||||
return new CellIdentityLte(in);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CellIdentityLte[] newArray(int size) {
|
||||
return new CellIdentityLte[size];
|
||||
}
|
||||
};
|
||||
@Override
|
||||
public CellIdentityLte[] newArray(int size) {
|
||||
return new CellIdentityLte[size];
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* log
|
||||
@@ -232,4 +319,4 @@ public final class CellIdentityLte implements Parcelable {
|
||||
private static void log(String s) {
|
||||
Rlog.w(LOG_TAG, s);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -19,6 +19,7 @@ package android.telephony;
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
import android.telephony.Rlog;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
@@ -30,10 +31,6 @@ public final class CellIdentityWcdma implements Parcelable {
|
||||
private static final String LOG_TAG = "CellIdentityWcdma";
|
||||
private static final boolean DBG = false;
|
||||
|
||||
// 3-digit Mobile Country Code, 0..999
|
||||
private final int mMcc;
|
||||
// 2 or 3-digit Mobile Network Code, 0..999
|
||||
private final int mMnc;
|
||||
// 16-bit Location Area Code, 0..65535
|
||||
private final int mLac;
|
||||
// 28-bit UMTS Cell Identity described in TS 25.331, 0..268435455
|
||||
@@ -42,17 +39,27 @@ public final class CellIdentityWcdma implements Parcelable {
|
||||
private final int mPsc;
|
||||
// 16-bit UMTS Absolute RF Channel Number
|
||||
private final int mUarfcn;
|
||||
// 3-digit Mobile Country Code in string format
|
||||
private final String mMccStr;
|
||||
// 2 or 3-digit Mobile Network Code in string format
|
||||
private final String mMncStr;
|
||||
// long alpha Operator Name String or Enhanced Operator Name String
|
||||
private final String mAlphaLong;
|
||||
// short alpha Operator Name String or Enhanced Operator Name String
|
||||
private final String mAlphaShort;
|
||||
|
||||
/**
|
||||
* @hide
|
||||
*/
|
||||
public CellIdentityWcdma() {
|
||||
mMcc = Integer.MAX_VALUE;
|
||||
mMnc = Integer.MAX_VALUE;
|
||||
mLac = Integer.MAX_VALUE;
|
||||
mCid = Integer.MAX_VALUE;
|
||||
mPsc = Integer.MAX_VALUE;
|
||||
mUarfcn = Integer.MAX_VALUE;
|
||||
mMccStr = null;
|
||||
mMncStr = null;
|
||||
mAlphaLong = null;
|
||||
mAlphaShort = null;
|
||||
}
|
||||
/**
|
||||
* public constructor
|
||||
@@ -65,7 +72,8 @@ public final class CellIdentityWcdma implements Parcelable {
|
||||
* @hide
|
||||
*/
|
||||
public CellIdentityWcdma (int mcc, int mnc, int lac, int cid, int psc) {
|
||||
this(mcc, mnc, lac, cid, psc, Integer.MAX_VALUE);
|
||||
this(lac, cid, psc, Integer.MAX_VALUE, String.valueOf(mcc), String.valueOf(mnc),
|
||||
null, null);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -80,39 +88,79 @@ public final class CellIdentityWcdma implements Parcelable {
|
||||
* @hide
|
||||
*/
|
||||
public CellIdentityWcdma (int mcc, int mnc, int lac, int cid, int psc, int uarfcn) {
|
||||
mMcc = mcc;
|
||||
mMnc = mnc;
|
||||
this(lac, cid, psc, uarfcn, String.valueOf(mcc), String.valueOf(mnc), null, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* public constructor
|
||||
* @param lac 16-bit Location Area Code, 0..65535
|
||||
* @param cid 28-bit UMTS Cell Identity
|
||||
* @param psc 9-bit UMTS Primary Scrambling Code
|
||||
* @param uarfcn 16-bit UMTS Absolute RF Channel Number
|
||||
* @param mccStr 3-digit Mobile Country Code in string format
|
||||
* @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
|
||||
*
|
||||
* @throws IllegalArgumentException if the input MCC is not a 3-digit code or the input MNC is
|
||||
* not a 2 or 3-digit code.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
public CellIdentityWcdma (int lac, int cid, int psc, int uarfcn,
|
||||
String mccStr, String mncStr, String alphal, String alphas) {
|
||||
mLac = lac;
|
||||
mCid = cid;
|
||||
mPsc = psc;
|
||||
mUarfcn = uarfcn;
|
||||
|
||||
if (mccStr == null || mccStr.matches("^[0-9]{3}$")) {
|
||||
mMccStr = mccStr;
|
||||
} else if (mccStr.isEmpty()) {
|
||||
// If the mccStr parsed from Parcel is empty, set it as null.
|
||||
mMccStr = null;
|
||||
} else {
|
||||
throw new IllegalArgumentException("invalid MCC format");
|
||||
}
|
||||
|
||||
if (mncStr == null || mncStr.matches("^[0-9]{2,3}$")) {
|
||||
mMncStr = mncStr;
|
||||
} else if (mncStr.isEmpty()) {
|
||||
// If the mncStr parsed from Parcel is empty, set it as null.
|
||||
mMncStr = null;
|
||||
} else {
|
||||
throw new IllegalArgumentException("invalid MNC format");
|
||||
}
|
||||
|
||||
mAlphaLong = alphal;
|
||||
mAlphaShort = alphas;
|
||||
}
|
||||
|
||||
private CellIdentityWcdma(CellIdentityWcdma cid) {
|
||||
mMcc = cid.mMcc;
|
||||
mMnc = cid.mMnc;
|
||||
mLac = cid.mLac;
|
||||
mCid = cid.mCid;
|
||||
mPsc = cid.mPsc;
|
||||
mUarfcn = cid.mUarfcn;
|
||||
this(cid.mLac, cid.mCid, cid.mPsc, cid.mUarfcn, cid.mMccStr,
|
||||
cid.mMncStr, cid.mAlphaLong, cid.mAlphaShort);
|
||||
}
|
||||
|
||||
CellIdentityWcdma copy() {
|
||||
return new CellIdentityWcdma(this);
|
||||
return new CellIdentityWcdma(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return 3-digit Mobile Country Code, 0..999, Integer.MAX_VALUE if unknown
|
||||
* @deprecated Use {@link #getMccStr} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
public int getMcc() {
|
||||
return mMcc;
|
||||
return (mMccStr != null) ? Integer.valueOf(mMccStr) : Integer.MAX_VALUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return 2 or 3-digit Mobile Network Code, 0..999, Integer.MAX_VALUE if unknown
|
||||
* @deprecated Use {@link #getMncStr} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
public int getMnc() {
|
||||
return mMnc;
|
||||
return (mMncStr != null) ? Integer.valueOf(mMncStr) : Integer.MAX_VALUE;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -138,9 +186,46 @@ public final class CellIdentityWcdma implements Parcelable {
|
||||
return mPsc;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Mobile Country Code in string version, null if unknown
|
||||
*/
|
||||
public String getMccStr() {
|
||||
return mMccStr;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Mobile Network Code in string version, null if unknown
|
||||
*/
|
||||
public String getMncStr() {
|
||||
return mMncStr;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return a 5 or 6 character string (MCC+MNC), null if any field is unknown
|
||||
*/
|
||||
public String getMobileNetworkOperator() {
|
||||
return (mMncStr == null || mMncStr == null) ? null : mMccStr + mMncStr;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return The long alpha tag associated with the current scan result (may be the operator
|
||||
* name string or extended operator name string). May be null if unknown.
|
||||
*/
|
||||
public CharSequence getOperatorAlphaLong() {
|
||||
return mAlphaLong;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return The short alpha tag associated with the current scan result (may be the operator
|
||||
* name string or extended operator name string). May be null if unknown.
|
||||
*/
|
||||
public CharSequence getOperatorAlphaShort() {
|
||||
return mAlphaShort;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(mMcc, mMnc, mLac, mCid, mPsc);
|
||||
return Objects.hash(mMccStr, mMncStr, mLac, mCid, mPsc, mAlphaLong, mAlphaShort);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -161,23 +246,27 @@ public final class CellIdentityWcdma implements Parcelable {
|
||||
}
|
||||
|
||||
CellIdentityWcdma o = (CellIdentityWcdma) other;
|
||||
return mMcc == o.mMcc &&
|
||||
mMnc == o.mMnc &&
|
||||
mLac == o.mLac &&
|
||||
return mLac == o.mLac &&
|
||||
mCid == o.mCid &&
|
||||
mPsc == o.mPsc &&
|
||||
mUarfcn == o.mUarfcn;
|
||||
mUarfcn == o.mUarfcn &&
|
||||
TextUtils.equals(mMccStr, o.mMccStr) &&
|
||||
TextUtils.equals(mMncStr, o.mMncStr) &&
|
||||
TextUtils.equals(mAlphaLong, o.mAlphaLong) &&
|
||||
TextUtils.equals(mAlphaShort, o.mAlphaShort);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder("CellIdentityWcdma:{");
|
||||
sb.append(" mMcc=").append(mMcc);
|
||||
sb.append(" mMnc=").append(mMnc);
|
||||
sb.append(" mLac=").append(mLac);
|
||||
sb.append(" mCid=").append(mCid);
|
||||
sb.append(" mPsc=").append(mPsc);
|
||||
sb.append(" mUarfcn=").append(mUarfcn);
|
||||
sb.append(" mMcc=").append(mMccStr);
|
||||
sb.append(" mMnc=").append(mMncStr);
|
||||
sb.append(" mAlphaLong=").append(mAlphaLong);
|
||||
sb.append(" mAlphaShort=").append(mAlphaShort);
|
||||
sb.append("}");
|
||||
|
||||
return sb.toString();
|
||||
@@ -193,22 +282,21 @@ public final class CellIdentityWcdma implements Parcelable {
|
||||
@Override
|
||||
public void writeToParcel(Parcel dest, int flags) {
|
||||
if (DBG) log("writeToParcel(Parcel, int): " + toString());
|
||||
dest.writeInt(mMcc);
|
||||
dest.writeInt(mMnc);
|
||||
dest.writeInt(mLac);
|
||||
dest.writeInt(mCid);
|
||||
dest.writeInt(mPsc);
|
||||
dest.writeInt(mUarfcn);
|
||||
dest.writeString(mMccStr);
|
||||
dest.writeString(mMncStr);
|
||||
dest.writeString(mAlphaLong);
|
||||
dest.writeString(mAlphaShort);
|
||||
}
|
||||
|
||||
/** Construct from Parcel, type has already been processed */
|
||||
private CellIdentityWcdma(Parcel in) {
|
||||
mMcc = in.readInt();
|
||||
mMnc = in.readInt();
|
||||
mLac = in.readInt();
|
||||
mCid = in.readInt();
|
||||
mPsc = in.readInt();
|
||||
mUarfcn = in.readInt();
|
||||
this(in.readInt(), in.readInt(), in.readInt(), in.readInt(), in.readString(),
|
||||
in.readString(), in.readString(), in.readString());
|
||||
|
||||
if (DBG) log("CellIdentityWcdma(Parcel): " + toString());
|
||||
}
|
||||
|
||||
@@ -216,16 +304,16 @@ public final class CellIdentityWcdma implements Parcelable {
|
||||
@SuppressWarnings("hiding")
|
||||
public static final Creator<CellIdentityWcdma> CREATOR =
|
||||
new Creator<CellIdentityWcdma>() {
|
||||
@Override
|
||||
public CellIdentityWcdma createFromParcel(Parcel in) {
|
||||
return new CellIdentityWcdma(in);
|
||||
}
|
||||
@Override
|
||||
public CellIdentityWcdma createFromParcel(Parcel in) {
|
||||
return new CellIdentityWcdma(in);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CellIdentityWcdma[] newArray(int size) {
|
||||
return new CellIdentityWcdma[size];
|
||||
}
|
||||
};
|
||||
@Override
|
||||
public CellIdentityWcdma[] newArray(int size) {
|
||||
return new CellIdentityWcdma[size];
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* log
|
||||
@@ -233,4 +321,4 @@ public final class CellIdentityWcdma implements Parcelable {
|
||||
private static void log(String s) {
|
||||
Rlog.w(LOG_TAG, s);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user