Define CellInfo.UNAVAILABLE for Unreported Fields
For all CellInfo classes, there is a common value for fields that are unreported by the modem: Integer.MAX_VALUE. To better document this value, this CL defines it as a constant "UNAVAILABLE" to indicate that for whatever reason the framework is not reporting this value to the caller. Bug: 28171234 Test: make; make offline-sdk-docs Change-Id: I0aa692e3f1b5478284d262ef97fd65b90bce8293
This commit is contained in:
@@ -42107,6 +42107,7 @@ package android.telephony {
|
||||
field public static final int CONNECTION_SECONDARY_SERVING = 2; // 0x2
|
||||
field public static final int CONNECTION_UNKNOWN = 2147483647; // 0x7fffffff
|
||||
field public static final android.os.Parcelable.Creator<android.telephony.CellInfo> CREATOR;
|
||||
field public static final int UNAVAILABLE = 2147483647; // 0x7fffffff
|
||||
}
|
||||
|
||||
public final class CellInfoCdma extends android.telephony.CellInfo implements android.os.Parcelable {
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
|
||||
package android.telephony;
|
||||
|
||||
import android.annotation.Nullable;
|
||||
import android.annotation.UnsupportedAppUsage;
|
||||
import android.os.Parcel;
|
||||
import android.telephony.cdma.CdmaCellLocation;
|
||||
@@ -56,11 +55,11 @@ public final class CellIdentityCdma extends CellIdentity {
|
||||
*/
|
||||
public CellIdentityCdma() {
|
||||
super(TAG, CellInfo.TYPE_CDMA, null, null, null, null);
|
||||
mNetworkId = Integer.MAX_VALUE;
|
||||
mSystemId = Integer.MAX_VALUE;
|
||||
mBasestationId = Integer.MAX_VALUE;
|
||||
mLongitude = Integer.MAX_VALUE;
|
||||
mLatitude = Integer.MAX_VALUE;
|
||||
mNetworkId = CellInfo.UNAVAILABLE;
|
||||
mSystemId = CellInfo.UNAVAILABLE;
|
||||
mBasestationId = CellInfo.UNAVAILABLE;
|
||||
mLongitude = CellInfo.UNAVAILABLE;
|
||||
mLatitude = CellInfo.UNAVAILABLE;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -104,7 +103,7 @@ public final class CellIdentityCdma extends CellIdentity {
|
||||
mLongitude = lon;
|
||||
mLatitude = lat;
|
||||
} else {
|
||||
mLongitude = mLatitude = Integer.MAX_VALUE;
|
||||
mLongitude = mLatitude = CellInfo.UNAVAILABLE;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -130,21 +129,24 @@ public final class CellIdentityCdma extends CellIdentity {
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Network Id 0..65535, Integer.MAX_VALUE if unknown
|
||||
* @return Network Id 0..65535, {@link android.telephony.CellInfo#UNAVAILABLE UNAVAILABLE}
|
||||
* if unavailable.
|
||||
*/
|
||||
public int getNetworkId() {
|
||||
return mNetworkId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return System Id 0..32767, Integer.MAX_VALUE if unknown
|
||||
* @return System Id 0..32767, {@link android.telephony.CellInfo#UNAVAILABLE UNAVAILABLE}
|
||||
* if unavailable.
|
||||
*/
|
||||
public int getSystemId() {
|
||||
return mSystemId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Base Station Id 0..65535, Integer.MAX_VALUE if unknown
|
||||
* @return Base Station Id 0..65535, {@link android.telephony.CellInfo#UNAVAILABLE UNAVAILABLE}
|
||||
* if unavailable.
|
||||
*/
|
||||
public int getBasestationId() {
|
||||
return mBasestationId;
|
||||
@@ -155,7 +157,7 @@ public final class CellIdentityCdma extends CellIdentity {
|
||||
* specified in 3GPP2 C.S0005-A v6.0. It is represented in units
|
||||
* of 0.25 seconds and ranges from -2592000 to 2592000, both
|
||||
* values inclusive (corresponding to a range of -180
|
||||
* to +180 degrees). Integer.MAX_VALUE if unknown.
|
||||
* to +180 degrees). {@link android.telephony.CellInfo#UNAVAILABLE UNAVAILABLE} if unavailable.
|
||||
*/
|
||||
public int getLongitude() {
|
||||
return mLongitude;
|
||||
@@ -166,7 +168,7 @@ public final class CellIdentityCdma extends CellIdentity {
|
||||
* specified in 3GPP2 C.S0005-A v6.0. It is represented in units
|
||||
* of 0.25 seconds and ranges from -1296000 to 1296000, both
|
||||
* values inclusive (corresponding to a range of -90
|
||||
* to +90 degrees). Integer.MAX_VALUE if unknown.
|
||||
* to +90 degrees). {@link android.telephony.CellInfo#UNAVAILABLE UNAVAILABLE} if unavailable.
|
||||
*/
|
||||
public int getLatitude() {
|
||||
return mLatitude;
|
||||
@@ -182,10 +184,10 @@ public final class CellIdentityCdma extends CellIdentity {
|
||||
@Override
|
||||
public CdmaCellLocation asCellLocation() {
|
||||
CdmaCellLocation cl = new CdmaCellLocation();
|
||||
int bsid = mBasestationId != Integer.MAX_VALUE ? mBasestationId : -1;
|
||||
int sid = mSystemId != Integer.MAX_VALUE ? mSystemId : -1;
|
||||
int nid = mNetworkId != Integer.MAX_VALUE ? mNetworkId : -1;
|
||||
// lat and long already use Integer.MAX_VALUE for invalid/unknown
|
||||
int bsid = mBasestationId != CellInfo.UNAVAILABLE ? mBasestationId : -1;
|
||||
int sid = mSystemId != CellInfo.UNAVAILABLE ? mSystemId : -1;
|
||||
int nid = mNetworkId != CellInfo.UNAVAILABLE ? mNetworkId : -1;
|
||||
// lat and long already use CellInfo.UNAVAILABLE for invalid/unknown
|
||||
cl.setCellLocationData(bsid, mLatitude, mLongitude, sid, nid);
|
||||
return cl;
|
||||
}
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
|
||||
package android.telephony;
|
||||
|
||||
import android.annotation.Nullable;
|
||||
import android.annotation.UnsupportedAppUsage;
|
||||
import android.os.Parcel;
|
||||
import android.telephony.gsm.GsmCellLocation;
|
||||
@@ -48,10 +47,10 @@ public final class CellIdentityGsm extends CellIdentity {
|
||||
@UnsupportedAppUsage
|
||||
public CellIdentityGsm() {
|
||||
super(TAG, CellInfo.TYPE_GSM, null, null, null, null);
|
||||
mLac = Integer.MAX_VALUE;
|
||||
mCid = Integer.MAX_VALUE;
|
||||
mArfcn = Integer.MAX_VALUE;
|
||||
mBsic = Integer.MAX_VALUE;
|
||||
mLac = CellInfo.UNAVAILABLE;
|
||||
mCid = CellInfo.UNAVAILABLE;
|
||||
mArfcn = CellInfo.UNAVAILABLE;
|
||||
mBsic = CellInfo.UNAVAILABLE;
|
||||
}
|
||||
/**
|
||||
* public constructor
|
||||
@@ -63,7 +62,7 @@ public final class CellIdentityGsm extends CellIdentity {
|
||||
* @hide
|
||||
*/
|
||||
public CellIdentityGsm(int mcc, int mnc, int lac, int cid) {
|
||||
this(lac, cid, Integer.MAX_VALUE, Integer.MAX_VALUE,
|
||||
this(lac, cid, CellInfo.UNAVAILABLE, CellInfo.UNAVAILABLE,
|
||||
String.valueOf(mcc), String.valueOf(mnc), null, null);
|
||||
}
|
||||
|
||||
@@ -103,7 +102,7 @@ public final class CellIdentityGsm extends CellIdentity {
|
||||
mArfcn = arfcn;
|
||||
// In RIL BSIC is a UINT8, so 0xFF is the 'INVALID' designator
|
||||
// for inbound parcels
|
||||
mBsic = (bsic == 0xFF) ? Integer.MAX_VALUE : bsic;
|
||||
mBsic = (bsic == 0xFF) ? CellInfo.UNAVAILABLE : bsic;
|
||||
}
|
||||
|
||||
private CellIdentityGsm(CellIdentityGsm cid) {
|
||||
@@ -116,69 +115,73 @@ public final class CellIdentityGsm extends CellIdentity {
|
||||
}
|
||||
|
||||
/**
|
||||
* @return 3-digit Mobile Country Code, 0..999, Integer.MAX_VALUE if unknown
|
||||
* @return 3-digit Mobile Country Code, 0..999,
|
||||
* {@link android.telephony.CellInfo#UNAVAILABLE UNAVAILABLE} if unavailable.
|
||||
* @deprecated Use {@link #getMccString} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
public int getMcc() {
|
||||
return (mMccStr != null) ? Integer.valueOf(mMccStr) : Integer.MAX_VALUE;
|
||||
return (mMccStr != null) ? Integer.valueOf(mMccStr) : CellInfo.UNAVAILABLE;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return 2 or 3-digit Mobile Network Code, 0..999, Integer.MAX_VALUE if unknown
|
||||
* @return 2 or 3-digit Mobile Network Code, 0..999,
|
||||
* {@link android.telephony.CellInfo#UNAVAILABLE UNAVAILABLE} if unavailable.
|
||||
* @deprecated Use {@link #getMncString} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
public int getMnc() {
|
||||
return (mMncStr != null) ? Integer.valueOf(mMncStr) : Integer.MAX_VALUE;
|
||||
return (mMncStr != null) ? Integer.valueOf(mMncStr) : CellInfo.UNAVAILABLE;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return 16-bit Location Area Code, 0..65535, Integer.MAX_VALUE if unknown
|
||||
* @return 16-bit Location Area Code, 0..65535,
|
||||
* {@link android.telephony.CellInfo#UNAVAILABLE UNAVAILABLE} if unavailable.
|
||||
*/
|
||||
public int getLac() {
|
||||
return mLac;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return CID
|
||||
* Either 16-bit GSM Cell Identity described
|
||||
* in TS 27.007, 0..65535, Integer.MAX_VALUE if unknown
|
||||
* @return 16-bit GSM Cell Identity described in TS 27.007, 0..65535,
|
||||
* {@link android.telephony.CellInfo#UNAVAILABLE UNAVAILABLE} if unavailable.
|
||||
*/
|
||||
public int getCid() {
|
||||
return mCid;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return 16-bit GSM Absolute RF Channel Number, Integer.MAX_VALUE if unknown
|
||||
* @return 16-bit GSM Absolute RF Channel Number,
|
||||
* {@link android.telephony.CellInfo#UNAVAILABLE UNAVAILABLE} if unavailable.
|
||||
*/
|
||||
public int getArfcn() {
|
||||
return mArfcn;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return 6-bit Base Station Identity Code, Integer.MAX_VALUE if unknown
|
||||
* @return 6-bit Base Station Identity Code,
|
||||
* {@link android.telephony.CellInfo#UNAVAILABLE UNAVAILABLE} if unavailable.
|
||||
*/
|
||||
public int getBsic() {
|
||||
return mBsic;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return a 5 or 6 character string (MCC+MNC), null if any field is unknown
|
||||
* @return a 5 or 6 character string (MCC+MNC), null if any field is unknown.
|
||||
*/
|
||||
public String getMobileNetworkOperator() {
|
||||
return (mMccStr == null || mMncStr == null) ? null : mMccStr + mMncStr;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Mobile Country Code in string format, null if unknown
|
||||
* @return Mobile Country Code in string format, null if unavailable.
|
||||
*/
|
||||
public String getMccString() {
|
||||
return mMccStr;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Mobile Network Code in string format, null if unknown
|
||||
* @return Mobile Network Code in string format, null if unavailable.
|
||||
*/
|
||||
public String getMncString() {
|
||||
return mMncStr;
|
||||
@@ -192,19 +195,19 @@ public final class CellIdentityGsm extends CellIdentity {
|
||||
|
||||
/**
|
||||
* @deprecated Primary Scrambling Code is not applicable to GSM.
|
||||
* @return Integer.MAX_VALUE, undefined for GSM
|
||||
* @return {@link android.telephony.CellInfo#UNAVAILABLE UNAVAILABLE} - undefined for GSM
|
||||
*/
|
||||
@Deprecated
|
||||
public int getPsc() {
|
||||
return Integer.MAX_VALUE;
|
||||
return CellInfo.UNAVAILABLE;
|
||||
}
|
||||
|
||||
/** @hide */
|
||||
@Override
|
||||
public GsmCellLocation asCellLocation() {
|
||||
GsmCellLocation cl = new GsmCellLocation();
|
||||
int lac = mLac != Integer.MAX_VALUE ? mLac : -1;
|
||||
int cid = mCid != Integer.MAX_VALUE ? mCid : -1;
|
||||
int lac = mLac != CellInfo.UNAVAILABLE ? mLac : -1;
|
||||
int cid = mCid != CellInfo.UNAVAILABLE ? mCid : -1;
|
||||
cl.setLacAndCid(lac, cid);
|
||||
cl.setPsc(-1);
|
||||
return cl;
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
|
||||
package android.telephony;
|
||||
|
||||
import android.annotation.Nullable;
|
||||
import android.annotation.UnsupportedAppUsage;
|
||||
import android.os.Parcel;
|
||||
import android.telephony.gsm.GsmCellLocation;
|
||||
@@ -49,11 +48,11 @@ public final class CellIdentityLte extends CellIdentity {
|
||||
@UnsupportedAppUsage
|
||||
public CellIdentityLte() {
|
||||
super(TAG, CellInfo.TYPE_LTE, null, null, null, null);
|
||||
mCi = Integer.MAX_VALUE;
|
||||
mPci = Integer.MAX_VALUE;
|
||||
mTac = Integer.MAX_VALUE;
|
||||
mEarfcn = Integer.MAX_VALUE;
|
||||
mBandwidth = Integer.MAX_VALUE;
|
||||
mCi = CellInfo.UNAVAILABLE;
|
||||
mPci = CellInfo.UNAVAILABLE;
|
||||
mTac = CellInfo.UNAVAILABLE;
|
||||
mEarfcn = CellInfo.UNAVAILABLE;
|
||||
mBandwidth = CellInfo.UNAVAILABLE;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -68,7 +67,7 @@ public final class CellIdentityLte extends CellIdentity {
|
||||
*/
|
||||
@UnsupportedAppUsage
|
||||
public CellIdentityLte(int mcc, int mnc, int ci, int pci, int tac) {
|
||||
this(ci, pci, tac, Integer.MAX_VALUE, Integer.MAX_VALUE, String.valueOf(mcc),
|
||||
this(ci, pci, tac, CellInfo.UNAVAILABLE, CellInfo.UNAVAILABLE, String.valueOf(mcc),
|
||||
String.valueOf(mnc), null, null);
|
||||
}
|
||||
|
||||
@@ -84,7 +83,7 @@ public final class CellIdentityLte extends CellIdentity {
|
||||
* @hide
|
||||
*/
|
||||
public CellIdentityLte(int mcc, int mnc, int ci, int pci, int tac, int earfcn) {
|
||||
this(ci, pci, tac, earfcn, Integer.MAX_VALUE, String.valueOf(mcc), String.valueOf(mnc),
|
||||
this(ci, pci, tac, earfcn, CellInfo.UNAVAILABLE, String.valueOf(mcc), String.valueOf(mnc),
|
||||
null, null);
|
||||
}
|
||||
|
||||
@@ -122,74 +121,81 @@ public final class CellIdentityLte extends CellIdentity {
|
||||
}
|
||||
|
||||
/**
|
||||
* @return 3-digit Mobile Country Code, 0..999, Integer.MAX_VALUE if unknown
|
||||
* @return 3-digit Mobile Country Code, 0..999,
|
||||
* {@link android.telephony.CellInfo#UNAVAILABLE UNAVAILABLE} if unavailable.
|
||||
* @deprecated Use {@link #getMccString} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
public int getMcc() {
|
||||
return (mMccStr != null) ? Integer.valueOf(mMccStr) : Integer.MAX_VALUE;
|
||||
return (mMccStr != null) ? Integer.valueOf(mMccStr) : CellInfo.UNAVAILABLE;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return 2 or 3-digit Mobile Network Code, 0..999, Integer.MAX_VALUE if unknown
|
||||
* @return 2 or 3-digit Mobile Network Code, 0..999,
|
||||
* {@link android.telephony.CellInfo#UNAVAILABLE UNAVAILABLE} if unavailable.
|
||||
* @deprecated Use {@link #getMncString} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
public int getMnc() {
|
||||
return (mMncStr != null) ? Integer.valueOf(mMncStr) : Integer.MAX_VALUE;
|
||||
return (mMncStr != null) ? Integer.valueOf(mMncStr) : CellInfo.UNAVAILABLE;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return 28-bit Cell Identity, Integer.MAX_VALUE if unknown
|
||||
* @return 28-bit Cell Identity,
|
||||
* {@link android.telephony.CellInfo#UNAVAILABLE UNAVAILABLE} if unavailable.
|
||||
*/
|
||||
public int getCi() {
|
||||
return mCi;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Physical Cell Id 0..503, Integer.MAX_VALUE if unknown
|
||||
* @return Physical Cell Id 0..503,
|
||||
* {@link android.telephony.CellInfo#UNAVAILABLE UNAVAILABLE} if unavailable.
|
||||
*/
|
||||
public int getPci() {
|
||||
return mPci;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return 16-bit Tracking Area Code, Integer.MAX_VALUE if unknown
|
||||
* @return 16-bit Tracking Area Code,
|
||||
* {@link android.telephony.CellInfo#UNAVAILABLE UNAVAILABLE} if unavailable.
|
||||
*/
|
||||
public int getTac() {
|
||||
return mTac;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return 18-bit Absolute RF Channel Number, Integer.MAX_VALUE if unknown
|
||||
* @return 18-bit Absolute RF Channel Number,
|
||||
* {@link android.telephony.CellInfo#UNAVAILABLE UNAVAILABLE} if unavailable.
|
||||
*/
|
||||
public int getEarfcn() {
|
||||
return mEarfcn;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Cell bandwidth in kHz, Integer.MAX_VALUE if unknown
|
||||
* @return Cell bandwidth in kHz,
|
||||
* {@link android.telephony.CellInfo#UNAVAILABLE UNAVAILABLE} if unavailable.
|
||||
*/
|
||||
public int getBandwidth() {
|
||||
return mBandwidth;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Mobile Country Code in string format, null if unknown
|
||||
* @return Mobile Country Code in string format, null if unavailable.
|
||||
*/
|
||||
public String getMccString() {
|
||||
return mMccStr;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Mobile Network Code in string format, null if unknown
|
||||
* @return Mobile Network Code in string format, null if unavailable.
|
||||
*/
|
||||
public String getMncString() {
|
||||
return mMncStr;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return a 5 or 6 character string (MCC+MNC), null if any field is unknown
|
||||
* @return a 5 or 6 character string (MCC+MNC), null if any field is unknown.
|
||||
*/
|
||||
public String getMobileNetworkOperator() {
|
||||
return (mMccStr == null || mMncStr == null) ? null : mMccStr + mMncStr;
|
||||
@@ -216,8 +222,8 @@ public final class CellIdentityLte extends CellIdentity {
|
||||
@Override
|
||||
public GsmCellLocation asCellLocation() {
|
||||
GsmCellLocation cl = new GsmCellLocation();
|
||||
int tac = mTac != Integer.MAX_VALUE ? mTac : -1;
|
||||
int cid = mCi != Integer.MAX_VALUE ? mCi : -1;
|
||||
int tac = mTac != CellInfo.UNAVAILABLE ? mTac : -1;
|
||||
int cid = mCi != CellInfo.UNAVAILABLE ? mCi : -1;
|
||||
cl.setLacAndCid(tac, cid);
|
||||
cl.setPsc(0);
|
||||
return cl;
|
||||
|
||||
@@ -28,11 +28,12 @@ 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.
|
||||
// 16-bit Location Area Code, 0..65535, CellInfo.UNAVAILABLE if unknown.
|
||||
private final int mLac;
|
||||
// 28-bit UMTS Cell Identity described in TS 25.331, 0..268435455, INT_MAX if unknown.
|
||||
// 28-bit UMTS Cell Identity described in TS 25.331, 0..268435455, CellInfo.UNAVAILABLE
|
||||
// if unknown.
|
||||
private final int mCid;
|
||||
// 8-bit Cell Parameters ID described in TS 25.331, 0..127, INT_MAX if unknown.
|
||||
// 8-bit Cell Parameters ID described in TS 25.331, 0..127, CellInfo.UNAVAILABLE if unknown.
|
||||
private final int mCpid;
|
||||
// 16-bit UMTS Absolute RF Channel Number described in TS 25.101 sec. 5.4.3
|
||||
private final int mUarfcn;
|
||||
@@ -42,18 +43,20 @@ public final class CellIdentityTdscdma extends CellIdentity {
|
||||
*/
|
||||
public CellIdentityTdscdma() {
|
||||
super(TAG, CellInfo.TYPE_TDSCDMA, null, null, null, null);
|
||||
mLac = Integer.MAX_VALUE;
|
||||
mCid = Integer.MAX_VALUE;
|
||||
mCpid = Integer.MAX_VALUE;
|
||||
mUarfcn = Integer.MAX_VALUE;
|
||||
mLac = CellInfo.UNAVAILABLE;
|
||||
mCid = CellInfo.UNAVAILABLE;
|
||||
mCpid = CellInfo.UNAVAILABLE;
|
||||
mUarfcn = CellInfo.UNAVAILABLE;
|
||||
}
|
||||
|
||||
/**
|
||||
* @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
|
||||
* @param lac 16-bit Location Area Code, 0..65535, CellInfo.UNAVAILABLE if unknown
|
||||
* @param cid 28-bit UMTS Cell Identity described in TS 25.331, 0..268435455, CellInfo.
|
||||
* UNAVAILABLE if unknown
|
||||
* @param cpid 8-bit Cell Parameters ID described in TS 25.331, 0..127, CellInfo.UNAVAILABLE
|
||||
* if unknown
|
||||
* @param uarfcn 16-bit UMTS Absolute RF Channel Number described in TS 25.101 sec. 5.4.3
|
||||
*
|
||||
* @hide
|
||||
@@ -65,9 +68,11 @@ public final class CellIdentityTdscdma extends CellIdentity {
|
||||
/**
|
||||
* @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
|
||||
* @param lac 16-bit Location Area Code, 0..65535, CellInfo.UNAVAILABLE if unknown
|
||||
* @param cid 28-bit UMTS Cell Identity described in TS 25.331, 0..268435455,
|
||||
* CellInfo.UNAVAILABLE if unknown
|
||||
* @param cpid 8-bit Cell Parameters ID described in TS 25.331, 0..127,
|
||||
* CellInfo.UNAVAILABLE if unknown
|
||||
* @param uarfcn 16-bit UMTS Absolute RF Channel Number described in TS 25.101 sec. 5.4.3
|
||||
* @param alphal long alpha Operator Name String or Enhanced Operator Name String
|
||||
* @param alphas short alpha Operator Name String or Enhanced Operator Name String
|
||||
@@ -116,21 +121,24 @@ public final class CellIdentityTdscdma extends CellIdentity {
|
||||
}
|
||||
|
||||
/**
|
||||
* @return 16-bit Location Area Code, 0..65535, INT_MAX if unknown
|
||||
* @return 16-bit Location Area Code, 0..65535,
|
||||
* {@link android.telephony.CellInfo#UNAVAILABLE UNAVAILABLE} if unavailable.
|
||||
*/
|
||||
public int getLac() {
|
||||
return mLac;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return 28-bit UMTS Cell Identity described in TS 25.331, 0..268435455, INT_MAX if unknown
|
||||
* @return 28-bit UMTS Cell Identity described in TS 25.331, 0..268435455,
|
||||
* {@link android.telephony.CellInfo#UNAVAILABLE UNAVAILABLE} if unavailable.
|
||||
*/
|
||||
public int getCid() {
|
||||
return mCid;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return 8-bit Cell Parameters ID described in TS 25.331, 0..127, INT_MAX if unknown
|
||||
* @return 8-bit Cell Parameters ID described in TS 25.331, 0..127,
|
||||
* {@link android.telephony.CellInfo#UNAVAILABLE UNAVAILABLE} if unavailable.
|
||||
*/
|
||||
public int getCpid() {
|
||||
return mCpid;
|
||||
@@ -146,8 +154,8 @@ public final class CellIdentityTdscdma extends CellIdentity {
|
||||
@Override
|
||||
public GsmCellLocation asCellLocation() {
|
||||
GsmCellLocation cl = new GsmCellLocation();
|
||||
int lac = mLac != Integer.MAX_VALUE ? mLac : -1;
|
||||
int cid = mCid != Integer.MAX_VALUE ? mCid : -1;
|
||||
int lac = mLac != CellInfo.UNAVAILABLE ? mLac : -1;
|
||||
int cid = mCid != CellInfo.UNAVAILABLE ? mCid : -1;
|
||||
cl.setLacAndCid(lac, cid);
|
||||
cl.setPsc(-1); // There is no PSC for TD-SCDMA; not using this for CPI to stem shenanigans
|
||||
return cl;
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
|
||||
package android.telephony;
|
||||
|
||||
import android.annotation.Nullable;
|
||||
import android.annotation.UnsupportedAppUsage;
|
||||
import android.os.Parcel;
|
||||
import android.telephony.gsm.GsmCellLocation;
|
||||
@@ -46,10 +45,10 @@ public final class CellIdentityWcdma extends CellIdentity {
|
||||
*/
|
||||
public CellIdentityWcdma() {
|
||||
super(TAG, CellInfo.TYPE_WCDMA, null, null, null, null);
|
||||
mLac = Integer.MAX_VALUE;
|
||||
mCid = Integer.MAX_VALUE;
|
||||
mPsc = Integer.MAX_VALUE;
|
||||
mUarfcn = Integer.MAX_VALUE;
|
||||
mLac = CellInfo.UNAVAILABLE;
|
||||
mCid = CellInfo.UNAVAILABLE;
|
||||
mPsc = CellInfo.UNAVAILABLE;
|
||||
mUarfcn = CellInfo.UNAVAILABLE;
|
||||
}
|
||||
/**
|
||||
* public constructor
|
||||
@@ -62,7 +61,7 @@ public final class CellIdentityWcdma extends CellIdentity {
|
||||
* @hide
|
||||
*/
|
||||
public CellIdentityWcdma (int mcc, int mnc, int lac, int cid, int psc) {
|
||||
this(lac, cid, psc, Integer.MAX_VALUE, String.valueOf(mcc), String.valueOf(mnc),
|
||||
this(lac, cid, psc, CellInfo.UNAVAILABLE, String.valueOf(mcc), String.valueOf(mnc),
|
||||
null, null);
|
||||
}
|
||||
|
||||
@@ -113,25 +112,28 @@ public final class CellIdentityWcdma extends CellIdentity {
|
||||
}
|
||||
|
||||
/**
|
||||
* @return 3-digit Mobile Country Code, 0..999, Integer.MAX_VALUE if unknown
|
||||
* @return 3-digit Mobile Country Code, 0..999,
|
||||
* {@link android.telephony.CellInfo#UNAVAILABLE UNAVAILABLE} if unavailable.
|
||||
* @deprecated Use {@link #getMccString} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
public int getMcc() {
|
||||
return (mMccStr != null) ? Integer.valueOf(mMccStr) : Integer.MAX_VALUE;
|
||||
return (mMccStr != null) ? Integer.valueOf(mMccStr) : CellInfo.UNAVAILABLE;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return 2 or 3-digit Mobile Network Code, 0..999, Integer.MAX_VALUE if unknown
|
||||
* @return 2 or 3-digit Mobile Network Code, 0..999,
|
||||
* {@link android.telephony.CellInfo#UNAVAILABLE UNAVAILABLE} if unavailable.
|
||||
* @deprecated Use {@link #getMncString} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
public int getMnc() {
|
||||
return (mMncStr != null) ? Integer.valueOf(mMncStr) : Integer.MAX_VALUE;
|
||||
return (mMncStr != null) ? Integer.valueOf(mMncStr) : CellInfo.UNAVAILABLE;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return 16-bit Location Area Code, 0..65535, Integer.MAX_VALUE if unknown
|
||||
* @return 16-bit Location Area Code, 0..65535,
|
||||
* {@link android.telephony.CellInfo#UNAVAILABLE UNAVAILABLE} if unavailable.
|
||||
*/
|
||||
public int getLac() {
|
||||
return mLac;
|
||||
@@ -139,29 +141,30 @@ public final class CellIdentityWcdma extends CellIdentity {
|
||||
|
||||
/**
|
||||
* @return CID
|
||||
* 28-bit UMTS Cell Identity described in TS 25.331, 0..268435455, Integer.MAX_VALUE if unknown
|
||||
* 28-bit UMTS Cell Identity described in TS 25.331, 0..268435455,
|
||||
* {@link android.telephony.CellInfo#UNAVAILABLE UNAVAILABLE} if unavailable.
|
||||
*/
|
||||
public int getCid() {
|
||||
return mCid;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return 9-bit UMTS Primary Scrambling Code described in TS 25.331, 0..511, Integer.MAX_VALUE
|
||||
* if unknown
|
||||
* @return 9-bit UMTS Primary Scrambling Code described in TS 25.331, 0..511,
|
||||
* {@link android.telephony.CellInfo#UNAVAILABLE UNAVAILABLE} if unavailable.
|
||||
*/
|
||||
public int getPsc() {
|
||||
return mPsc;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Mobile Country Code in string version, null if unknown
|
||||
* @return Mobile Country Code in string version, null if unavailable.
|
||||
*/
|
||||
public String getMccString() {
|
||||
return mMccStr;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Mobile Network Code in string version, null if unknown
|
||||
* @return Mobile Network Code in string version, null if unavailable.
|
||||
*/
|
||||
public String getMncString() {
|
||||
return mMncStr;
|
||||
@@ -180,7 +183,8 @@ public final class CellIdentityWcdma extends CellIdentity {
|
||||
}
|
||||
|
||||
/**
|
||||
* @return 16-bit UMTS Absolute RF Channel Number, Integer.MAX_VALUE if unknown
|
||||
* @return 16-bit UMTS Absolute RF Channel Number,
|
||||
* {@link android.telephony.CellInfo#UNAVAILABLE UNAVAILABLE} if unavailable.
|
||||
*/
|
||||
public int getUarfcn() {
|
||||
return mUarfcn;
|
||||
@@ -196,9 +200,9 @@ public final class CellIdentityWcdma extends CellIdentity {
|
||||
@Override
|
||||
public GsmCellLocation asCellLocation() {
|
||||
GsmCellLocation cl = new GsmCellLocation();
|
||||
int lac = mLac != Integer.MAX_VALUE ? mLac : -1;
|
||||
int cid = mCid != Integer.MAX_VALUE ? mCid : -1;
|
||||
int psc = mPsc != Integer.MAX_VALUE ? mPsc : -1;
|
||||
int lac = mLac != CellInfo.UNAVAILABLE ? mLac : -1;
|
||||
int cid = mCid != CellInfo.UNAVAILABLE ? mCid : -1;
|
||||
int psc = mPsc != CellInfo.UNAVAILABLE ? mPsc : -1;
|
||||
cl.setLacAndCid(lac, cid);
|
||||
cl.setPsc(psc);
|
||||
|
||||
@@ -280,4 +284,4 @@ public final class CellIdentityWcdma extends CellIdentity {
|
||||
protected static CellIdentityWcdma createFromParcelBody(Parcel in) {
|
||||
return new CellIdentityWcdma(in);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,6 +32,11 @@ import java.lang.annotation.RetentionPolicy;
|
||||
*/
|
||||
public abstract class CellInfo implements Parcelable {
|
||||
|
||||
/**
|
||||
* This value indicates that the integer field is unreported.
|
||||
*/
|
||||
public static final int UNAVAILABLE = Integer.MAX_VALUE;
|
||||
|
||||
/**
|
||||
* Cell identity type
|
||||
* @hide
|
||||
|
||||
@@ -51,8 +51,9 @@ public final class CellSignalStrengthCdma extends CellSignalStrength implements
|
||||
* <p>Note that this HAL is inconsistent with UMTS-based radio techs as the value indicating
|
||||
* that a field is unreported is negative, rather than a large(r) positive number.
|
||||
* <p>Also note that to keep the public-facing methods of this class consistent with others,
|
||||
* unreported values are coerced to Integer.MAX_VALUE rather than left as -1, which is
|
||||
* a departure from SignalStrength, which is stuck with the values it currently reports.
|
||||
* unreported values are coerced to {@link android.telephony.CellInfo#UNAVAILABLE UNAVAILABLE}
|
||||
* rather than left as -1, which is a departure from SignalStrength, which is stuck with the
|
||||
* values it currently reports.
|
||||
*
|
||||
* @param cdmaDbm negative of the CDMA signal strength value or -1 if invalid.
|
||||
* @param cdmaEcio negative of the CDMA pilot/noise ratio or -1 if invalid.
|
||||
@@ -65,12 +66,12 @@ public final class CellSignalStrengthCdma extends CellSignalStrength implements
|
||||
int evdoSnr) {
|
||||
// The values here were lifted from SignalStrength.validateInput()
|
||||
// FIXME: Combine all checking and setting logic between this and SignalStrength.
|
||||
mCdmaDbm = ((cdmaDbm > 0) && (cdmaDbm < 120)) ? -cdmaDbm : Integer.MAX_VALUE;
|
||||
mCdmaEcio = ((cdmaEcio > 0) && (cdmaEcio < 160)) ? -cdmaEcio : Integer.MAX_VALUE;
|
||||
mCdmaDbm = ((cdmaDbm > 0) && (cdmaDbm < 120)) ? -cdmaDbm : CellInfo.UNAVAILABLE;
|
||||
mCdmaEcio = ((cdmaEcio > 0) && (cdmaEcio < 160)) ? -cdmaEcio : CellInfo.UNAVAILABLE;
|
||||
|
||||
mEvdoDbm = ((evdoDbm > 0) && (evdoDbm < 120)) ? -evdoDbm : Integer.MAX_VALUE;
|
||||
mEvdoEcio = ((evdoEcio > 0) && (evdoEcio < 160)) ? -evdoEcio : Integer.MAX_VALUE;
|
||||
mEvdoSnr = ((evdoSnr > 0) && (evdoSnr <= 8)) ? evdoSnr : Integer.MAX_VALUE;
|
||||
mEvdoDbm = ((evdoDbm > 0) && (evdoDbm < 120)) ? -evdoDbm : CellInfo.UNAVAILABLE;
|
||||
mEvdoEcio = ((evdoEcio > 0) && (evdoEcio < 160)) ? -evdoEcio : CellInfo.UNAVAILABLE;
|
||||
mEvdoSnr = ((evdoSnr > 0) && (evdoSnr <= 8)) ? evdoSnr : CellInfo.UNAVAILABLE;
|
||||
}
|
||||
|
||||
/** @hide */
|
||||
@@ -96,11 +97,11 @@ public final class CellSignalStrengthCdma extends CellSignalStrength implements
|
||||
/** @hide */
|
||||
@Override
|
||||
public void setDefaultValues() {
|
||||
mCdmaDbm = Integer.MAX_VALUE;
|
||||
mCdmaEcio = Integer.MAX_VALUE;
|
||||
mEvdoDbm = Integer.MAX_VALUE;
|
||||
mEvdoEcio = Integer.MAX_VALUE;
|
||||
mEvdoSnr = Integer.MAX_VALUE;
|
||||
mCdmaDbm = CellInfo.UNAVAILABLE;
|
||||
mCdmaEcio = CellInfo.UNAVAILABLE;
|
||||
mEvdoDbm = CellInfo.UNAVAILABLE;
|
||||
mEvdoEcio = CellInfo.UNAVAILABLE;
|
||||
mEvdoSnr = CellInfo.UNAVAILABLE;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -139,7 +140,7 @@ public final class CellSignalStrengthCdma extends CellSignalStrength implements
|
||||
int cdmaAsuLevel;
|
||||
int ecioAsuLevel;
|
||||
|
||||
if (cdmaDbm == Integer.MAX_VALUE) cdmaAsuLevel = 99;
|
||||
if (cdmaDbm == CellInfo.UNAVAILABLE) cdmaAsuLevel = 99;
|
||||
else if (cdmaDbm >= -75) cdmaAsuLevel = 16;
|
||||
else if (cdmaDbm >= -82) cdmaAsuLevel = 8;
|
||||
else if (cdmaDbm >= -90) cdmaAsuLevel = 4;
|
||||
@@ -148,7 +149,7 @@ public final class CellSignalStrengthCdma extends CellSignalStrength implements
|
||||
else cdmaAsuLevel = 99;
|
||||
|
||||
// Ec/Io are in dB*10
|
||||
if (cdmaEcio == Integer.MAX_VALUE) ecioAsuLevel = 99;
|
||||
if (cdmaEcio == CellInfo.UNAVAILABLE) ecioAsuLevel = 99;
|
||||
else if (cdmaEcio >= -90) ecioAsuLevel = 16;
|
||||
else if (cdmaEcio >= -100) ecioAsuLevel = 8;
|
||||
else if (cdmaEcio >= -115) ecioAsuLevel = 4;
|
||||
@@ -170,7 +171,7 @@ public final class CellSignalStrengthCdma extends CellSignalStrength implements
|
||||
int levelDbm;
|
||||
int levelEcio;
|
||||
|
||||
if (cdmaDbm == Integer.MAX_VALUE) levelDbm = SIGNAL_STRENGTH_NONE_OR_UNKNOWN;
|
||||
if (cdmaDbm == CellInfo.UNAVAILABLE) levelDbm = SIGNAL_STRENGTH_NONE_OR_UNKNOWN;
|
||||
else if (cdmaDbm >= -75) levelDbm = SIGNAL_STRENGTH_GREAT;
|
||||
else if (cdmaDbm >= -85) levelDbm = SIGNAL_STRENGTH_GOOD;
|
||||
else if (cdmaDbm >= -95) levelDbm = SIGNAL_STRENGTH_MODERATE;
|
||||
@@ -178,7 +179,7 @@ public final class CellSignalStrengthCdma extends CellSignalStrength implements
|
||||
else levelDbm = SIGNAL_STRENGTH_NONE_OR_UNKNOWN;
|
||||
|
||||
// Ec/Io are in dB*10
|
||||
if (cdmaEcio == Integer.MAX_VALUE) levelEcio = SIGNAL_STRENGTH_NONE_OR_UNKNOWN;
|
||||
if (cdmaEcio == CellInfo.UNAVAILABLE) levelEcio = SIGNAL_STRENGTH_NONE_OR_UNKNOWN;
|
||||
else if (cdmaEcio >= -90) levelEcio = SIGNAL_STRENGTH_GREAT;
|
||||
else if (cdmaEcio >= -110) levelEcio = SIGNAL_STRENGTH_GOOD;
|
||||
else if (cdmaEcio >= -130) levelEcio = SIGNAL_STRENGTH_MODERATE;
|
||||
@@ -199,14 +200,14 @@ public final class CellSignalStrengthCdma extends CellSignalStrength implements
|
||||
int levelEvdoDbm;
|
||||
int levelEvdoSnr;
|
||||
|
||||
if (evdoDbm == Integer.MAX_VALUE) levelEvdoDbm = SIGNAL_STRENGTH_NONE_OR_UNKNOWN;
|
||||
if (evdoDbm == CellInfo.UNAVAILABLE) levelEvdoDbm = SIGNAL_STRENGTH_NONE_OR_UNKNOWN;
|
||||
else if (evdoDbm >= -65) levelEvdoDbm = SIGNAL_STRENGTH_GREAT;
|
||||
else if (evdoDbm >= -75) levelEvdoDbm = SIGNAL_STRENGTH_GOOD;
|
||||
else if (evdoDbm >= -90) levelEvdoDbm = SIGNAL_STRENGTH_MODERATE;
|
||||
else if (evdoDbm >= -105) levelEvdoDbm = SIGNAL_STRENGTH_POOR;
|
||||
else levelEvdoDbm = SIGNAL_STRENGTH_NONE_OR_UNKNOWN;
|
||||
|
||||
if (evdoSnr == Integer.MAX_VALUE) levelEvdoSnr = SIGNAL_STRENGTH_NONE_OR_UNKNOWN;
|
||||
if (evdoSnr == CellInfo.UNAVAILABLE) levelEvdoSnr = SIGNAL_STRENGTH_NONE_OR_UNKNOWN;
|
||||
else if (evdoSnr >= 7) levelEvdoSnr = SIGNAL_STRENGTH_GREAT;
|
||||
else if (evdoSnr >= 5) levelEvdoSnr = SIGNAL_STRENGTH_GOOD;
|
||||
else if (evdoSnr >= 3) levelEvdoSnr = SIGNAL_STRENGTH_MODERATE;
|
||||
|
||||
@@ -40,7 +40,7 @@ public final class CellSignalStrengthGsm extends CellSignalStrength implements P
|
||||
@UnsupportedAppUsage
|
||||
private int mBitErrorRate; // bit error rate (0-7, 99) as defined in TS 27.007 8.5
|
||||
@UnsupportedAppUsage
|
||||
private int mTimingAdvance; // range from 0-219 or Integer.MAX_VALUE if unknown
|
||||
private int mTimingAdvance; // range from 0-219 or CellInfo.UNAVAILABLE if unknown
|
||||
|
||||
/** @hide */
|
||||
@UnsupportedAppUsage
|
||||
@@ -50,7 +50,7 @@ public final class CellSignalStrengthGsm extends CellSignalStrength implements P
|
||||
|
||||
/** @hide */
|
||||
public CellSignalStrengthGsm(int ss, int ber) {
|
||||
this(ss, ber, Integer.MAX_VALUE);
|
||||
this(ss, ber, CellInfo.UNAVAILABLE);
|
||||
}
|
||||
|
||||
/** @hide */
|
||||
@@ -81,9 +81,9 @@ public final class CellSignalStrengthGsm extends CellSignalStrength implements P
|
||||
/** @hide */
|
||||
@Override
|
||||
public void setDefaultValues() {
|
||||
mSignalStrength = Integer.MAX_VALUE;
|
||||
mBitErrorRate = Integer.MAX_VALUE;
|
||||
mTimingAdvance = Integer.MAX_VALUE;
|
||||
mSignalStrength = CellInfo.UNAVAILABLE;
|
||||
mBitErrorRate = CellInfo.UNAVAILABLE;
|
||||
mTimingAdvance = CellInfo.UNAVAILABLE;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -112,8 +112,9 @@ public final class CellSignalStrengthGsm extends CellSignalStrength implements P
|
||||
|
||||
/**
|
||||
* Get the GSM timing advance between 0..219 symbols (normally 0..63).
|
||||
* Integer.MAX_VALUE is reported when there is no RR connection.
|
||||
* Refer to 3GPP 45.010 Sec 5.8
|
||||
* <p>{@link android.telephony.CellInfo#UNAVAILABLE UNAVAILABLE} is reported when there is no RR
|
||||
* connection. Refer to 3GPP 45.010 Sec 5.8.
|
||||
*
|
||||
* @return the current GSM timing advance, if available.
|
||||
*/
|
||||
public int getTimingAdvance() {
|
||||
@@ -128,11 +129,11 @@ public final class CellSignalStrengthGsm extends CellSignalStrength implements P
|
||||
int dBm;
|
||||
|
||||
int level = mSignalStrength;
|
||||
int asu = (level == 99 ? Integer.MAX_VALUE : level);
|
||||
if (asu != Integer.MAX_VALUE) {
|
||||
int asu = (level == 99 ? CellInfo.UNAVAILABLE : level);
|
||||
if (asu != CellInfo.UNAVAILABLE) {
|
||||
dBm = -113 + (2 * asu);
|
||||
} else {
|
||||
dBm = Integer.MAX_VALUE;
|
||||
dBm = CellInfo.UNAVAILABLE;
|
||||
}
|
||||
if (DBG) log("getDbm=" + dBm);
|
||||
return dBm;
|
||||
|
||||
@@ -85,12 +85,12 @@ public final class CellSignalStrengthLte extends CellSignalStrength implements P
|
||||
/** @hide */
|
||||
@Override
|
||||
public void setDefaultValues() {
|
||||
mSignalStrength = Integer.MAX_VALUE;
|
||||
mRsrp = Integer.MAX_VALUE;
|
||||
mRsrq = Integer.MAX_VALUE;
|
||||
mRssnr = Integer.MAX_VALUE;
|
||||
mCqi = Integer.MAX_VALUE;
|
||||
mTimingAdvance = Integer.MAX_VALUE;
|
||||
mSignalStrength = CellInfo.UNAVAILABLE;
|
||||
mRsrp = CellInfo.UNAVAILABLE;
|
||||
mRsrq = CellInfo.UNAVAILABLE;
|
||||
mRssnr = CellInfo.UNAVAILABLE;
|
||||
mCqi = CellInfo.UNAVAILABLE;
|
||||
mTimingAdvance = CellInfo.UNAVAILABLE;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -104,26 +104,27 @@ public final class CellSignalStrengthLte extends CellSignalStrength implements P
|
||||
int levelRsrp = 0;
|
||||
int levelRssnr = 0;
|
||||
|
||||
if (mRsrp == Integer.MAX_VALUE) levelRsrp = 0;
|
||||
if (mRsrp == CellInfo.UNAVAILABLE) levelRsrp = 0;
|
||||
else if (mRsrp >= -95) levelRsrp = SIGNAL_STRENGTH_GREAT;
|
||||
else if (mRsrp >= -105) levelRsrp = SIGNAL_STRENGTH_GOOD;
|
||||
else if (mRsrp >= -115) levelRsrp = SIGNAL_STRENGTH_MODERATE;
|
||||
else levelRsrp = SIGNAL_STRENGTH_POOR;
|
||||
|
||||
// See RIL_LTE_SignalStrength in ril.h
|
||||
if (mRssnr == Integer.MAX_VALUE) levelRssnr = 0;
|
||||
if (mRssnr == CellInfo.UNAVAILABLE) levelRssnr = 0;
|
||||
else if (mRssnr >= 45) levelRssnr = SIGNAL_STRENGTH_GREAT;
|
||||
else if (mRssnr >= 10) levelRssnr = SIGNAL_STRENGTH_GOOD;
|
||||
else if (mRssnr >= -30) levelRssnr = SIGNAL_STRENGTH_MODERATE;
|
||||
else levelRssnr = SIGNAL_STRENGTH_POOR;
|
||||
|
||||
int level;
|
||||
if (mRsrp == Integer.MAX_VALUE)
|
||||
if (mRsrp == CellInfo.UNAVAILABLE) {
|
||||
level = levelRssnr;
|
||||
else if (mRssnr == Integer.MAX_VALUE)
|
||||
} else if (mRssnr == CellInfo.UNAVAILABLE) {
|
||||
level = levelRsrp;
|
||||
else
|
||||
} else {
|
||||
level = (levelRssnr < levelRsrp) ? levelRssnr : levelRsrp;
|
||||
}
|
||||
|
||||
if (DBG) log("Lte rsrp level: " + levelRsrp
|
||||
+ " snr level: " + levelRssnr + " level: " + level);
|
||||
@@ -133,7 +134,8 @@ public final class CellSignalStrengthLte extends CellSignalStrength implements P
|
||||
/**
|
||||
* Get reference signal received quality
|
||||
*
|
||||
* @return the RSRQ if available or Integer.MAX_VALUE if unavailable.
|
||||
* @return the RSRQ if available or
|
||||
* {@link android.telephony.CellInfo#UNAVAILABLE UNAVAILABLE} if unavailable.
|
||||
*/
|
||||
public int getRsrq() {
|
||||
return mRsrq;
|
||||
@@ -142,7 +144,8 @@ public final class CellSignalStrengthLte extends CellSignalStrength implements P
|
||||
/**
|
||||
* Get reference signal signal-to-noise ratio
|
||||
*
|
||||
* @return the RSSNR if available or Integer.MAX_VALUE if unavailable.
|
||||
* @return the RSSNR if available or
|
||||
* {@link android.telephony.CellInfo#UNAVAILABLE UNAVAILABLE} if unavailable.
|
||||
*/
|
||||
public int getRssnr() {
|
||||
return mRssnr;
|
||||
@@ -160,7 +163,8 @@ public final class CellSignalStrengthLte extends CellSignalStrength implements P
|
||||
/**
|
||||
* Get channel quality indicator
|
||||
*
|
||||
* @return the CQI if available or Integer.MAX_VALUE if unavailable.
|
||||
* @return the CQI if available or
|
||||
* {@link android.telephony.CellInfo#UNAVAILABLE UNAVAILABLE} if unavailable.
|
||||
*/
|
||||
public int getCqi() {
|
||||
return mCqi;
|
||||
@@ -184,7 +188,7 @@ public final class CellSignalStrengthLte extends CellSignalStrength implements P
|
||||
public int getAsuLevel() {
|
||||
int lteAsuLevel = 99;
|
||||
int lteDbm = getDbm();
|
||||
if (lteDbm == Integer.MAX_VALUE) lteAsuLevel = 99;
|
||||
if (lteDbm == CellInfo.UNAVAILABLE) lteAsuLevel = 99;
|
||||
else if (lteDbm <= -140) lteAsuLevel = 0;
|
||||
else if (lteDbm >= -43) lteAsuLevel = 97;
|
||||
else lteAsuLevel = lteDbm + 140;
|
||||
@@ -194,10 +198,11 @@ public final class CellSignalStrengthLte extends CellSignalStrength implements P
|
||||
|
||||
/**
|
||||
* Get the timing advance value for LTE, as a value in range of 0..1282.
|
||||
* Integer.MAX_VALUE is reported when there is no active RRC
|
||||
* connection. Refer to 3GPP 36.213 Sec 4.2.3
|
||||
* {@link android.telephony.CellInfo#UNAVAILABLE UNAVAILABLE} is reported when there is no
|
||||
* active RRC connection. Refer to 3GPP 36.213 Sec 4.2.3
|
||||
*
|
||||
* @return the LTE timing advance if available or Integer.MAX_VALUE if unavailable.
|
||||
* @return the LTE timing advance if available or
|
||||
* {@link android.telephony.CellInfo#UNAVAILABLE UNAVAILABLE} if unavailable.
|
||||
*/
|
||||
public int getTimingAdvance() {
|
||||
return mTimingAdvance;
|
||||
@@ -252,8 +257,8 @@ public final class CellSignalStrengthLte extends CellSignalStrength implements P
|
||||
// Need to multiply rsrp and rsrq by -1
|
||||
// to ensure consistency when reading values written here
|
||||
// unless the values are invalid
|
||||
dest.writeInt(mRsrp * (mRsrp != Integer.MAX_VALUE ? -1 : 1));
|
||||
dest.writeInt(mRsrq * (mRsrq != Integer.MAX_VALUE ? -1 : 1));
|
||||
dest.writeInt(mRsrp * (mRsrp != CellInfo.UNAVAILABLE ? -1 : 1));
|
||||
dest.writeInt(mRsrq * (mRsrq != CellInfo.UNAVAILABLE ? -1 : 1));
|
||||
dest.writeInt(mRssnr);
|
||||
dest.writeInt(mCqi);
|
||||
dest.writeInt(mTimingAdvance);
|
||||
@@ -268,9 +273,9 @@ public final class CellSignalStrengthLte extends CellSignalStrength implements P
|
||||
// rsrp and rsrq are written into the parcel as positive values.
|
||||
// Need to convert into negative values unless the values are invalid
|
||||
mRsrp = in.readInt();
|
||||
if (mRsrp != Integer.MAX_VALUE) mRsrp *= -1;
|
||||
if (mRsrp != CellInfo.UNAVAILABLE) mRsrp *= -1;
|
||||
mRsrq = in.readInt();
|
||||
if (mRsrq != Integer.MAX_VALUE) mRsrq *= -1;
|
||||
if (mRsrq != CellInfo.UNAVAILABLE) mRsrq *= -1;
|
||||
mRssnr = in.readInt();
|
||||
mCqi = in.readInt();
|
||||
mTimingAdvance = in.readInt();
|
||||
|
||||
@@ -36,11 +36,11 @@ public final class CellSignalStrengthTdscdma extends CellSignalStrength implemen
|
||||
private static final int TDSCDMA_SIGNAL_STRENGTH_MODERATE = 5;
|
||||
|
||||
private int mSignalStrength; // in ASU; Valid values are (0-31, 99) as defined in TS 27.007 8.5
|
||||
// or Integer.MAX_VALUE if unknown
|
||||
// or CellInfo.UNAVAILABLE if unknown
|
||||
private int mBitErrorRate; // bit error rate (0-7, 99) as defined in TS 27.007 8.5 or
|
||||
// Integer.MAX_VALUE if unknown
|
||||
private int mRscp; // Pilot power (0-96, 255) as defined in TS 27.007 8.69 or Integer.MAX_VALUE
|
||||
// if unknown
|
||||
// CellInfo.UNAVAILABLE if unknown
|
||||
private int mRscp; // Pilot power (0-96, 255) as defined in TS 27.007 8.69 or
|
||||
// CellInfo.UNAVAILABLE if unknown
|
||||
|
||||
/** @hide */
|
||||
public CellSignalStrengthTdscdma() {
|
||||
@@ -75,9 +75,9 @@ public final class CellSignalStrengthTdscdma extends CellSignalStrength implemen
|
||||
/** @hide */
|
||||
@Override
|
||||
public void setDefaultValues() {
|
||||
mSignalStrength = Integer.MAX_VALUE;
|
||||
mBitErrorRate = Integer.MAX_VALUE;
|
||||
mRscp = Integer.MAX_VALUE;
|
||||
mSignalStrength = CellInfo.UNAVAILABLE;
|
||||
mBitErrorRate = CellInfo.UNAVAILABLE;
|
||||
mRscp = CellInfo.UNAVAILABLE;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -118,11 +118,11 @@ public final class CellSignalStrengthTdscdma extends CellSignalStrength implemen
|
||||
int dBm;
|
||||
|
||||
int level = mSignalStrength;
|
||||
int asu = (level == 99 ? Integer.MAX_VALUE : level);
|
||||
if (asu != Integer.MAX_VALUE) {
|
||||
int asu = (level == 99 ? CellInfo.UNAVAILABLE : level);
|
||||
if (asu != CellInfo.UNAVAILABLE) {
|
||||
dBm = -113 + (2 * asu);
|
||||
} else {
|
||||
dBm = Integer.MAX_VALUE;
|
||||
dBm = CellInfo.UNAVAILABLE;
|
||||
}
|
||||
if (DBG) log("getDbm=" + dBm);
|
||||
return dBm;
|
||||
|
||||
@@ -37,14 +37,14 @@ public final class CellSignalStrengthWcdma extends CellSignalStrength implements
|
||||
|
||||
@UnsupportedAppUsage
|
||||
private int mSignalStrength; // in ASU; Valid values are (0-31, 99) as defined in TS 27.007 8.5
|
||||
// or Integer.MAX_VALUE if unknown
|
||||
// or CellInfo.UNAVAILABLE if unknown
|
||||
@UnsupportedAppUsage
|
||||
private int mBitErrorRate; // bit error rate (0-7, 99) as defined in TS 27.007 8.5 or
|
||||
// Integer.MAX_VALUE if unknown
|
||||
// CellInfo.UNAVAILABLE if unknown
|
||||
private int mRscp; // bit error rate (0-96, 255) as defined in TS 27.007 8.69 or
|
||||
// Integer.MAX_VALUE if unknown
|
||||
// CellInfo.UNAVAILABLE if unknown
|
||||
private int mEcNo; // signal to noise radio (0-49, 255) as defined in TS 27.007 8.69 or
|
||||
// Integer.MAX_VALUE if unknown
|
||||
// CellInfo.UNAVAILABLE if unknown
|
||||
|
||||
/** @hide */
|
||||
public CellSignalStrengthWcdma() {
|
||||
@@ -81,10 +81,10 @@ public final class CellSignalStrengthWcdma extends CellSignalStrength implements
|
||||
/** @hide */
|
||||
@Override
|
||||
public void setDefaultValues() {
|
||||
mSignalStrength = Integer.MAX_VALUE;
|
||||
mBitErrorRate = Integer.MAX_VALUE;
|
||||
mRscp = Integer.MAX_VALUE;
|
||||
mEcNo = Integer.MAX_VALUE;
|
||||
mSignalStrength = CellInfo.UNAVAILABLE;
|
||||
mBitErrorRate = CellInfo.UNAVAILABLE;
|
||||
mRscp = CellInfo.UNAVAILABLE;
|
||||
mEcNo = CellInfo.UNAVAILABLE;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -119,11 +119,11 @@ public final class CellSignalStrengthWcdma extends CellSignalStrength implements
|
||||
int dBm;
|
||||
|
||||
int level = mSignalStrength;
|
||||
int asu = (level == 99 ? Integer.MAX_VALUE : level);
|
||||
if (asu != Integer.MAX_VALUE) {
|
||||
int asu = (level == 99 ? CellInfo.UNAVAILABLE : level);
|
||||
if (asu != CellInfo.UNAVAILABLE) {
|
||||
dBm = -113 + (2 * asu);
|
||||
} else {
|
||||
dBm = Integer.MAX_VALUE;
|
||||
dBm = CellInfo.UNAVAILABLE;
|
||||
}
|
||||
if (DBG) log("getDbm=" + dBm);
|
||||
return dBm;
|
||||
|
||||
Reference in New Issue
Block a user