Merge "Added Cell identity for TD-SCDMA and a base class CellIdentity" am: 5e90553bcf
am: 18bd9922fb
Change-Id: Ic5802a6f39715f042d18bb25dd3481c4c79b508f
This commit is contained in:
@@ -40093,8 +40093,13 @@ package android.telephony {
|
|||||||
field public static final java.lang.String KEY_WORLD_PHONE_BOOL = "world_phone_bool";
|
field public static final java.lang.String KEY_WORLD_PHONE_BOOL = "world_phone_bool";
|
||||||
}
|
}
|
||||||
|
|
||||||
public final class CellIdentityCdma implements android.os.Parcelable {
|
public abstract class CellIdentity implements android.os.Parcelable {
|
||||||
method public int describeContents();
|
method public int describeContents();
|
||||||
|
method public void writeToParcel(android.os.Parcel, int);
|
||||||
|
field public static final android.os.Parcelable.Creator<android.telephony.CellIdentity> CREATOR;
|
||||||
|
}
|
||||||
|
|
||||||
|
public final class CellIdentityCdma extends android.telephony.CellIdentity {
|
||||||
method public int getBasestationId();
|
method public int getBasestationId();
|
||||||
method public int getLatitude();
|
method public int getLatitude();
|
||||||
method public int getLongitude();
|
method public int getLongitude();
|
||||||
@@ -40106,8 +40111,7 @@ package android.telephony {
|
|||||||
field public static final android.os.Parcelable.Creator<android.telephony.CellIdentityCdma> CREATOR;
|
field public static final android.os.Parcelable.Creator<android.telephony.CellIdentityCdma> CREATOR;
|
||||||
}
|
}
|
||||||
|
|
||||||
public final class CellIdentityGsm implements android.os.Parcelable {
|
public final class CellIdentityGsm extends android.telephony.CellIdentity {
|
||||||
method public int describeContents();
|
|
||||||
method public int getArfcn();
|
method public int getArfcn();
|
||||||
method public int getBsic();
|
method public int getBsic();
|
||||||
method public int getCid();
|
method public int getCid();
|
||||||
@@ -40124,8 +40128,7 @@ package android.telephony {
|
|||||||
field public static final android.os.Parcelable.Creator<android.telephony.CellIdentityGsm> CREATOR;
|
field public static final android.os.Parcelable.Creator<android.telephony.CellIdentityGsm> CREATOR;
|
||||||
}
|
}
|
||||||
|
|
||||||
public final class CellIdentityLte implements android.os.Parcelable {
|
public final class CellIdentityLte extends android.telephony.CellIdentity {
|
||||||
method public int describeContents();
|
|
||||||
method public int getCi();
|
method public int getCi();
|
||||||
method public int getEarfcn();
|
method public int getEarfcn();
|
||||||
method public deprecated int getMcc();
|
method public deprecated int getMcc();
|
||||||
@@ -40141,8 +40144,17 @@ package android.telephony {
|
|||||||
field public static final android.os.Parcelable.Creator<android.telephony.CellIdentityLte> CREATOR;
|
field public static final android.os.Parcelable.Creator<android.telephony.CellIdentityLte> CREATOR;
|
||||||
}
|
}
|
||||||
|
|
||||||
public final class CellIdentityWcdma implements android.os.Parcelable {
|
public final class CellIdentityTdscdma extends android.telephony.CellIdentity {
|
||||||
method public int describeContents();
|
method public int getCid();
|
||||||
|
method public int getCpid();
|
||||||
|
method public int getLac();
|
||||||
|
method public java.lang.String getMccStr();
|
||||||
|
method public java.lang.String getMncStr();
|
||||||
|
method public void writeToParcel(android.os.Parcel, int);
|
||||||
|
field public static final android.os.Parcelable.Creator<android.telephony.CellIdentityTdscdma> CREATOR;
|
||||||
|
}
|
||||||
|
|
||||||
|
public final class CellIdentityWcdma extends android.telephony.CellIdentity {
|
||||||
method public int getCid();
|
method public int getCid();
|
||||||
method public int getLac();
|
method public int getLac();
|
||||||
method public deprecated int getMcc();
|
method public deprecated int getMcc();
|
||||||
|
|||||||
20
telephony/java/android/telephony/CellIdentity.aidl
Normal file
20
telephony/java/android/telephony/CellIdentity.aidl
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2017 The Android Open Source Project
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** @hide */
|
||||||
|
package android.telephony;
|
||||||
|
|
||||||
|
parcelable CellIdentity;
|
||||||
173
telephony/java/android/telephony/CellIdentity.java
Normal file
173
telephony/java/android/telephony/CellIdentity.java
Normal file
@@ -0,0 +1,173 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2017 The Android Open Source Project
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package android.telephony;
|
||||||
|
|
||||||
|
import android.annotation.CallSuper;
|
||||||
|
import android.annotation.IntDef;
|
||||||
|
import android.os.Parcel;
|
||||||
|
import android.os.Parcelable;
|
||||||
|
|
||||||
|
import java.lang.annotation.Retention;
|
||||||
|
import java.lang.annotation.RetentionPolicy;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* CellIdentity represents the identity of a unique cell. This is the base class for
|
||||||
|
* CellIdentityXxx which represents cell identity for specific network access technology.
|
||||||
|
*/
|
||||||
|
public abstract class CellIdentity implements Parcelable {
|
||||||
|
/**
|
||||||
|
* Cell identity type
|
||||||
|
* @hide
|
||||||
|
*/
|
||||||
|
@Retention(RetentionPolicy.SOURCE)
|
||||||
|
@IntDef(prefix = "TYPE_", value = {TYPE_GSM, TYPE_CDMA, TYPE_LTE, TYPE_WCDMA, TYPE_TDSCDMA})
|
||||||
|
public @interface Type {}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Unknown cell identity type
|
||||||
|
* @hide
|
||||||
|
*/
|
||||||
|
public static final int TYPE_UNKNOWN = 0;
|
||||||
|
/**
|
||||||
|
* GSM cell identity type
|
||||||
|
* @hide
|
||||||
|
*/
|
||||||
|
public static final int TYPE_GSM = 1;
|
||||||
|
/**
|
||||||
|
* CDMA cell identity type
|
||||||
|
* @hide
|
||||||
|
*/
|
||||||
|
public static final int TYPE_CDMA = 2;
|
||||||
|
/**
|
||||||
|
* LTE cell identity type
|
||||||
|
* @hide
|
||||||
|
*/
|
||||||
|
public static final int TYPE_LTE = 3;
|
||||||
|
/**
|
||||||
|
* WCDMA cell identity type
|
||||||
|
* @hide
|
||||||
|
*/
|
||||||
|
public static final int TYPE_WCDMA = 4;
|
||||||
|
/**
|
||||||
|
* TDS-CDMA cell identity type
|
||||||
|
* @hide
|
||||||
|
*/
|
||||||
|
public static final int TYPE_TDSCDMA = 5;
|
||||||
|
|
||||||
|
// Log tag
|
||||||
|
/** @hide */
|
||||||
|
protected final String mTag;
|
||||||
|
// Cell identity type
|
||||||
|
/** @hide */
|
||||||
|
protected final int mType;
|
||||||
|
// 3-digit Mobile Country Code in string format. Null for CDMA cell identity.
|
||||||
|
/** @hide */
|
||||||
|
protected final String mMccStr;
|
||||||
|
// 2 or 3-digit Mobile Network Code in string format. Null for CDMA cell identity.
|
||||||
|
/** @hide */
|
||||||
|
protected final String mMncStr;
|
||||||
|
|
||||||
|
/** @hide */
|
||||||
|
protected CellIdentity(String tag, int type, String mcc, String mnc) {
|
||||||
|
mTag = tag;
|
||||||
|
mType = type;
|
||||||
|
|
||||||
|
// Only allow INT_MAX if unknown string mcc/mnc
|
||||||
|
if (mcc == null || mcc.matches("^[0-9]{3}$")) {
|
||||||
|
mMccStr = mcc;
|
||||||
|
} else if (mcc.isEmpty() || mcc.equals(String.valueOf(Integer.MAX_VALUE))) {
|
||||||
|
// If the mccStr is empty or unknown, set it as null.
|
||||||
|
mMccStr = null;
|
||||||
|
} else {
|
||||||
|
// TODO: b/69384059 Should throw IllegalArgumentException for the invalid MCC format
|
||||||
|
// after the bug got fixed.
|
||||||
|
mMccStr = null;
|
||||||
|
log("invalid MCC format: " + mcc);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mnc == null || mnc.matches("^[0-9]{2,3}$")) {
|
||||||
|
mMncStr = mnc;
|
||||||
|
} else if (mnc.isEmpty() || mnc.equals(String.valueOf(Integer.MAX_VALUE))) {
|
||||||
|
// If the mncStr is empty or unknown, set it as null.
|
||||||
|
mMncStr = null;
|
||||||
|
} else {
|
||||||
|
// TODO: b/69384059 Should throw IllegalArgumentException for the invalid MNC format
|
||||||
|
// after the bug got fixed.
|
||||||
|
mMncStr = null;
|
||||||
|
log("invalid MNC format: " + mnc);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Implement the Parcelable interface */
|
||||||
|
@Override
|
||||||
|
public int describeContents() {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @hide
|
||||||
|
* @return The type of the cell identity
|
||||||
|
*/
|
||||||
|
public @Type int getType() { return mType; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Used by child classes for parceling.
|
||||||
|
*
|
||||||
|
* @hide
|
||||||
|
*/
|
||||||
|
@CallSuper
|
||||||
|
public void writeToParcel(Parcel dest, int type) {
|
||||||
|
dest.writeInt(type);
|
||||||
|
dest.writeString(mMccStr);
|
||||||
|
dest.writeString(mMncStr);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Construct from Parcel
|
||||||
|
* @hide
|
||||||
|
*/
|
||||||
|
protected CellIdentity(String tag, int type, Parcel source) {
|
||||||
|
this(tag, type, source.readString(), source.readString());
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Implement the Parcelable interface */
|
||||||
|
public static final Creator<CellIdentity> CREATOR =
|
||||||
|
new Creator<CellIdentity>() {
|
||||||
|
@Override
|
||||||
|
public CellIdentity createFromParcel(Parcel in) {
|
||||||
|
int type = in.readInt();
|
||||||
|
switch (type) {
|
||||||
|
case TYPE_GSM: return CellIdentityGsm.createFromParcelBody(in);
|
||||||
|
case TYPE_WCDMA: return CellIdentityWcdma.createFromParcelBody(in);
|
||||||
|
case TYPE_CDMA: return CellIdentityCdma.createFromParcelBody(in);
|
||||||
|
case TYPE_LTE: return CellIdentityLte.createFromParcelBody(in);
|
||||||
|
case TYPE_TDSCDMA: return CellIdentityTdscdma.createFromParcelBody(in);
|
||||||
|
default: throw new IllegalArgumentException("Bad Cell identity Parcel");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CellIdentity[] newArray(int size) {
|
||||||
|
return new CellIdentity[size];
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
/** @hide */
|
||||||
|
protected void log(String s) {
|
||||||
|
Rlog.w(mTag, s);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -17,8 +17,6 @@
|
|||||||
package android.telephony;
|
package android.telephony;
|
||||||
|
|
||||||
import android.os.Parcel;
|
import android.os.Parcel;
|
||||||
import android.os.Parcelable;
|
|
||||||
import android.telephony.Rlog;
|
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
|
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
@@ -26,9 +24,8 @@ import java.util.Objects;
|
|||||||
/**
|
/**
|
||||||
* CellIdentity is to represent a unique CDMA cell
|
* CellIdentity is to represent a unique CDMA cell
|
||||||
*/
|
*/
|
||||||
public final class CellIdentityCdma implements Parcelable {
|
public final class CellIdentityCdma extends CellIdentity {
|
||||||
|
private static final String TAG = CellIdentityCdma.class.getSimpleName();
|
||||||
private static final String LOG_TAG = "CellSignalStrengthCdma";
|
|
||||||
private static final boolean DBG = false;
|
private static final boolean DBG = false;
|
||||||
|
|
||||||
// Network Id 0..65535
|
// Network Id 0..65535
|
||||||
@@ -60,6 +57,7 @@ public final class CellIdentityCdma implements Parcelable {
|
|||||||
* @hide
|
* @hide
|
||||||
*/
|
*/
|
||||||
public CellIdentityCdma() {
|
public CellIdentityCdma() {
|
||||||
|
super(TAG, TYPE_CDMA, null, null);
|
||||||
mNetworkId = Integer.MAX_VALUE;
|
mNetworkId = Integer.MAX_VALUE;
|
||||||
mSystemId = Integer.MAX_VALUE;
|
mSystemId = Integer.MAX_VALUE;
|
||||||
mBasestationId = Integer.MAX_VALUE;
|
mBasestationId = Integer.MAX_VALUE;
|
||||||
@@ -81,7 +79,7 @@ public final class CellIdentityCdma implements Parcelable {
|
|||||||
*
|
*
|
||||||
* @hide
|
* @hide
|
||||||
*/
|
*/
|
||||||
public CellIdentityCdma (int nid, int sid, int bid, int lon, int lat) {
|
public CellIdentityCdma(int nid, int sid, int bid, int lon, int lat) {
|
||||||
this(nid, sid, bid, lon, lat, null, null);
|
this(nid, sid, bid, lon, lat, null, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -99,8 +97,9 @@ public final class CellIdentityCdma implements Parcelable {
|
|||||||
*
|
*
|
||||||
* @hide
|
* @hide
|
||||||
*/
|
*/
|
||||||
public CellIdentityCdma (int nid, int sid, int bid, int lon, int lat, String alphal,
|
public CellIdentityCdma(int nid, int sid, int bid, int lon, int lat, String alphal,
|
||||||
String alphas) {
|
String alphas) {
|
||||||
|
super(TAG, TYPE_CDMA, null, null);
|
||||||
mNetworkId = nid;
|
mNetworkId = nid;
|
||||||
mSystemId = sid;
|
mSystemId = sid;
|
||||||
mBasestationId = bid;
|
mBasestationId = bid;
|
||||||
@@ -196,40 +195,33 @@ public final class CellIdentityCdma implements Parcelable {
|
|||||||
|
|
||||||
CellIdentityCdma o = (CellIdentityCdma) other;
|
CellIdentityCdma o = (CellIdentityCdma) other;
|
||||||
|
|
||||||
return mNetworkId == o.mNetworkId &&
|
return mNetworkId == o.mNetworkId
|
||||||
mSystemId == o.mSystemId &&
|
&& mSystemId == o.mSystemId
|
||||||
mBasestationId == o.mBasestationId &&
|
&& mBasestationId == o.mBasestationId
|
||||||
mLatitude == o.mLatitude &&
|
&& mLatitude == o.mLatitude
|
||||||
mLongitude == o.mLongitude &&
|
&& mLongitude == o.mLongitude
|
||||||
TextUtils.equals(mAlphaLong, o.mAlphaLong) &&
|
&& TextUtils.equals(mAlphaLong, o.mAlphaLong)
|
||||||
TextUtils.equals(mAlphaShort, o.mAlphaShort);
|
&& TextUtils.equals(mAlphaShort, o.mAlphaShort);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
StringBuilder sb = new StringBuilder("CellIdentityCdma:{");
|
return new StringBuilder(TAG)
|
||||||
sb.append(" mNetworkId="); sb.append(mNetworkId);
|
.append(":{ mNetworkId=").append(mNetworkId)
|
||||||
sb.append(" mSystemId="); sb.append(mSystemId);
|
.append(" mSystemId=").append(mSystemId)
|
||||||
sb.append(" mBasestationId="); sb.append(mBasestationId);
|
.append(" mBasestationId=").append(mBasestationId)
|
||||||
sb.append(" mLongitude="); sb.append(mLongitude);
|
.append(" mLongitude=").append(mLongitude)
|
||||||
sb.append(" mLatitude="); sb.append(mLatitude);
|
.append(" mLatitude=").append(mLatitude)
|
||||||
sb.append(" mAlphaLong="); sb.append(mAlphaLong);
|
.append(" mAlphaLong=").append(mAlphaLong)
|
||||||
sb.append(" mAlphaShort="); sb.append(mAlphaShort);
|
.append(" mAlphaShort=").append(mAlphaShort)
|
||||||
sb.append("}");
|
.append("}").toString();
|
||||||
|
|
||||||
return sb.toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Implement the Parcelable interface */
|
|
||||||
@Override
|
|
||||||
public int describeContents() {
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Implement the Parcelable interface */
|
/** Implement the Parcelable interface */
|
||||||
@Override
|
@Override
|
||||||
public void writeToParcel(Parcel dest, int flags) {
|
public void writeToParcel(Parcel dest, int flags) {
|
||||||
if (DBG) log("writeToParcel(Parcel, int): " + toString());
|
if (DBG) log("writeToParcel(Parcel, int): " + toString());
|
||||||
|
super.writeToParcel(dest, TYPE_CDMA);
|
||||||
dest.writeInt(mNetworkId);
|
dest.writeInt(mNetworkId);
|
||||||
dest.writeInt(mSystemId);
|
dest.writeInt(mSystemId);
|
||||||
dest.writeInt(mBasestationId);
|
dest.writeInt(mBasestationId);
|
||||||
@@ -241,10 +233,16 @@ public final class CellIdentityCdma implements Parcelable {
|
|||||||
|
|
||||||
/** Construct from Parcel, type has already been processed */
|
/** Construct from Parcel, type has already been processed */
|
||||||
private CellIdentityCdma(Parcel in) {
|
private CellIdentityCdma(Parcel in) {
|
||||||
this(in.readInt(), in.readInt(), in.readInt(), in.readInt(), in.readInt(),
|
super(TAG, TYPE_CDMA, in);
|
||||||
in.readString(), in.readString());
|
mNetworkId = in.readInt();
|
||||||
|
mSystemId = in.readInt();
|
||||||
|
mBasestationId = in.readInt();
|
||||||
|
mLongitude = in.readInt();
|
||||||
|
mLatitude = in.readInt();
|
||||||
|
mAlphaLong = in.readString();
|
||||||
|
mAlphaShort = in.readString();
|
||||||
|
|
||||||
if (DBG) log("CellIdentityCdma(Parcel): " + toString());
|
if (DBG) log(toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Implement the Parcelable interface */
|
/** Implement the Parcelable interface */
|
||||||
@@ -253,7 +251,8 @@ public final class CellIdentityCdma implements Parcelable {
|
|||||||
new Creator<CellIdentityCdma>() {
|
new Creator<CellIdentityCdma>() {
|
||||||
@Override
|
@Override
|
||||||
public CellIdentityCdma createFromParcel(Parcel in) {
|
public CellIdentityCdma createFromParcel(Parcel in) {
|
||||||
return new CellIdentityCdma(in);
|
in.readInt(); // skip
|
||||||
|
return createFromParcelBody(in);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -262,10 +261,8 @@ public final class CellIdentityCdma implements Parcelable {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/** @hide */
|
||||||
* log
|
protected static CellIdentityCdma createFromParcelBody(Parcel in) {
|
||||||
*/
|
return new CellIdentityCdma(in);
|
||||||
private static void log(String s) {
|
|
||||||
Rlog.w(LOG_TAG, s);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,8 +17,6 @@
|
|||||||
package android.telephony;
|
package android.telephony;
|
||||||
|
|
||||||
import android.os.Parcel;
|
import android.os.Parcel;
|
||||||
import android.os.Parcelable;
|
|
||||||
import android.telephony.Rlog;
|
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
|
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
@@ -26,9 +24,8 @@ import java.util.Objects;
|
|||||||
/**
|
/**
|
||||||
* CellIdentity to represent a unique GSM cell
|
* CellIdentity to represent a unique GSM cell
|
||||||
*/
|
*/
|
||||||
public final class CellIdentityGsm implements Parcelable {
|
public final class CellIdentityGsm extends CellIdentity {
|
||||||
|
private static final String TAG = CellIdentityGsm.class.getSimpleName();
|
||||||
private static final String LOG_TAG = "CellIdentityGsm";
|
|
||||||
private static final boolean DBG = false;
|
private static final boolean DBG = false;
|
||||||
|
|
||||||
// 16-bit Location Area Code, 0..65535
|
// 16-bit Location Area Code, 0..65535
|
||||||
@@ -39,10 +36,6 @@ public final class CellIdentityGsm implements Parcelable {
|
|||||||
private final int mArfcn;
|
private final int mArfcn;
|
||||||
// 6-bit Base Station Identity Code
|
// 6-bit Base Station Identity Code
|
||||||
private final int mBsic;
|
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
|
// long alpha Operator Name String or Enhanced Operator Name String
|
||||||
private final String mAlphaLong;
|
private final String mAlphaLong;
|
||||||
// short alpha Operator Name String or Enhanced Operator Name String
|
// short alpha Operator Name String or Enhanced Operator Name String
|
||||||
@@ -52,12 +45,11 @@ public final class CellIdentityGsm implements Parcelable {
|
|||||||
* @hide
|
* @hide
|
||||||
*/
|
*/
|
||||||
public CellIdentityGsm() {
|
public CellIdentityGsm() {
|
||||||
|
super(TAG, TYPE_GSM, null, null);
|
||||||
mLac = Integer.MAX_VALUE;
|
mLac = Integer.MAX_VALUE;
|
||||||
mCid = Integer.MAX_VALUE;
|
mCid = Integer.MAX_VALUE;
|
||||||
mArfcn = Integer.MAX_VALUE;
|
mArfcn = Integer.MAX_VALUE;
|
||||||
mBsic = Integer.MAX_VALUE;
|
mBsic = Integer.MAX_VALUE;
|
||||||
mMccStr = null;
|
|
||||||
mMncStr = null;
|
|
||||||
mAlphaLong = null;
|
mAlphaLong = null;
|
||||||
mAlphaShort = null;
|
mAlphaShort = null;
|
||||||
}
|
}
|
||||||
@@ -70,7 +62,7 @@ public final class CellIdentityGsm implements Parcelable {
|
|||||||
*
|
*
|
||||||
* @hide
|
* @hide
|
||||||
*/
|
*/
|
||||||
public CellIdentityGsm (int mcc, int mnc, int lac, int cid) {
|
public CellIdentityGsm(int mcc, int mnc, int lac, int cid) {
|
||||||
this(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);
|
String.valueOf(mcc), String.valueOf(mnc), null, null);
|
||||||
}
|
}
|
||||||
@@ -86,7 +78,7 @@ public final class CellIdentityGsm implements Parcelable {
|
|||||||
*
|
*
|
||||||
* @hide
|
* @hide
|
||||||
*/
|
*/
|
||||||
public CellIdentityGsm (int mcc, int mnc, int lac, int cid, int arfcn, int bsic) {
|
public CellIdentityGsm(int mcc, int mnc, int lac, int cid, int arfcn, int bsic) {
|
||||||
this(lac, cid, arfcn, bsic, String.valueOf(mcc), String.valueOf(mnc), null, null);
|
this(lac, cid, arfcn, bsic, String.valueOf(mcc), String.valueOf(mnc), null, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -103,8 +95,9 @@ public final class CellIdentityGsm implements Parcelable {
|
|||||||
*
|
*
|
||||||
* @hide
|
* @hide
|
||||||
*/
|
*/
|
||||||
public CellIdentityGsm (int lac, int cid, int arfcn, int bsic, String mccStr,
|
public CellIdentityGsm(int lac, int cid, int arfcn, int bsic, String mccStr,
|
||||||
String mncStr, String alphal, String alphas) {
|
String mncStr, String alphal, String alphas) {
|
||||||
|
super(TAG, TYPE_GSM, mccStr, mncStr);
|
||||||
mLac = lac;
|
mLac = lac;
|
||||||
mCid = cid;
|
mCid = cid;
|
||||||
mArfcn = arfcn;
|
mArfcn = arfcn;
|
||||||
@@ -112,31 +105,6 @@ public final class CellIdentityGsm implements Parcelable {
|
|||||||
// for inbound parcels
|
// for inbound parcels
|
||||||
mBsic = (bsic == 0xFF) ? Integer.MAX_VALUE : bsic;
|
mBsic = (bsic == 0xFF) ? Integer.MAX_VALUE : bsic;
|
||||||
|
|
||||||
// Only allow INT_MAX if unknown string mcc/mnc
|
|
||||||
if (mccStr == null || mccStr.matches("^[0-9]{3}$")) {
|
|
||||||
mMccStr = mccStr;
|
|
||||||
} else if (mccStr.isEmpty() || mccStr.equals(String.valueOf(Integer.MAX_VALUE))) {
|
|
||||||
// If the mccStr is empty or unknown, set it as null.
|
|
||||||
mMccStr = null;
|
|
||||||
} else {
|
|
||||||
// TODO: b/69384059 Should throw IllegalArgumentException for the invalid MCC format
|
|
||||||
// after the bug got fixed.
|
|
||||||
mMccStr = null;
|
|
||||||
log("invalid MCC format: " + mccStr);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (mncStr == null || mncStr.matches("^[0-9]{2,3}$")) {
|
|
||||||
mMncStr = mncStr;
|
|
||||||
} else if (mncStr.isEmpty() || mncStr.equals(String.valueOf(Integer.MAX_VALUE))) {
|
|
||||||
// If the mncStr is empty or unknown, set it as null.
|
|
||||||
mMncStr = null;
|
|
||||||
} else {
|
|
||||||
// TODO: b/69384059 Should throw IllegalArgumentException for the invalid MNC format
|
|
||||||
// after the bug got fixed.
|
|
||||||
mMncStr = null;
|
|
||||||
log("invalid MNC format: " + mncStr);
|
|
||||||
}
|
|
||||||
|
|
||||||
mAlphaLong = alphal;
|
mAlphaLong = alphal;
|
||||||
mAlphaShort = alphas;
|
mAlphaShort = alphas;
|
||||||
}
|
}
|
||||||
@@ -237,6 +205,7 @@ public final class CellIdentityGsm implements Parcelable {
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* @deprecated Primary Scrambling Code is not applicable to GSM.
|
||||||
* @return Integer.MAX_VALUE, undefined for GSM
|
* @return Integer.MAX_VALUE, undefined for GSM
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
@@ -260,58 +229,54 @@ public final class CellIdentityGsm implements Parcelable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
CellIdentityGsm o = (CellIdentityGsm) other;
|
CellIdentityGsm o = (CellIdentityGsm) other;
|
||||||
return mLac == o.mLac &&
|
return mLac == o.mLac
|
||||||
mCid == o.mCid &&
|
&& mCid == o.mCid
|
||||||
mArfcn == o.mArfcn &&
|
&& mArfcn == o.mArfcn
|
||||||
mBsic == o.mBsic &&
|
&& mBsic == o.mBsic
|
||||||
TextUtils.equals(mMccStr, o.mMccStr) &&
|
&& TextUtils.equals(mMccStr, o.mMccStr)
|
||||||
TextUtils.equals(mMncStr, o.mMncStr) &&
|
&& TextUtils.equals(mMncStr, o.mMncStr)
|
||||||
TextUtils.equals(mAlphaLong, o.mAlphaLong) &&
|
&& TextUtils.equals(mAlphaLong, o.mAlphaLong)
|
||||||
TextUtils.equals(mAlphaShort, o.mAlphaShort);
|
&& TextUtils.equals(mAlphaShort, o.mAlphaShort);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
StringBuilder sb = new StringBuilder("CellIdentityGsm:{");
|
return new StringBuilder(TAG)
|
||||||
sb.append(" mLac=").append(mLac);
|
.append(":{ mLac=").append(mLac)
|
||||||
sb.append(" mCid=").append(mCid);
|
.append(" mCid=").append(mCid)
|
||||||
sb.append(" mArfcn=").append(mArfcn);
|
.append(" mArfcn=").append(mArfcn)
|
||||||
sb.append(" mBsic=").append("0x").append(Integer.toHexString(mBsic));
|
.append(" mBsic=").append("0x").append(Integer.toHexString(mBsic))
|
||||||
sb.append(" mMcc=").append(mMccStr);
|
.append(" mMcc=").append(mMccStr)
|
||||||
sb.append(" mMnc=").append(mMncStr);
|
.append(" mMnc=").append(mMncStr)
|
||||||
sb.append(" mAlphaLong=").append(mAlphaLong);
|
.append(" mAlphaLong=").append(mAlphaLong)
|
||||||
sb.append(" mAlphaShort=").append(mAlphaShort);
|
.append(" mAlphaShort=").append(mAlphaShort)
|
||||||
sb.append("}");
|
.append("}").toString();
|
||||||
|
|
||||||
return sb.toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Implement the Parcelable interface */
|
|
||||||
@Override
|
|
||||||
public int describeContents() {
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Implement the Parcelable interface */
|
/** Implement the Parcelable interface */
|
||||||
@Override
|
@Override
|
||||||
public void writeToParcel(Parcel dest, int flags) {
|
public void writeToParcel(Parcel dest, int flags) {
|
||||||
if (DBG) log("writeToParcel(Parcel, int): " + toString());
|
if (DBG) log("writeToParcel(Parcel, int): " + toString());
|
||||||
|
super.writeToParcel(dest, TYPE_GSM);
|
||||||
dest.writeInt(mLac);
|
dest.writeInt(mLac);
|
||||||
dest.writeInt(mCid);
|
dest.writeInt(mCid);
|
||||||
dest.writeInt(mArfcn);
|
dest.writeInt(mArfcn);
|
||||||
dest.writeInt(mBsic);
|
dest.writeInt(mBsic);
|
||||||
dest.writeString(mMccStr);
|
|
||||||
dest.writeString(mMncStr);
|
|
||||||
dest.writeString(mAlphaLong);
|
dest.writeString(mAlphaLong);
|
||||||
dest.writeString(mAlphaShort);
|
dest.writeString(mAlphaShort);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Construct from Parcel, type has already been processed */
|
/** Construct from Parcel, type has already been processed */
|
||||||
private CellIdentityGsm(Parcel in) {
|
private CellIdentityGsm(Parcel in) {
|
||||||
this(in.readInt(), in.readInt(), in.readInt(), in.readInt(), in.readString(),
|
super(TAG, TYPE_GSM, in);
|
||||||
in.readString(), in.readString(), in.readString());
|
mLac = in.readInt();
|
||||||
|
mCid = in.readInt();
|
||||||
|
mArfcn = in.readInt();
|
||||||
|
mBsic = in.readInt();
|
||||||
|
mAlphaLong = in.readString();
|
||||||
|
mAlphaShort = in.readString();
|
||||||
|
|
||||||
if (DBG) log("CellIdentityGsm(Parcel): " + toString());
|
if (DBG) log(toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Implement the Parcelable interface */
|
/** Implement the Parcelable interface */
|
||||||
@@ -320,7 +285,8 @@ public final class CellIdentityGsm implements Parcelable {
|
|||||||
new Creator<CellIdentityGsm>() {
|
new Creator<CellIdentityGsm>() {
|
||||||
@Override
|
@Override
|
||||||
public CellIdentityGsm createFromParcel(Parcel in) {
|
public CellIdentityGsm createFromParcel(Parcel in) {
|
||||||
return new CellIdentityGsm(in);
|
in.readInt(); // skip
|
||||||
|
return createFromParcelBody(in);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -329,10 +295,8 @@ public final class CellIdentityGsm implements Parcelable {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/** @hide */
|
||||||
* log
|
protected static CellIdentityGsm createFromParcelBody(Parcel in) {
|
||||||
*/
|
return new CellIdentityGsm(in);
|
||||||
private static void log(String s) {
|
|
||||||
Rlog.w(LOG_TAG, s);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,8 +17,6 @@
|
|||||||
package android.telephony;
|
package android.telephony;
|
||||||
|
|
||||||
import android.os.Parcel;
|
import android.os.Parcel;
|
||||||
import android.os.Parcelable;
|
|
||||||
import android.telephony.Rlog;
|
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
|
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
@@ -26,9 +24,8 @@ import java.util.Objects;
|
|||||||
/**
|
/**
|
||||||
* CellIdentity is to represent a unique LTE cell
|
* CellIdentity is to represent a unique LTE cell
|
||||||
*/
|
*/
|
||||||
public final class CellIdentityLte implements Parcelable {
|
public final class CellIdentityLte extends CellIdentity {
|
||||||
|
private static final String TAG = CellIdentityLte.class.getSimpleName();
|
||||||
private static final String LOG_TAG = "CellIdentityLte";
|
|
||||||
private static final boolean DBG = false;
|
private static final boolean DBG = false;
|
||||||
|
|
||||||
// 28-bit cell identity
|
// 28-bit cell identity
|
||||||
@@ -39,10 +36,6 @@ public final class CellIdentityLte implements Parcelable {
|
|||||||
private final int mTac;
|
private final int mTac;
|
||||||
// 18-bit Absolute RF Channel Number
|
// 18-bit Absolute RF Channel Number
|
||||||
private final int mEarfcn;
|
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
|
// long alpha Operator Name String or Enhanced Operator Name String
|
||||||
private final String mAlphaLong;
|
private final String mAlphaLong;
|
||||||
// short alpha Operator Name String or Enhanced Operator Name String
|
// short alpha Operator Name String or Enhanced Operator Name String
|
||||||
@@ -52,12 +45,11 @@ public final class CellIdentityLte implements Parcelable {
|
|||||||
* @hide
|
* @hide
|
||||||
*/
|
*/
|
||||||
public CellIdentityLte() {
|
public CellIdentityLte() {
|
||||||
|
super(TAG, TYPE_LTE, null, null);
|
||||||
mCi = Integer.MAX_VALUE;
|
mCi = Integer.MAX_VALUE;
|
||||||
mPci = Integer.MAX_VALUE;
|
mPci = Integer.MAX_VALUE;
|
||||||
mTac = Integer.MAX_VALUE;
|
mTac = Integer.MAX_VALUE;
|
||||||
mEarfcn = Integer.MAX_VALUE;
|
mEarfcn = Integer.MAX_VALUE;
|
||||||
mMccStr = null;
|
|
||||||
mMncStr = null;
|
|
||||||
mAlphaLong = null;
|
mAlphaLong = null;
|
||||||
mAlphaShort = null;
|
mAlphaShort = null;
|
||||||
}
|
}
|
||||||
@@ -72,7 +64,7 @@ public final class CellIdentityLte implements Parcelable {
|
|||||||
*
|
*
|
||||||
* @hide
|
* @hide
|
||||||
*/
|
*/
|
||||||
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, Integer.MAX_VALUE, String.valueOf(mcc), String.valueOf(mnc), null, null);
|
this(ci, pci, tac, Integer.MAX_VALUE, String.valueOf(mcc), String.valueOf(mnc), null, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -87,7 +79,7 @@ public final class CellIdentityLte implements Parcelable {
|
|||||||
*
|
*
|
||||||
* @hide
|
* @hide
|
||||||
*/
|
*/
|
||||||
public CellIdentityLte (int mcc, int mnc, int ci, int pci, int tac, int earfcn) {
|
public CellIdentityLte(int mcc, int mnc, int ci, int pci, int tac, int earfcn) {
|
||||||
this(ci, pci, tac, earfcn, String.valueOf(mcc), String.valueOf(mnc), null, null);
|
this(ci, pci, tac, earfcn, String.valueOf(mcc), String.valueOf(mnc), null, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -104,38 +96,13 @@ public final class CellIdentityLte implements Parcelable {
|
|||||||
*
|
*
|
||||||
* @hide
|
* @hide
|
||||||
*/
|
*/
|
||||||
public CellIdentityLte (int ci, int pci, int tac, int earfcn, String mccStr,
|
public CellIdentityLte(int ci, int pci, int tac, int earfcn, String mccStr,
|
||||||
String mncStr, String alphal, String alphas) {
|
String mncStr, String alphal, String alphas) {
|
||||||
|
super(TAG, TYPE_LTE, mccStr, mncStr);
|
||||||
mCi = ci;
|
mCi = ci;
|
||||||
mPci = pci;
|
mPci = pci;
|
||||||
mTac = tac;
|
mTac = tac;
|
||||||
mEarfcn = earfcn;
|
mEarfcn = earfcn;
|
||||||
|
|
||||||
// Only allow INT_MAX if unknown string mcc/mnc
|
|
||||||
if (mccStr == null || mccStr.matches("^[0-9]{3}$")) {
|
|
||||||
mMccStr = mccStr;
|
|
||||||
} else if (mccStr.isEmpty() || mccStr.equals(String.valueOf(Integer.MAX_VALUE))) {
|
|
||||||
// If the mccStr is empty or unknown, set it as null.
|
|
||||||
mMccStr = null;
|
|
||||||
} else {
|
|
||||||
// TODO: b/69384059 Should throw IllegalArgumentException for the invalid MCC format
|
|
||||||
// after the bug got fixed.
|
|
||||||
mMccStr = null;
|
|
||||||
log("invalid MCC format: " + mccStr);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (mncStr == null || mncStr.matches("^[0-9]{2,3}$")) {
|
|
||||||
mMncStr = mncStr;
|
|
||||||
} else if (mncStr.isEmpty() || mncStr.equals(String.valueOf(Integer.MAX_VALUE))) {
|
|
||||||
// If the mncStr is empty or unknown, set it as null.
|
|
||||||
mMncStr = null;
|
|
||||||
} else {
|
|
||||||
// TODO: b/69384059 Should throw IllegalArgumentException for the invalid MNC format
|
|
||||||
// after the bug got fixed.
|
|
||||||
mMncStr = null;
|
|
||||||
log("invalid MNC format: " + mncStr);
|
|
||||||
}
|
|
||||||
|
|
||||||
mAlphaLong = alphal;
|
mAlphaLong = alphal;
|
||||||
mAlphaShort = alphas;
|
mAlphaShort = alphas;
|
||||||
}
|
}
|
||||||
@@ -248,58 +215,54 @@ public final class CellIdentityLte implements Parcelable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
CellIdentityLte o = (CellIdentityLte) other;
|
CellIdentityLte o = (CellIdentityLte) other;
|
||||||
return mCi == o.mCi &&
|
return mCi == o.mCi
|
||||||
mPci == o.mPci &&
|
&& mPci == o.mPci
|
||||||
mTac == o.mTac &&
|
&& mTac == o.mTac
|
||||||
mEarfcn == o.mEarfcn &&
|
&& mEarfcn == o.mEarfcn
|
||||||
TextUtils.equals(mMccStr, o.mMccStr) &&
|
&& TextUtils.equals(mMccStr, o.mMccStr)
|
||||||
TextUtils.equals(mMncStr, o.mMncStr) &&
|
&& TextUtils.equals(mMncStr, o.mMncStr)
|
||||||
TextUtils.equals(mAlphaLong, o.mAlphaLong) &&
|
&& TextUtils.equals(mAlphaLong, o.mAlphaLong)
|
||||||
TextUtils.equals(mAlphaShort, o.mAlphaShort);
|
&& TextUtils.equals(mAlphaShort, o.mAlphaShort);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
StringBuilder sb = new StringBuilder("CellIdentityLte:{");
|
return new StringBuilder(TAG)
|
||||||
sb.append(" mCi="); sb.append(mCi);
|
.append(":{ mCi=").append(mCi)
|
||||||
sb.append(" mPci="); sb.append(mPci);
|
.append(" mPci=").append(mPci)
|
||||||
sb.append(" mTac="); sb.append(mTac);
|
.append(" mTac=").append(mTac)
|
||||||
sb.append(" mEarfcn="); sb.append(mEarfcn);
|
.append(" mEarfcn=").append(mEarfcn)
|
||||||
sb.append(" mMcc="); sb.append(mMccStr);
|
.append(" mMcc=").append(mMccStr)
|
||||||
sb.append(" mMnc="); sb.append(mMncStr);
|
.append(" mMnc=").append(mMncStr)
|
||||||
sb.append(" mAlphaLong="); sb.append(mAlphaLong);
|
.append(" mAlphaLong=").append(mAlphaLong)
|
||||||
sb.append(" mAlphaShort="); sb.append(mAlphaShort);
|
.append(" mAlphaShort=").append(mAlphaShort)
|
||||||
sb.append("}");
|
.append("}").toString();
|
||||||
|
|
||||||
return sb.toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Implement the Parcelable interface */
|
|
||||||
@Override
|
|
||||||
public int describeContents() {
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Implement the Parcelable interface */
|
/** Implement the Parcelable interface */
|
||||||
@Override
|
@Override
|
||||||
public void writeToParcel(Parcel dest, int flags) {
|
public void writeToParcel(Parcel dest, int flags) {
|
||||||
if (DBG) log("writeToParcel(Parcel, int): " + toString());
|
if (DBG) log("writeToParcel(Parcel, int): " + toString());
|
||||||
|
super.writeToParcel(dest, TYPE_LTE);
|
||||||
dest.writeInt(mCi);
|
dest.writeInt(mCi);
|
||||||
dest.writeInt(mPci);
|
dest.writeInt(mPci);
|
||||||
dest.writeInt(mTac);
|
dest.writeInt(mTac);
|
||||||
dest.writeInt(mEarfcn);
|
dest.writeInt(mEarfcn);
|
||||||
dest.writeString(mMccStr);
|
|
||||||
dest.writeString(mMncStr);
|
|
||||||
dest.writeString(mAlphaLong);
|
dest.writeString(mAlphaLong);
|
||||||
dest.writeString(mAlphaShort);
|
dest.writeString(mAlphaShort);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Construct from Parcel, type has already been processed */
|
/** Construct from Parcel, type has already been processed */
|
||||||
private CellIdentityLte(Parcel in) {
|
private CellIdentityLte(Parcel in) {
|
||||||
this(in.readInt(), in.readInt(), in.readInt(), in.readInt(), in.readString(),
|
super(TAG, TYPE_LTE, in);
|
||||||
in.readString(), in.readString(), in.readString());
|
mCi = in.readInt();
|
||||||
|
mPci = in.readInt();
|
||||||
|
mTac = in.readInt();
|
||||||
|
mEarfcn = in.readInt();
|
||||||
|
mAlphaLong = in.readString();
|
||||||
|
mAlphaShort = in.readString();
|
||||||
|
|
||||||
if (DBG) log("CellIdentityLte(Parcel): " + toString());
|
if (DBG) log(toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Implement the Parcelable interface */
|
/** Implement the Parcelable interface */
|
||||||
@@ -308,7 +271,8 @@ public final class CellIdentityLte implements Parcelable {
|
|||||||
new Creator<CellIdentityLte>() {
|
new Creator<CellIdentityLte>() {
|
||||||
@Override
|
@Override
|
||||||
public CellIdentityLte createFromParcel(Parcel in) {
|
public CellIdentityLte createFromParcel(Parcel in) {
|
||||||
return new CellIdentityLte(in);
|
in.readInt(); // skip;
|
||||||
|
return createFromParcelBody(in);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -317,10 +281,8 @@ public final class CellIdentityLte implements Parcelable {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/** @hide */
|
||||||
* log
|
protected static CellIdentityLte createFromParcelBody(Parcel in) {
|
||||||
*/
|
return new CellIdentityLte(in);
|
||||||
private static void log(String s) {
|
|
||||||
Rlog.w(LOG_TAG, s);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
20
telephony/java/android/telephony/CellIdentityTdscdma.aidl
Normal file
20
telephony/java/android/telephony/CellIdentityTdscdma.aidl
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2017 The Android Open Source Project
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** @hide */
|
||||||
|
package android.telephony;
|
||||||
|
|
||||||
|
parcelable CellIdentityTdscdma;
|
||||||
196
telephony/java/android/telephony/CellIdentityTdscdma.java
Normal file
196
telephony/java/android/telephony/CellIdentityTdscdma.java
Normal file
@@ -0,0 +1,196 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2017 The Android Open Source Project
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package android.telephony;
|
||||||
|
|
||||||
|
import android.os.Parcel;
|
||||||
|
import android.text.TextUtils;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* CellIdentity is to represent a unique TD-SCDMA cell
|
||||||
|
*/
|
||||||
|
public final class CellIdentityTdscdma extends CellIdentity {
|
||||||
|
private static final String TAG = CellIdentityTdscdma.class.getSimpleName();
|
||||||
|
private static final boolean DBG = false;
|
||||||
|
|
||||||
|
// 16-bit Location Area Code, 0..65535, INT_MAX if unknown.
|
||||||
|
private final int mLac;
|
||||||
|
// 28-bit UMTS Cell Identity described in TS 25.331, 0..268435455, INT_MAX if unknown.
|
||||||
|
private final int mCid;
|
||||||
|
// 8-bit Cell Parameters ID described in TS 25.331, 0..127, INT_MAX if unknown.
|
||||||
|
private final int mCpid;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @hide
|
||||||
|
*/
|
||||||
|
public CellIdentityTdscdma() {
|
||||||
|
super(TAG, TYPE_TDSCDMA, null, null);
|
||||||
|
mLac = Integer.MAX_VALUE;
|
||||||
|
mCid = Integer.MAX_VALUE;
|
||||||
|
mCpid = Integer.MAX_VALUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param mcc 3-digit Mobile Country Code, 0..999
|
||||||
|
* @param mnc 2 or 3-digit Mobile Network Code, 0..999
|
||||||
|
* @param lac 16-bit Location Area Code, 0..65535, INT_MAX if unknown
|
||||||
|
* @param cid 28-bit UMTS Cell Identity described in TS 25.331, 0..268435455, INT_MAX if unknown
|
||||||
|
* @param cpid 8-bit Cell Parameters ID described in TS 25.331, 0..127, INT_MAX if unknown
|
||||||
|
*
|
||||||
|
* @hide
|
||||||
|
*/
|
||||||
|
public CellIdentityTdscdma(int mcc, int mnc, int lac, int cid, int cpid) {
|
||||||
|
this(String.valueOf(mcc), String.valueOf(mnc), lac, cid, cpid);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param mcc 3-digit Mobile Country Code in string format
|
||||||
|
* @param mnc 2 or 3-digit Mobile Network Code in string format
|
||||||
|
* @param lac 16-bit Location Area Code, 0..65535, INT_MAX if unknown
|
||||||
|
* @param cid 28-bit UMTS Cell Identity described in TS 25.331, 0..268435455, INT_MAX if unknown
|
||||||
|
* @param cpid 8-bit Cell Parameters ID described in TS 25.331, 0..127, INT_MAX if unknown
|
||||||
|
*
|
||||||
|
* @hide
|
||||||
|
*/
|
||||||
|
public CellIdentityTdscdma(String mcc, String mnc, int lac, int cid, int cpid) {
|
||||||
|
super(TAG, TYPE_TDSCDMA, mcc, mnc);
|
||||||
|
mLac = lac;
|
||||||
|
mCid = cid;
|
||||||
|
mCpid = cpid;
|
||||||
|
}
|
||||||
|
|
||||||
|
private CellIdentityTdscdma(CellIdentityTdscdma cid) {
|
||||||
|
this(cid.mMccStr, cid.mMncStr, cid.mLac, cid.mCid, cid.mCpid);
|
||||||
|
}
|
||||||
|
|
||||||
|
CellIdentityTdscdma copy() {
|
||||||
|
return new CellIdentityTdscdma(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get Mobile Country Code in string format
|
||||||
|
* @return Mobile Country Code in string format, null if unknown
|
||||||
|
*/
|
||||||
|
public String getMccStr() {
|
||||||
|
return mMccStr;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get Mobile Network Code in string format
|
||||||
|
* @return Mobile Network Code in string format, null if unknown
|
||||||
|
*/
|
||||||
|
public String getMncStr() {
|
||||||
|
return mMncStr;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return 16-bit Location Area Code, 0..65535, INT_MAX if unknown
|
||||||
|
*/
|
||||||
|
public int getLac() {
|
||||||
|
return mLac;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return 28-bit UMTS Cell Identity described in TS 25.331, 0..268435455, INT_MAX if unknown
|
||||||
|
*/
|
||||||
|
public int getCid() {
|
||||||
|
return mCid;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return 8-bit Cell Parameters ID described in TS 25.331, 0..127, INT_MAX if unknown
|
||||||
|
*/
|
||||||
|
public int getCpid() {
|
||||||
|
return mCpid;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
return Objects.hash(mMccStr, mMncStr, mLac, mCid, mCpid);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object other) {
|
||||||
|
if (this == other) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!(other instanceof CellIdentityTdscdma)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
CellIdentityTdscdma o = (CellIdentityTdscdma) other;
|
||||||
|
return TextUtils.equals(mMccStr, o.mMccStr)
|
||||||
|
&& TextUtils.equals(mMncStr, o.mMncStr)
|
||||||
|
&& mLac == o.mLac
|
||||||
|
&& mCid == o.mCid
|
||||||
|
&& mCpid == o.mCpid;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return new StringBuilder(TAG)
|
||||||
|
.append(":{ mMcc=").append(mMccStr)
|
||||||
|
.append(" mMnc=").append(mMncStr)
|
||||||
|
.append(" mLac=").append(mLac)
|
||||||
|
.append(" mCid=").append(mCid)
|
||||||
|
.append(" mCpid=").append(mCpid)
|
||||||
|
.append("}").toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Implement the Parcelable interface */
|
||||||
|
@Override
|
||||||
|
public void writeToParcel(Parcel dest, int flags) {
|
||||||
|
if (DBG) log("writeToParcel(Parcel, int): " + toString());
|
||||||
|
super.writeToParcel(dest, TYPE_TDSCDMA);
|
||||||
|
dest.writeInt(mLac);
|
||||||
|
dest.writeInt(mCid);
|
||||||
|
dest.writeInt(mCpid);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Construct from Parcel, type has already been processed */
|
||||||
|
private CellIdentityTdscdma(Parcel in) {
|
||||||
|
super(TAG, TYPE_TDSCDMA, in);
|
||||||
|
mLac = in.readInt();
|
||||||
|
mCid = in.readInt();
|
||||||
|
mCpid = in.readInt();
|
||||||
|
|
||||||
|
if (DBG) log(toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Implement the Parcelable interface */
|
||||||
|
@SuppressWarnings("hiding")
|
||||||
|
public static final Creator<CellIdentityTdscdma> CREATOR =
|
||||||
|
new Creator<CellIdentityTdscdma>() {
|
||||||
|
@Override
|
||||||
|
public CellIdentityTdscdma createFromParcel(Parcel in) {
|
||||||
|
in.readInt(); // skip
|
||||||
|
return createFromParcelBody(in);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CellIdentityTdscdma[] newArray(int size) {
|
||||||
|
return new CellIdentityTdscdma[size];
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
/** @hide */
|
||||||
|
protected static CellIdentityTdscdma createFromParcelBody(Parcel in) {
|
||||||
|
return new CellIdentityTdscdma(in);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -17,8 +17,6 @@
|
|||||||
package android.telephony;
|
package android.telephony;
|
||||||
|
|
||||||
import android.os.Parcel;
|
import android.os.Parcel;
|
||||||
import android.os.Parcelable;
|
|
||||||
import android.telephony.Rlog;
|
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
|
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
@@ -26,9 +24,8 @@ import java.util.Objects;
|
|||||||
/**
|
/**
|
||||||
* CellIdentity to represent a unique UMTS cell
|
* CellIdentity to represent a unique UMTS cell
|
||||||
*/
|
*/
|
||||||
public final class CellIdentityWcdma implements Parcelable {
|
public final class CellIdentityWcdma extends CellIdentity {
|
||||||
|
private static final String TAG = CellIdentityWcdma.class.getSimpleName();
|
||||||
private static final String LOG_TAG = "CellIdentityWcdma";
|
|
||||||
private static final boolean DBG = false;
|
private static final boolean DBG = false;
|
||||||
|
|
||||||
// 16-bit Location Area Code, 0..65535
|
// 16-bit Location Area Code, 0..65535
|
||||||
@@ -39,10 +36,6 @@ public final class CellIdentityWcdma implements Parcelable {
|
|||||||
private final int mPsc;
|
private final int mPsc;
|
||||||
// 16-bit UMTS Absolute RF Channel Number
|
// 16-bit UMTS Absolute RF Channel Number
|
||||||
private final int mUarfcn;
|
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
|
// long alpha Operator Name String or Enhanced Operator Name String
|
||||||
private final String mAlphaLong;
|
private final String mAlphaLong;
|
||||||
// short alpha Operator Name String or Enhanced Operator Name String
|
// short alpha Operator Name String or Enhanced Operator Name String
|
||||||
@@ -52,12 +45,11 @@ public final class CellIdentityWcdma implements Parcelable {
|
|||||||
* @hide
|
* @hide
|
||||||
*/
|
*/
|
||||||
public CellIdentityWcdma() {
|
public CellIdentityWcdma() {
|
||||||
|
super(TAG, TYPE_TDSCDMA, null, null);
|
||||||
mLac = Integer.MAX_VALUE;
|
mLac = Integer.MAX_VALUE;
|
||||||
mCid = Integer.MAX_VALUE;
|
mCid = Integer.MAX_VALUE;
|
||||||
mPsc = Integer.MAX_VALUE;
|
mPsc = Integer.MAX_VALUE;
|
||||||
mUarfcn = Integer.MAX_VALUE;
|
mUarfcn = Integer.MAX_VALUE;
|
||||||
mMccStr = null;
|
|
||||||
mMncStr = null;
|
|
||||||
mAlphaLong = null;
|
mAlphaLong = null;
|
||||||
mAlphaShort = null;
|
mAlphaShort = null;
|
||||||
}
|
}
|
||||||
@@ -106,36 +98,11 @@ public final class CellIdentityWcdma implements Parcelable {
|
|||||||
*/
|
*/
|
||||||
public CellIdentityWcdma (int lac, int cid, int psc, int uarfcn,
|
public CellIdentityWcdma (int lac, int cid, int psc, int uarfcn,
|
||||||
String mccStr, String mncStr, String alphal, String alphas) {
|
String mccStr, String mncStr, String alphal, String alphas) {
|
||||||
|
super(TAG, TYPE_WCDMA, mccStr, mncStr);
|
||||||
mLac = lac;
|
mLac = lac;
|
||||||
mCid = cid;
|
mCid = cid;
|
||||||
mPsc = psc;
|
mPsc = psc;
|
||||||
mUarfcn = uarfcn;
|
mUarfcn = uarfcn;
|
||||||
|
|
||||||
// Only allow INT_MAX if unknown string mcc/mnc
|
|
||||||
if (mccStr == null || mccStr.matches("^[0-9]{3}$")) {
|
|
||||||
mMccStr = mccStr;
|
|
||||||
} else if (mccStr.isEmpty() || mccStr.equals(String.valueOf(Integer.MAX_VALUE))) {
|
|
||||||
// If the mccStr is empty or unknown, set it as null.
|
|
||||||
mMccStr = null;
|
|
||||||
} else {
|
|
||||||
// TODO: b/69384059 Should throw IllegalArgumentException for the invalid MCC format
|
|
||||||
// after the bug got fixed.
|
|
||||||
mMccStr = null;
|
|
||||||
log("invalid MCC format: " + mccStr);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (mncStr == null || mncStr.matches("^[0-9]{2,3}$")) {
|
|
||||||
mMncStr = mncStr;
|
|
||||||
} else if (mncStr.isEmpty() || mncStr.equals(String.valueOf(Integer.MAX_VALUE))) {
|
|
||||||
// If the mncStr is empty or unknown, set it as null.
|
|
||||||
mMncStr = null;
|
|
||||||
} else {
|
|
||||||
// TODO: b/69384059 Should throw IllegalArgumentException for the invalid MNC format
|
|
||||||
// after the bug got fixed.
|
|
||||||
mMncStr = null;
|
|
||||||
log("invalid MNC format: " + mncStr);
|
|
||||||
}
|
|
||||||
|
|
||||||
mAlphaLong = alphal;
|
mAlphaLong = alphal;
|
||||||
mAlphaShort = alphas;
|
mAlphaShort = alphas;
|
||||||
}
|
}
|
||||||
@@ -250,58 +217,53 @@ public final class CellIdentityWcdma implements Parcelable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
CellIdentityWcdma o = (CellIdentityWcdma) other;
|
CellIdentityWcdma o = (CellIdentityWcdma) other;
|
||||||
return mLac == o.mLac &&
|
return mLac == o.mLac
|
||||||
mCid == o.mCid &&
|
&& mCid == o.mCid
|
||||||
mPsc == o.mPsc &&
|
&& mPsc == o.mPsc
|
||||||
mUarfcn == o.mUarfcn &&
|
&& mUarfcn == o.mUarfcn
|
||||||
TextUtils.equals(mMccStr, o.mMccStr) &&
|
&& TextUtils.equals(mMccStr, o.mMccStr)
|
||||||
TextUtils.equals(mMncStr, o.mMncStr) &&
|
&& TextUtils.equals(mMncStr, o.mMncStr)
|
||||||
TextUtils.equals(mAlphaLong, o.mAlphaLong) &&
|
&& TextUtils.equals(mAlphaLong, o.mAlphaLong)
|
||||||
TextUtils.equals(mAlphaShort, o.mAlphaShort);
|
&& TextUtils.equals(mAlphaShort, o.mAlphaShort);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
StringBuilder sb = new StringBuilder("CellIdentityWcdma:{");
|
return new StringBuilder(TAG)
|
||||||
sb.append(" mLac=").append(mLac);
|
.append(":{ mLac=").append(mLac)
|
||||||
sb.append(" mCid=").append(mCid);
|
.append(" mCid=").append(mCid)
|
||||||
sb.append(" mPsc=").append(mPsc);
|
.append(" mPsc=").append(mPsc)
|
||||||
sb.append(" mUarfcn=").append(mUarfcn);
|
.append(" mUarfcn=").append(mUarfcn)
|
||||||
sb.append(" mMcc=").append(mMccStr);
|
.append(" mMcc=").append(mMccStr)
|
||||||
sb.append(" mMnc=").append(mMncStr);
|
.append(" mMnc=").append(mMncStr)
|
||||||
sb.append(" mAlphaLong=").append(mAlphaLong);
|
.append(" mAlphaLong=").append(mAlphaLong)
|
||||||
sb.append(" mAlphaShort=").append(mAlphaShort);
|
.append(" mAlphaShort=").append(mAlphaShort)
|
||||||
sb.append("}");
|
.append("}").toString();
|
||||||
|
|
||||||
return sb.toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Implement the Parcelable interface */
|
|
||||||
@Override
|
|
||||||
public int describeContents() {
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Implement the Parcelable interface */
|
/** Implement the Parcelable interface */
|
||||||
@Override
|
@Override
|
||||||
public void writeToParcel(Parcel dest, int flags) {
|
public void writeToParcel(Parcel dest, int flags) {
|
||||||
if (DBG) log("writeToParcel(Parcel, int): " + toString());
|
if (DBG) log("writeToParcel(Parcel, int): " + toString());
|
||||||
|
super.writeToParcel(dest, TYPE_WCDMA);
|
||||||
dest.writeInt(mLac);
|
dest.writeInt(mLac);
|
||||||
dest.writeInt(mCid);
|
dest.writeInt(mCid);
|
||||||
dest.writeInt(mPsc);
|
dest.writeInt(mPsc);
|
||||||
dest.writeInt(mUarfcn);
|
dest.writeInt(mUarfcn);
|
||||||
dest.writeString(mMccStr);
|
|
||||||
dest.writeString(mMncStr);
|
|
||||||
dest.writeString(mAlphaLong);
|
dest.writeString(mAlphaLong);
|
||||||
dest.writeString(mAlphaShort);
|
dest.writeString(mAlphaShort);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Construct from Parcel, type has already been processed */
|
/** Construct from Parcel, type has already been processed */
|
||||||
private CellIdentityWcdma(Parcel in) {
|
private CellIdentityWcdma(Parcel in) {
|
||||||
this(in.readInt(), in.readInt(), in.readInt(), in.readInt(), in.readString(),
|
super(TAG, TYPE_WCDMA, in);
|
||||||
in.readString(), in.readString(), in.readString());
|
mLac = in.readInt();
|
||||||
|
mCid = in.readInt();
|
||||||
if (DBG) log("CellIdentityWcdma(Parcel): " + toString());
|
mPsc = in.readInt();
|
||||||
|
mUarfcn = in.readInt();
|
||||||
|
mAlphaLong = in.readString();
|
||||||
|
mAlphaShort = in.readString();
|
||||||
|
if (DBG) log(toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Implement the Parcelable interface */
|
/** Implement the Parcelable interface */
|
||||||
@@ -310,7 +272,8 @@ public final class CellIdentityWcdma implements Parcelable {
|
|||||||
new Creator<CellIdentityWcdma>() {
|
new Creator<CellIdentityWcdma>() {
|
||||||
@Override
|
@Override
|
||||||
public CellIdentityWcdma createFromParcel(Parcel in) {
|
public CellIdentityWcdma createFromParcel(Parcel in) {
|
||||||
return new CellIdentityWcdma(in);
|
in.readInt(); // skip
|
||||||
|
return createFromParcelBody(in);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -319,10 +282,8 @@ public final class CellIdentityWcdma implements Parcelable {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/** @hide */
|
||||||
* log
|
protected static CellIdentityWcdma createFromParcelBody(Parcel in) {
|
||||||
*/
|
return new CellIdentityWcdma(in);
|
||||||
private static void log(String s) {
|
|
||||||
Rlog.w(LOG_TAG, s);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user