Merge "Update CellInfo API to accomodate new fields."
am: 7e73c73f89
Change-Id: Ib82c77d3b5559d593dbb3181add634eee251f53b
This commit is contained in:
@@ -40174,6 +40174,7 @@ package android.telephony {
|
||||
}
|
||||
|
||||
public final class CellIdentityLte extends android.telephony.CellIdentity {
|
||||
method public int getBandwidth();
|
||||
method public int getCi();
|
||||
method public int getEarfcn();
|
||||
method public deprecated int getMcc();
|
||||
@@ -40217,8 +40218,13 @@ package android.telephony {
|
||||
|
||||
public abstract class CellInfo implements android.os.Parcelable {
|
||||
method public int describeContents();
|
||||
method public int getCellConnectionStatus();
|
||||
method public long getTimeStamp();
|
||||
method public boolean isRegistered();
|
||||
field public static final int CONNECTION_NONE = 0; // 0x0
|
||||
field public static final int CONNECTION_PRIMARY_SERVING = 1; // 0x1
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
@@ -40,6 +40,8 @@ public final class CellIdentityLte extends CellIdentity {
|
||||
private final String mAlphaLong;
|
||||
// short alpha Operator Name String or Enhanced Operator Name String
|
||||
private final String mAlphaShort;
|
||||
// cell bandwidth, in kHz
|
||||
private final int mBandwidth;
|
||||
|
||||
/**
|
||||
* @hide
|
||||
@@ -50,6 +52,7 @@ public final class CellIdentityLte extends CellIdentity {
|
||||
mPci = Integer.MAX_VALUE;
|
||||
mTac = Integer.MAX_VALUE;
|
||||
mEarfcn = Integer.MAX_VALUE;
|
||||
mBandwidth = Integer.MAX_VALUE;
|
||||
mAlphaLong = null;
|
||||
mAlphaShort = null;
|
||||
}
|
||||
@@ -65,7 +68,8 @@ public final class CellIdentityLte extends CellIdentity {
|
||||
* @hide
|
||||
*/
|
||||
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, Integer.MAX_VALUE, String.valueOf(mcc),
|
||||
String.valueOf(mnc), null, null);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -80,7 +84,8 @@ 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, String.valueOf(mcc), String.valueOf(mnc), null, null);
|
||||
this(ci, pci, tac, earfcn, Integer.MAX_VALUE, String.valueOf(mcc), String.valueOf(mnc),
|
||||
null, null);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -89,6 +94,7 @@ public final class CellIdentityLte extends CellIdentity {
|
||||
* @param pci Physical Cell Id 0..503
|
||||
* @param tac 16-bit Tracking Area Code
|
||||
* @param earfcn 18-bit LTE Absolute RF Channel Number
|
||||
* @param bandwidth cell bandwidth in kHz
|
||||
* @param mccStr 3-digit Mobile Country Code in string format
|
||||
* @param mncStr 2 or 3-digit Mobile Network Code in string format
|
||||
* @param alphal long alpha Operator Name String or Enhanced Operator Name String
|
||||
@@ -96,19 +102,20 @@ public final class CellIdentityLte extends CellIdentity {
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
public CellIdentityLte(int ci, int pci, int tac, int earfcn, String mccStr,
|
||||
String mncStr, String alphal, String alphas) {
|
||||
public CellIdentityLte(int ci, int pci, int tac, int earfcn, int bandwidth, String mccStr,
|
||||
String mncStr, String alphal, String alphas) {
|
||||
super(TAG, TYPE_LTE, mccStr, mncStr);
|
||||
mCi = ci;
|
||||
mPci = pci;
|
||||
mTac = tac;
|
||||
mEarfcn = earfcn;
|
||||
mBandwidth = bandwidth;
|
||||
mAlphaLong = alphal;
|
||||
mAlphaShort = alphas;
|
||||
}
|
||||
|
||||
private CellIdentityLte(CellIdentityLte cid) {
|
||||
this(cid.mCi, cid.mPci, cid.mTac, cid.mEarfcn, cid.mMccStr,
|
||||
this(cid.mCi, cid.mPci, cid.mTac, cid.mEarfcn, cid.mBandwidth, cid.mMccStr,
|
||||
cid.mMncStr, cid.mAlphaLong, cid.mAlphaShort);
|
||||
}
|
||||
|
||||
@@ -162,6 +169,13 @@ public final class CellIdentityLte extends CellIdentity {
|
||||
return mEarfcn;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Cell bandwidth in kHz, Integer.MAX_VALUE if unknown
|
||||
*/
|
||||
public int getBandwidth() {
|
||||
return mBandwidth;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Mobile Country Code in string format, null if unknown
|
||||
*/
|
||||
@@ -219,6 +233,7 @@ public final class CellIdentityLte extends CellIdentity {
|
||||
&& mPci == o.mPci
|
||||
&& mTac == o.mTac
|
||||
&& mEarfcn == o.mEarfcn
|
||||
&& mBandwidth == o.mBandwidth
|
||||
&& TextUtils.equals(mMccStr, o.mMccStr)
|
||||
&& TextUtils.equals(mMncStr, o.mMncStr)
|
||||
&& TextUtils.equals(mAlphaLong, o.mAlphaLong)
|
||||
@@ -232,6 +247,7 @@ public final class CellIdentityLte extends CellIdentity {
|
||||
.append(" mPci=").append(mPci)
|
||||
.append(" mTac=").append(mTac)
|
||||
.append(" mEarfcn=").append(mEarfcn)
|
||||
.append(" mBandwidth=").append(mBandwidth)
|
||||
.append(" mMcc=").append(mMccStr)
|
||||
.append(" mMnc=").append(mMncStr)
|
||||
.append(" mAlphaLong=").append(mAlphaLong)
|
||||
@@ -248,6 +264,7 @@ public final class CellIdentityLte extends CellIdentity {
|
||||
dest.writeInt(mPci);
|
||||
dest.writeInt(mTac);
|
||||
dest.writeInt(mEarfcn);
|
||||
dest.writeInt(mBandwidth);
|
||||
dest.writeString(mAlphaLong);
|
||||
dest.writeString(mAlphaShort);
|
||||
}
|
||||
@@ -259,6 +276,7 @@ public final class CellIdentityLte extends CellIdentity {
|
||||
mPci = in.readInt();
|
||||
mTac = in.readInt();
|
||||
mEarfcn = in.readInt();
|
||||
mBandwidth = in.readInt();
|
||||
mAlphaLong = in.readString();
|
||||
mAlphaShort = in.readString();
|
||||
|
||||
|
||||
@@ -16,8 +16,11 @@
|
||||
|
||||
package android.telephony;
|
||||
|
||||
import android.annotation.IntDef;
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
|
||||
/**
|
||||
* Immutable cell information from a point in time.
|
||||
@@ -47,6 +50,34 @@ public abstract class CellInfo implements Parcelable {
|
||||
/** @hide */
|
||||
public static final int TIMESTAMP_TYPE_JAVA_RIL = 4;
|
||||
|
||||
/** @hide */
|
||||
@Retention(RetentionPolicy.SOURCE)
|
||||
@IntDef({
|
||||
CONNECTION_NONE,
|
||||
CONNECTION_PRIMARY_SERVING,
|
||||
CONNECTION_SECONDARY_SERVING,
|
||||
CONNECTION_UNKNOWN
|
||||
})
|
||||
public @interface CellConnectionStatus {}
|
||||
|
||||
/**
|
||||
* Cell is not a serving cell.
|
||||
*
|
||||
* <p>The cell has been measured but is neither a camped nor serving cell (3GPP 36.304).
|
||||
*/
|
||||
public static final int CONNECTION_NONE = 0;
|
||||
|
||||
/** UE is connected to cell for signalling and possibly data (3GPP 36.331, 25.331). */
|
||||
public static final int CONNECTION_PRIMARY_SERVING = 1;
|
||||
|
||||
/** UE is connected to cell for data (3GPP 36.331, 25.331). */
|
||||
public static final int CONNECTION_SECONDARY_SERVING = 2;
|
||||
|
||||
/** Connection status is unknown. */
|
||||
public static final int CONNECTION_UNKNOWN = Integer.MAX_VALUE;
|
||||
|
||||
private int mCellConnectionStatus = CONNECTION_NONE;
|
||||
|
||||
// True if device is mRegistered to the mobile network
|
||||
private boolean mRegistered;
|
||||
|
||||
@@ -69,6 +100,7 @@ public abstract class CellInfo implements Parcelable {
|
||||
this.mRegistered = ci.mRegistered;
|
||||
this.mTimeStampType = ci.mTimeStampType;
|
||||
this.mTimeStamp = ci.mTimeStamp;
|
||||
this.mCellConnectionStatus = ci.mCellConnectionStatus;
|
||||
}
|
||||
|
||||
/** True if this cell is registered to the mobile network */
|
||||
@@ -89,6 +121,25 @@ public abstract class CellInfo implements Parcelable {
|
||||
mTimeStamp = timeStamp;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the connection status of this cell.
|
||||
*
|
||||
* @see #CONNECTION_NONE
|
||||
* @see #CONNECTION_PRIMARY_SERVING
|
||||
* @see #CONNECTION_SECONDARY_SERVING
|
||||
* @see #CONNECTION_UNKNOWN
|
||||
*
|
||||
* @return The connection status of the cell.
|
||||
*/
|
||||
@CellConnectionStatus
|
||||
public int getCellConnectionStatus() {
|
||||
return mCellConnectionStatus;
|
||||
}
|
||||
/** @hide */
|
||||
public void setCellConnectionStatus(@CellConnectionStatus int cellConnectionStatus) {
|
||||
mCellConnectionStatus = cellConnectionStatus;
|
||||
}
|
||||
|
||||
/**
|
||||
* Where time stamp gets recorded.
|
||||
* @return one of TIMESTAMP_TYPE_XXXX
|
||||
@@ -111,7 +162,7 @@ public abstract class CellInfo implements Parcelable {
|
||||
public int hashCode() {
|
||||
int primeNum = 31;
|
||||
return ((mRegistered ? 0 : 1) * primeNum) + ((int)(mTimeStamp / 1000) * primeNum)
|
||||
+ (mTimeStampType * primeNum);
|
||||
+ (mTimeStampType * primeNum) + (mCellConnectionStatus * primeNum);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -125,7 +176,9 @@ public abstract class CellInfo implements Parcelable {
|
||||
try {
|
||||
CellInfo o = (CellInfo) other;
|
||||
return mRegistered == o.mRegistered
|
||||
&& mTimeStamp == o.mTimeStamp && mTimeStampType == o.mTimeStampType;
|
||||
&& mTimeStamp == o.mTimeStamp
|
||||
&& mTimeStampType == o.mTimeStampType
|
||||
&& mCellConnectionStatus == o.mCellConnectionStatus;
|
||||
} catch (ClassCastException e) {
|
||||
return false;
|
||||
}
|
||||
@@ -155,6 +208,7 @@ public abstract class CellInfo implements Parcelable {
|
||||
timeStampType = timeStampTypeToString(mTimeStampType);
|
||||
sb.append(" mTimeStampType=").append(timeStampType);
|
||||
sb.append(" mTimeStamp=").append(mTimeStamp).append("ns");
|
||||
sb.append(" mCellConnectionStatus=").append(mCellConnectionStatus);
|
||||
|
||||
return sb.toString();
|
||||
}
|
||||
@@ -181,6 +235,7 @@ public abstract class CellInfo implements Parcelable {
|
||||
dest.writeInt(mRegistered ? 1 : 0);
|
||||
dest.writeInt(mTimeStampType);
|
||||
dest.writeLong(mTimeStamp);
|
||||
dest.writeInt(mCellConnectionStatus);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -192,6 +247,7 @@ public abstract class CellInfo implements Parcelable {
|
||||
mRegistered = (in.readInt() == 1) ? true : false;
|
||||
mTimeStampType = in.readInt();
|
||||
mTimeStamp = in.readLong();
|
||||
mCellConnectionStatus = in.readInt();
|
||||
}
|
||||
|
||||
/** Implement the Parcelable interface */
|
||||
|
||||
Reference in New Issue
Block a user