Merge "Add ServiceState APIs for carrier aggregation."

This commit is contained in:
Treehugger Robot
2018-01-25 07:47:55 +00:00
committed by Gerrit Code Review
2 changed files with 95 additions and 0 deletions

View File

@@ -40531,6 +40531,9 @@ package android.telephony {
ctor public ServiceState(android.os.Parcel); ctor public ServiceState(android.os.Parcel);
method protected void copyFrom(android.telephony.ServiceState); method protected void copyFrom(android.telephony.ServiceState);
method public int describeContents(); method public int describeContents();
method public int[] getCellBandwidths();
method public int getChannelNumber();
method public int getDuplexMode();
method public boolean getIsManualSelection(); method public boolean getIsManualSelection();
method public int getNetworkId(); method public int getNetworkId();
method public java.lang.String getOperatorAlphaLong(); method public java.lang.String getOperatorAlphaLong();
@@ -40547,6 +40550,9 @@ package android.telephony {
method public void setStateOutOfService(); method public void setStateOutOfService();
method public void writeToParcel(android.os.Parcel, int); method public void writeToParcel(android.os.Parcel, int);
field public static final android.os.Parcelable.Creator<android.telephony.ServiceState> CREATOR; field public static final android.os.Parcelable.Creator<android.telephony.ServiceState> CREATOR;
field public static final int DUPLEX_MODE_FDD = 1; // 0x1
field public static final int DUPLEX_MODE_TDD = 2; // 0x2
field public static final int DUPLEX_MODE_UNKNOWN = 0; // 0x0
field public static final int STATE_EMERGENCY_ONLY = 2; // 0x2 field public static final int STATE_EMERGENCY_ONLY = 2; // 0x2
field public static final int STATE_IN_SERVICE = 0; // 0x0 field public static final int STATE_IN_SERVICE = 0; // 0x0
field public static final int STATE_OUT_OF_SERVICE = 1; // 0x1 field public static final int STATE_OUT_OF_SERVICE = 1; // 0x1

View File

@@ -17,6 +17,7 @@
package android.telephony; package android.telephony;
import android.annotation.IntDef; import android.annotation.IntDef;
import android.annotation.Nullable;
import android.annotation.SystemApi; import android.annotation.SystemApi;
import android.os.Bundle; import android.os.Bundle;
import android.os.Parcel; import android.os.Parcel;
@@ -25,6 +26,7 @@ import android.text.TextUtils;
import java.lang.annotation.Retention; import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy; import java.lang.annotation.RetentionPolicy;
import java.util.Arrays;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@@ -36,6 +38,7 @@ import java.util.List;
* *
* <ul> * <ul>
* <li>Service state: IN_SERVICE, OUT_OF_SERVICE, EMERGENCY_ONLY, POWER_OFF * <li>Service state: IN_SERVICE, OUT_OF_SERVICE, EMERGENCY_ONLY, POWER_OFF
* <li>Duplex mode: UNKNOWN, FDD, TDD
* <li>Roaming indicator * <li>Roaming indicator
* <li>Operator name, short name and numeric id * <li>Operator name, short name and numeric id
* <li>Network selection mode * <li>Network selection mode
@@ -71,6 +74,26 @@ public class ServiceState implements Parcelable {
*/ */
public static final int STATE_POWER_OFF = 3; public static final int STATE_POWER_OFF = 3;
/** @hide */
@Retention(RetentionPolicy.SOURCE)
@IntDef({DUPLEX_MODE_UNKNOWN, DUPLEX_MODE_FDD, DUPLEX_MODE_TDD})
public @interface DuplexMode {}
/**
* Duplex mode for the phone is unknown.
*/
public static final int DUPLEX_MODE_UNKNOWN = 0;
/**
* Duplex mode for the phone is frequency-division duplexing.
*/
public static final int DUPLEX_MODE_FDD = 1;
/**
* Duplex mode for the phone is time-division duplexing.
*/
public static final int DUPLEX_MODE_TDD = 2;
/** /**
* RIL level registration state values from ril.h * RIL level registration state values from ril.h
* ((const char **)response)[0] is registration state 0-6, * ((const char **)response)[0] is registration state 0-6,
@@ -286,6 +309,9 @@ public class ServiceState implements Parcelable {
private boolean mIsUsingCarrierAggregation; private boolean mIsUsingCarrierAggregation;
private int mChannelNumber;
private int[] mCellBandwidths = new int[0];
/* EARFCN stands for E-UTRA Absolute Radio Frequency Channel Number, /* EARFCN stands for E-UTRA Absolute Radio Frequency Channel Number,
* Reference: 3GPP TS 36.104 5.4.3 */ * Reference: 3GPP TS 36.104 5.4.3 */
private int mLteEarfcnRsrpBoost = 0; private int mLteEarfcnRsrpBoost = 0;
@@ -405,6 +431,8 @@ public class ServiceState implements Parcelable {
mLteEarfcnRsrpBoost = in.readInt(); mLteEarfcnRsrpBoost = in.readInt();
mNetworkRegistrationStates = new ArrayList<>(); mNetworkRegistrationStates = new ArrayList<>();
in.readList(mNetworkRegistrationStates, NetworkRegistrationState.class.getClassLoader()); in.readList(mNetworkRegistrationStates, NetworkRegistrationState.class.getClassLoader());
mChannelNumber = in.readInt();
mCellBandwidths = in.createIntArray();
} }
public void writeToParcel(Parcel out, int flags) { public void writeToParcel(Parcel out, int flags) {
@@ -433,6 +461,8 @@ public class ServiceState implements Parcelable {
out.writeInt(mIsUsingCarrierAggregation ? 1 : 0); out.writeInt(mIsUsingCarrierAggregation ? 1 : 0);
out.writeInt(mLteEarfcnRsrpBoost); out.writeInt(mLteEarfcnRsrpBoost);
out.writeList(mNetworkRegistrationStates); out.writeList(mNetworkRegistrationStates);
out.writeInt(mChannelNumber);
out.writeIntArray(mCellBandwidths);
} }
public int describeContents() { public int describeContents() {
@@ -485,6 +515,43 @@ public class ServiceState implements Parcelable {
return mDataRegState; return mDataRegState;
} }
/**
* Get the current duplex mode
*
* @see #DUPLEX_MODE_UNKNOWN
* @see #DUPLEX_MODE_FDD
* @see #DUPLEX_MODE_TDD
*
* @return Current {@code DuplexMode} for the phone
*/
@DuplexMode
public int getDuplexMode() {
// TODO(b/72117602) determine duplex mode from channel number, using 3GPP 36.101 sections
// 5.7.3-1 and 5.5-1
return DUPLEX_MODE_UNKNOWN;
}
/**
* Get the channel number of the current primary serving cell, or -1 if unknown
*
* <p>This is EARFCN for LTE, UARFCN for UMTS, and ARFCN for GSM.
*
* @return Channel number of primary serving cell
*/
public int getChannelNumber() {
return mChannelNumber;
}
/**
* Get an array of cell bandwidths (kHz) for the current serving cells
*
* @return Current serving cell bandwidths
*/
@Nullable
public int[] getCellBandwidths() {
return mCellBandwidths;
}
/** /**
* Get current roaming indicator of phone * Get current roaming indicator of phone
* (note: not just decoding from TS 27.007 7.2) * (note: not just decoding from TS 27.007 7.2)
@@ -713,6 +780,8 @@ public class ServiceState implements Parcelable {
+ (mDataRegState * 37) + (mDataRegState * 37)
+ mVoiceRoamingType + mVoiceRoamingType
+ mDataRoamingType + mDataRoamingType
+ mChannelNumber
+ Arrays.hashCode(mCellBandwidths)
+ (mIsManualNetworkSelection ? 1 : 0) + (mIsManualNetworkSelection ? 1 : 0)
+ ((null == mVoiceOperatorAlphaLong) ? 0 : mVoiceOperatorAlphaLong.hashCode()) + ((null == mVoiceOperatorAlphaLong) ? 0 : mVoiceOperatorAlphaLong.hashCode())
+ ((null == mVoiceOperatorAlphaShort) ? 0 : mVoiceOperatorAlphaShort.hashCode()) + ((null == mVoiceOperatorAlphaShort) ? 0 : mVoiceOperatorAlphaShort.hashCode())
@@ -745,6 +814,8 @@ public class ServiceState implements Parcelable {
&& mIsManualNetworkSelection == s.mIsManualNetworkSelection && mIsManualNetworkSelection == s.mIsManualNetworkSelection
&& mVoiceRoamingType == s.mVoiceRoamingType && mVoiceRoamingType == s.mVoiceRoamingType
&& mDataRoamingType == s.mDataRoamingType && mDataRoamingType == s.mDataRoamingType
&& mChannelNumber == s.mChannelNumber
&& Arrays.equals(mCellBandwidths, s.mCellBandwidths)
&& equalsHandlesNulls(mVoiceOperatorAlphaLong, s.mVoiceOperatorAlphaLong) && equalsHandlesNulls(mVoiceOperatorAlphaLong, s.mVoiceOperatorAlphaLong)
&& equalsHandlesNulls(mVoiceOperatorAlphaShort, s.mVoiceOperatorAlphaShort) && equalsHandlesNulls(mVoiceOperatorAlphaShort, s.mVoiceOperatorAlphaShort)
&& equalsHandlesNulls(mVoiceOperatorNumeric, s.mVoiceOperatorNumeric) && equalsHandlesNulls(mVoiceOperatorNumeric, s.mVoiceOperatorNumeric)
@@ -874,6 +945,8 @@ public class ServiceState implements Parcelable {
.append("(" + rilServiceStateToString(mVoiceRegState) + ")") .append("(" + rilServiceStateToString(mVoiceRegState) + ")")
.append(", mDataRegState=").append(mDataRegState) .append(", mDataRegState=").append(mDataRegState)
.append("(" + rilServiceStateToString(mDataRegState) + ")") .append("(" + rilServiceStateToString(mDataRegState) + ")")
.append(", mChannelNumber=").append(mChannelNumber)
.append(", mCellBandwidths=").append(Arrays.toString(mCellBandwidths))
.append(", mVoiceRoamingType=").append(getRoamingLogString(mVoiceRoamingType)) .append(", mVoiceRoamingType=").append(getRoamingLogString(mVoiceRoamingType))
.append(", mDataRoamingType=").append(getRoamingLogString(mDataRoamingType)) .append(", mDataRoamingType=").append(getRoamingLogString(mDataRoamingType))
.append(", mVoiceOperatorAlphaLong=").append(mVoiceOperatorAlphaLong) .append(", mVoiceOperatorAlphaLong=").append(mVoiceOperatorAlphaLong)
@@ -905,6 +978,8 @@ public class ServiceState implements Parcelable {
mDataRegState = state; mDataRegState = state;
mVoiceRoamingType = ROAMING_TYPE_NOT_ROAMING; mVoiceRoamingType = ROAMING_TYPE_NOT_ROAMING;
mDataRoamingType = ROAMING_TYPE_NOT_ROAMING; mDataRoamingType = ROAMING_TYPE_NOT_ROAMING;
mChannelNumber = -1;
mCellBandwidths = new int[0];
mVoiceOperatorAlphaLong = null; mVoiceOperatorAlphaLong = null;
mVoiceOperatorAlphaShort = null; mVoiceOperatorAlphaShort = null;
mVoiceOperatorNumeric = null; mVoiceOperatorNumeric = null;
@@ -953,6 +1028,16 @@ public class ServiceState implements Parcelable {
if (VDBG) Rlog.d(LOG_TAG, "[ServiceState] setDataRegState=" + mDataRegState); if (VDBG) Rlog.d(LOG_TAG, "[ServiceState] setDataRegState=" + mDataRegState);
} }
/** @hide */
public void setCellBandwidths(int[] bandwidths) {
mCellBandwidths = bandwidths;
}
/** @hide */
public void setChannelNumber(int channelNumber) {
mChannelNumber = channelNumber;
}
public void setRoaming(boolean roaming) { public void setRoaming(boolean roaming) {
mVoiceRoamingType = (roaming ? ROAMING_TYPE_UNKNOWN : ROAMING_TYPE_NOT_ROAMING); mVoiceRoamingType = (roaming ? ROAMING_TYPE_UNKNOWN : ROAMING_TYPE_NOT_ROAMING);
mDataRoamingType = mVoiceRoamingType; mDataRoamingType = mVoiceRoamingType;
@@ -1101,6 +1186,8 @@ public class ServiceState implements Parcelable {
mIsDataRoamingFromRegistration = m.getBoolean("isDataRoamingFromRegistration"); mIsDataRoamingFromRegistration = m.getBoolean("isDataRoamingFromRegistration");
mIsUsingCarrierAggregation = m.getBoolean("isUsingCarrierAggregation"); mIsUsingCarrierAggregation = m.getBoolean("isUsingCarrierAggregation");
mLteEarfcnRsrpBoost = m.getInt("LteEarfcnRsrpBoost"); mLteEarfcnRsrpBoost = m.getInt("LteEarfcnRsrpBoost");
mChannelNumber = m.getInt("ChannelNumber");
mCellBandwidths = m.getIntArray("CellBandwidths");
} }
/** /**
@@ -1132,6 +1219,8 @@ public class ServiceState implements Parcelable {
m.putBoolean("isDataRoamingFromRegistration", mIsDataRoamingFromRegistration); m.putBoolean("isDataRoamingFromRegistration", mIsDataRoamingFromRegistration);
m.putBoolean("isUsingCarrierAggregation", mIsUsingCarrierAggregation); m.putBoolean("isUsingCarrierAggregation", mIsUsingCarrierAggregation);
m.putInt("LteEarfcnRsrpBoost", mLteEarfcnRsrpBoost); m.putInt("LteEarfcnRsrpBoost", mLteEarfcnRsrpBoost);
m.putInt("ChannelNumber", mChannelNumber);
m.putIntArray("CellBandwidths", mCellBandwidths);
} }
/** @hide */ /** @hide */