diff options
author | Amit Mahajan <amitmahajan@google.com> | 2015-02-26 10:46:17 -0800 |
---|---|---|
committer | Amit Mahajan <amitmahajan@google.com> | 2015-05-01 16:40:56 +0000 |
commit | 13a98b6c6ed28bfa0cb373e49c183167699e30f0 (patch) | |
tree | 46b644eff85d3dbc31408a97df3011c7e8e79903 | |
parent | a320505f3a39e21f29065f0f2a01089363825318 (diff) | |
download | frameworks_base-13a98b6c6ed28bfa0cb373e49c183167699e30f0.zip frameworks_base-13a98b6c6ed28bfa0cb373e49c183167699e30f0.tar.gz frameworks_base-13a98b6c6ed28bfa0cb373e49c183167699e30f0.tar.bz2 |
Support for bearer_bitmask.
Change-Id: I7cae3d229445607c66b6472124264588f7571097
-rw-r--r-- | api/current.txt | 3 | ||||
-rw-r--r-- | api/system-current.txt | 3 | ||||
-rw-r--r-- | telephony/java/android/telephony/ServiceState.java | 52 |
3 files changed, 56 insertions, 2 deletions
diff --git a/api/current.txt b/api/current.txt index 88b219c..c2ea905 100644 --- a/api/current.txt +++ b/api/current.txt @@ -27164,7 +27164,8 @@ 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 BEARER_BITMASK = "bearer_bitmask"; 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"; diff --git a/api/system-current.txt b/api/system-current.txt index 9b7d15c..f5212a3 100644 --- a/api/system-current.txt +++ b/api/system-current.txt @@ -29177,7 +29177,8 @@ 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 BEARER_BITMASK = "bearer_bitmask"; 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"; diff --git a/telephony/java/android/telephony/ServiceState.java b/telephony/java/android/telephony/ServiceState.java index cdecb33..303a492 100644 --- a/telephony/java/android/telephony/ServiceState.java +++ b/telephony/java/android/telephony/ServiceState.java @@ -1104,6 +1104,58 @@ public class ServiceState implements Parcelable { || radioTechnology == RIL_RADIO_TECHNOLOGY_EHRPD; } + /** @hide */ + public static boolean hasCdma(int radioTechnologyBitmask) { + int cdmaBitmask = (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_EVDO_B + | RIL_RADIO_TECHNOLOGY_EHRPD); + + return ((radioTechnologyBitmask & cdmaBitmask) != 0); + } + + /** @hide */ + public static boolean bitmaskHasTech(int bearerBitmask, int radioTech) { + if (bearerBitmask == 0) { + return true; + } else if (radioTech >= 1) { + return ((bearerBitmask & (1 << (radioTech - 1))) != 0); + } + return false; + } + + /** @hide */ + public static int getBitmaskForTech(int radioTech) { + if (radioTech >= 1) { + return (1 << (radioTech - 1)); + } + return 0; + } + + /** @hide */ + public static int getBitmaskFromString(String bearerList) { + String[] bearers = bearerList.split("\\|"); + int bearerBitmask = 0; + for (String bearer : bearers) { + int bearerInt = 0; + try { + bearerInt = Integer.parseInt(bearer.trim()); + } catch (NumberFormatException nfe) { + return 0; + } + + if (bearerInt == 0) { + return 0; + } + + bearerBitmask |= getBitmaskForTech(bearerInt); + } + return bearerBitmask; + } + /** * 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). |