diff options
-rw-r--r-- | api/current.txt | 3 | ||||
-rw-r--r-- | telephony/java/android/telephony/ServiceState.java | 66 | ||||
-rw-r--r-- | telephony/java/android/telephony/Telephony.java | 11 |
3 files changed, 78 insertions, 2 deletions
diff --git a/api/current.txt b/api/current.txt index 96cf1fccc9e7..120d00e4134c 100644 --- a/api/current.txt +++ b/api/current.txt @@ -35516,7 +35516,7 @@ package android.provider { public static final class Telephony.Carriers implements android.provider.BaseColumns { field public static final java.lang.String APN = "apn"; field public static final java.lang.String AUTH_TYPE = "authtype"; - field public static final java.lang.String BEARER = "bearer"; + field public static final deprecated java.lang.String BEARER = "bearer"; field public static final java.lang.String CARRIER_ENABLED = "carrier_enabled"; field public static final android.net.Uri CONTENT_URI; field public static final java.lang.String CURRENT = "current"; @@ -35529,6 +35529,7 @@ package android.provider { field public static final java.lang.String MVNO_MATCH_DATA = "mvno_match_data"; field public static final java.lang.String MVNO_TYPE = "mvno_type"; field public static final java.lang.String NAME = "name"; + field public static final java.lang.String NETWORK_TYPE_BITMASK = "network_type_bitmask"; field public static final java.lang.String NUMERIC = "numeric"; field public static final java.lang.String PASSWORD = "password"; field public static final java.lang.String PORT = "port"; diff --git a/telephony/java/android/telephony/ServiceState.java b/telephony/java/android/telephony/ServiceState.java index 116e711ee886..254970bbe6e9 100644 --- a/telephony/java/android/telephony/ServiceState.java +++ b/telephony/java/android/telephony/ServiceState.java @@ -16,12 +16,16 @@ package android.telephony; +import android.annotation.IntDef; import android.os.Bundle; import android.os.Parcel; import android.os.Parcelable; import android.telephony.Rlog; import android.text.TextUtils; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; + /** * Contains phone state and service related information. * @@ -105,6 +109,31 @@ public class ServiceState implements Parcelable { /** @hide */ public static final int RIL_REG_STATE_UNKNOWN_EMERGENCY_CALL_ENABLED = 14; + /** @hide */ + @Retention(RetentionPolicy.SOURCE) + @IntDef(prefix = { "RIL_RADIO_TECHNOLOGY_" }, + value = { + RIL_RADIO_TECHNOLOGY_UNKNOWN, + RIL_RADIO_TECHNOLOGY_GPRS, + RIL_RADIO_TECHNOLOGY_EDGE, + RIL_RADIO_TECHNOLOGY_UMTS, + RIL_RADIO_TECHNOLOGY_IS95A, + RIL_RADIO_TECHNOLOGY_IS95B, + RIL_RADIO_TECHNOLOGY_1xRTT, + RIL_RADIO_TECHNOLOGY_EVDO_0, + RIL_RADIO_TECHNOLOGY_EVDO_A, + RIL_RADIO_TECHNOLOGY_HSDPA, + RIL_RADIO_TECHNOLOGY_HSUPA, + RIL_RADIO_TECHNOLOGY_HSPA, + RIL_RADIO_TECHNOLOGY_EVDO_B, + RIL_RADIO_TECHNOLOGY_EHRPD, + RIL_RADIO_TECHNOLOGY_LTE, + RIL_RADIO_TECHNOLOGY_HSPAP, + RIL_RADIO_TECHNOLOGY_GSM, + RIL_RADIO_TECHNOLOGY_TD_SCDMA, + RIL_RADIO_TECHNOLOGY_IWLAN, + RIL_RADIO_TECHNOLOGY_LTE_CA}) + public @interface RilRadioTechnology {} /** * Available radio technologies for GSM, UMTS and CDMA. * Duplicates the constants from hardware/radio/include/ril.h @@ -162,6 +191,12 @@ public class ServiceState implements Parcelable { */ public static final int RIL_RADIO_TECHNOLOGY_LTE_CA = 19; + /** + * Number of radio technologies for GSM, UMTS and CDMA. + * @hide + */ + private static final int NEXT_RIL_RADIO_TECHNOLOGY = 20; + /** @hide */ public static final int RIL_RADIO_CDMA_TECHNOLOGY_BITMASK = (1 << (RIL_RADIO_TECHNOLOGY_IS95A - 1)) @@ -1153,7 +1188,8 @@ public class ServiceState implements Parcelable { return getRilDataRadioTechnology(); } - private int rilRadioTechnologyToNetworkType(int rt) { + /** @hide */ + public static int rilRadioTechnologyToNetworkType(@RilRadioTechnology int rt) { switch(rt) { case ServiceState.RIL_RADIO_TECHNOLOGY_GPRS: return TelephonyManager.NETWORK_TYPE_GPRS; @@ -1300,6 +1336,34 @@ public class ServiceState implements Parcelable { return bearerBitmask; } + /** @hide */ + public static int convertNetworkTypeBitmaskToBearerBitmask(int networkTypeBitmask) { + if (networkTypeBitmask == 0) { + return 0; + } + int bearerBitmask = 0; + for (int bearerInt = 0; bearerInt < NEXT_RIL_RADIO_TECHNOLOGY; bearerInt++) { + if (bitmaskHasTech(networkTypeBitmask, rilRadioTechnologyToNetworkType(bearerInt))) { + bearerBitmask |= getBitmaskForTech(bearerInt); + } + } + return bearerBitmask; + } + + /** @hide */ + public static int convertBearerBitmaskToNetworkTypeBitmask(int bearerBitmask) { + if (bearerBitmask == 0) { + return 0; + } + int networkTypeBitmask = 0; + for (int bearerInt = 0; bearerInt < NEXT_RIL_RADIO_TECHNOLOGY; bearerInt++) { + if (bitmaskHasTech(bearerBitmask, bearerInt)) { + networkTypeBitmask |= getBitmaskForTech(rilRadioTechnologyToNetworkType(bearerInt)); + } + } + return networkTypeBitmask; + } + /** * Returns a merged ServiceState consisting of the base SS with voice settings from the * voice SS. The voice SS is only used if it is IN_SERVICE (otherwise the base SS is returned). diff --git a/telephony/java/android/telephony/Telephony.java b/telephony/java/android/telephony/Telephony.java index 942ea009f684..e0b6f610ab55 100644 --- a/telephony/java/android/telephony/Telephony.java +++ b/telephony/java/android/telephony/Telephony.java @@ -2693,6 +2693,7 @@ public final class Telephony { * but is currently only used for LTE (14) and eHRPD (13). * <P>Type: INTEGER</P> */ + @Deprecated public static final String BEARER = "bearer"; /** @@ -2704,9 +2705,19 @@ public final class Telephony { * <P>Type: INTEGER</P> * @hide */ + @Deprecated public static final String BEARER_BITMASK = "bearer_bitmask"; /** + * Radio technology (network type) bitmask. + * To check what values can be contained, refer to + * {@link android.telephony.TelephonyManager}. + * Bitmask for a radio tech R is (1 << (R - 1)) + * <P>Type: INTEGER</P> + */ + public static final String NETWORK_TYPE_BITMASK = "network_type_bitmask"; + + /** * MVNO type: * {@code SPN (Service Provider Name), IMSI, GID (Group Identifier Level 1)}. * <P>Type: TEXT</P> |