summaryrefslogtreecommitdiffstats
path: root/telephony/java
diff options
context:
space:
mode:
authorAmit Mahajan <amitmahajan@google.com>2015-02-26 10:46:17 -0800
committerAmit Mahajan <amitmahajan@google.com>2015-05-01 16:40:56 +0000
commit13a98b6c6ed28bfa0cb373e49c183167699e30f0 (patch)
tree46b644eff85d3dbc31408a97df3011c7e8e79903 /telephony/java
parenta320505f3a39e21f29065f0f2a01089363825318 (diff)
downloadframeworks_base-13a98b6c6ed28bfa0cb373e49c183167699e30f0.zip
frameworks_base-13a98b6c6ed28bfa0cb373e49c183167699e30f0.tar.gz
frameworks_base-13a98b6c6ed28bfa0cb373e49c183167699e30f0.tar.bz2
Support for bearer_bitmask.
Change-Id: I7cae3d229445607c66b6472124264588f7571097
Diffstat (limited to 'telephony/java')
-rw-r--r--telephony/java/android/telephony/ServiceState.java52
1 files changed, 52 insertions, 0 deletions
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).