diff options
| -rwxr-xr-x | api/system-current.txt | 1 | ||||
| -rw-r--r-- | telephony/java/android/telephony/ServiceState.java | 67 |
2 files changed, 63 insertions, 5 deletions
diff --git a/api/system-current.txt b/api/system-current.txt index 23dd6522da82..2d0213fa3c0f 100755 --- a/api/system-current.txt +++ b/api/system-current.txt @@ -9695,6 +9695,7 @@ package android.telephony { } public class ServiceState implements android.os.Parcelable { + method public int getDataRegistrationState(); 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> getNetworkRegistrationInfoListForDomain(int); diff --git a/telephony/java/android/telephony/ServiceState.java b/telephony/java/android/telephony/ServiceState.java index d7d85c280e19..3f065f863b63 100644 --- a/telephony/java/android/telephony/ServiceState.java +++ b/telephony/java/android/telephony/ServiceState.java @@ -65,6 +65,13 @@ public class ServiceState implements Parcelable { static final boolean DBG = false; 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 * with an operator either in home network or in roaming. @@ -83,6 +90,7 @@ public class ServiceState implements Parcelable { /** * 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 = TelephonyProtoEnums.SERVICE_STATE_EMERGENCY_ONLY; // 2 @@ -501,13 +509,15 @@ public class ServiceState implements Parcelable { } /** - * Get current data service state + * 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 {@link RegState} + * * @hide */ @UnsupportedAppUsage @@ -516,6 +526,23 @@ public class ServiceState implements Parcelable { } /** + * 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 {@link RegState} + * + * @hide + */ + @SystemApi + public @RegState int getDataRegistrationState() { + return getDataRegState(); + } + + /** * Get the current duplex mode * * @see #DUPLEX_MODE_UNKNOWN @@ -1408,7 +1435,15 @@ public class ServiceState implements Parcelable { 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) { switch(rat) { case RIL_RADIO_TECHNOLOGY_GPRS: @@ -1490,7 +1525,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) { switch(networkType) { case TelephonyManager.NETWORK_TYPE_GPRS: @@ -1691,7 +1734,14 @@ public class ServiceState implements Parcelable { 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) { if (networkTypeBitmask == 0) { return 0; @@ -1705,7 +1755,14 @@ public class ServiceState implements Parcelable { 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) { if (bearerBitmask == 0) { return 0; |