Merge "[Mainline] Create getDataRegistrationState and expose as system api"

am: 995d20337f

Change-Id: Ib72d9e5f82448155eb6d99b6e2e3c0fda1e0351a
This commit is contained in:
SongFerng Wang
2020-01-07 23:02:59 -08:00
committed by android-build-merger
2 changed files with 63 additions and 5 deletions

View File

@@ -8751,6 +8751,7 @@ package android.telephony {
} }
public class ServiceState implements android.os.Parcelable { public class ServiceState implements android.os.Parcelable {
method public int getDataRegistrationState();
method @Nullable public android.telephony.NetworkRegistrationInfo getNetworkRegistrationInfo(int, int); method @Nullable public android.telephony.NetworkRegistrationInfo getNetworkRegistrationInfo(int, int);
method @NonNull public java.util.List<android.telephony.NetworkRegistrationInfo> getNetworkRegistrationInfoList(); method @NonNull public java.util.List<android.telephony.NetworkRegistrationInfo> getNetworkRegistrationInfoList();
method @NonNull public java.util.List<android.telephony.NetworkRegistrationInfo> getNetworkRegistrationInfoListForDomain(int); method @NonNull public java.util.List<android.telephony.NetworkRegistrationInfo> getNetworkRegistrationInfoListForDomain(int);

View File

@@ -64,6 +64,13 @@ public class ServiceState implements Parcelable {
static final boolean DBG = false; static final boolean DBG = false;
static final boolean VDBG = false; // STOPSHIP if true static final boolean VDBG = false; // STOPSHIP if true
/** @hide */
@Retention(RetentionPolicy.SOURCE)
@IntDef(prefix = "STATE_",
value = {STATE_IN_SERVICE, STATE_OUT_OF_SERVICE, STATE_EMERGENCY_ONLY,
STATE_POWER_OFF})
public @interface RegState {}
/** /**
* Normal operation condition, the phone is registered * Normal operation condition, the phone is registered
* with an operator either in home network or in roaming. * with an operator either in home network or in roaming.
@@ -82,6 +89,7 @@ public class ServiceState implements Parcelable {
/** /**
* The phone is registered and locked. Only emergency numbers are allowed. {@more} * The phone is registered and locked. Only emergency numbers are allowed. {@more}
*/ */
//TODO: This state is not used anymore. It should be deprecated in a future release.
public static final int STATE_EMERGENCY_ONLY = public static final int STATE_EMERGENCY_ONLY =
TelephonyProtoEnums.SERVICE_STATE_EMERGENCY_ONLY; // 2 TelephonyProtoEnums.SERVICE_STATE_EMERGENCY_ONLY; // 2
@@ -530,13 +538,15 @@ public class ServiceState implements Parcelable {
} }
/** /**
* Get current data service state * Get current data registration state.
* *
* @see #STATE_IN_SERVICE * @see #STATE_IN_SERVICE
* @see #STATE_OUT_OF_SERVICE * @see #STATE_OUT_OF_SERVICE
* @see #STATE_EMERGENCY_ONLY * @see #STATE_EMERGENCY_ONLY
* @see #STATE_POWER_OFF * @see #STATE_POWER_OFF
* *
* @return current data registration state
*
* @hide * @hide
*/ */
@UnsupportedAppUsage @UnsupportedAppUsage
@@ -544,6 +554,23 @@ public class ServiceState implements Parcelable {
return mDataRegState; return mDataRegState;
} }
/**
* Get current data registration state.
*
* @see #STATE_IN_SERVICE
* @see #STATE_OUT_OF_SERVICE
* @see #STATE_EMERGENCY_ONLY
* @see #STATE_POWER_OFF
*
* @return current data registration state
*
* @hide
*/
@SystemApi
public @RegState int getDataRegistrationState() {
return getDataRegState();
}
/** /**
* Get the current duplex mode * Get the current duplex mode
* *
@@ -1437,7 +1464,15 @@ public class ServiceState implements Parcelable {
return getRilDataRadioTechnology(); return getRilDataRadioTechnology();
} }
/** @hide */ /**
* Transform RIL radio technology {@link RilRadioTechnology} value to Network
* type {@link NetworkType}.
*
* @param rat The RIL radio technology {@link RilRadioTechnology}.
* @return The network type {@link NetworkType}.
*
* @hide
*/
public static int rilRadioTechnologyToNetworkType(@RilRadioTechnology int rat) { public static int rilRadioTechnologyToNetworkType(@RilRadioTechnology int rat) {
switch(rat) { switch(rat) {
case RIL_RADIO_TECHNOLOGY_GPRS: case RIL_RADIO_TECHNOLOGY_GPRS:
@@ -1519,7 +1554,15 @@ public class ServiceState implements Parcelable {
} }
} }
/** @hide */ /**
* Transform network type {@link NetworkType} value to RIL radio technology
* {@link RilRadioTechnology}.
*
* @param networkType The network type {@link NetworkType}.
* @return The RIL radio technology {@link RilRadioTechnology}.
*
* @hide
*/
public static int networkTypeToRilRadioTechnology(int networkType) { public static int networkTypeToRilRadioTechnology(int networkType) {
switch(networkType) { switch(networkType) {
case TelephonyManager.NETWORK_TYPE_GPRS: case TelephonyManager.NETWORK_TYPE_GPRS:
@@ -1720,7 +1763,14 @@ public class ServiceState implements Parcelable {
return bearerBitmask; return bearerBitmask;
} }
/** @hide */ /**
* Convert network type bitmask to bearer bitmask.
*
* @param networkTypeBitmask The network type bitmask value
* @return The bearer bitmask value.
*
* @hide
*/
public static int convertNetworkTypeBitmaskToBearerBitmask(int networkTypeBitmask) { public static int convertNetworkTypeBitmaskToBearerBitmask(int networkTypeBitmask) {
if (networkTypeBitmask == 0) { if (networkTypeBitmask == 0) {
return 0; return 0;
@@ -1734,7 +1784,14 @@ public class ServiceState implements Parcelable {
return bearerBitmask; return bearerBitmask;
} }
/** @hide */ /**
* Convert bearer bitmask to network type bitmask.
*
* @param bearerBitmask The bearer bitmask value.
* @return The network type bitmask value.
*
* @hide
*/
public static int convertBearerBitmaskToNetworkTypeBitmask(int bearerBitmask) { public static int convertBearerBitmaskToNetworkTypeBitmask(int bearerBitmask) {
if (bearerBitmask == 0) { if (bearerBitmask == 0) {
return 0; return 0;