diff options
| author | 2022-05-03 07:28:19 +0000 | |
|---|---|---|
| committer | 2022-05-03 07:28:19 +0000 | |
| commit | 2ca9a7aeaa4bf3a21827140df90bcee17fbab010 (patch) | |
| tree | a5968963e8fe8bffe1d0b66e400391bb99240b2c | |
| parent | d24351d56e6509fc3aa8989e39154668f508ac85 (diff) | |
| parent | 6b7f9df1de1f9405680cb26ea1ca0f187a56818b (diff) | |
Merge "Update API doc for accidentally exposed NETWORK_TYPE_BITMASK_LTE_CA"
| -rw-r--r-- | telephony/java/android/telephony/TelephonyManager.java | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/telephony/java/android/telephony/TelephonyManager.java b/telephony/java/android/telephony/TelephonyManager.java index b4825153bf0a..56988ae0944d 100644 --- a/telephony/java/android/telephony/TelephonyManager.java +++ b/telephony/java/android/telephony/TelephonyManager.java @@ -9051,6 +9051,7 @@ public class TelephonyManager { try { ITelephony telephony = getITelephony(); if (telephony != null) { + networkTypeBitmask = checkNetworkTypeBitmask(networkTypeBitmask); return telephony.setAllowedNetworkTypesForReason(getSubId(), TelephonyManager.ALLOWED_NETWORK_TYPES_REASON_USER, networkTypeBitmask); } @@ -9061,6 +9062,20 @@ public class TelephonyManager { } /** + * If {@link #NETWORK_TYPE_BITMASK_LTE_CA} bit is set, convert it to NETWORK_TYPE_BITMASK_LTE. + * + * @param networkTypeBitmask The networkTypeBitmask being checked + * @return The checked/converted networkTypeBitmask + */ + private long checkNetworkTypeBitmask(@NetworkTypeBitMask long networkTypeBitmask) { + if ((networkTypeBitmask & NETWORK_TYPE_BITMASK_LTE_CA) != 0) { + networkTypeBitmask ^= NETWORK_TYPE_BITMASK_LTE_CA; + networkTypeBitmask |= NETWORK_TYPE_BITMASK_LTE; + } + return networkTypeBitmask; + } + + /** * Set the allowed network types of the device. This is for carrier or privileged apps to * enable/disable certain network types on the device. The user preferred network types should * be set through {@link #setPreferredNetworkTypeBitmask}. @@ -9086,6 +9101,7 @@ public class TelephonyManager { try { ITelephony telephony = getITelephony(); if (telephony != null) { + allowedNetworkTypes = checkNetworkTypeBitmask(allowedNetworkTypes); return telephony.setAllowedNetworkTypesForReason(getSubId(), TelephonyManager.ALLOWED_NETWORK_TYPES_REASON_CARRIER, allowedNetworkTypes); } @@ -9171,6 +9187,7 @@ public class TelephonyManager { try { ITelephony telephony = getITelephony(); if (telephony != null) { + allowedNetworkTypes = checkNetworkTypeBitmask(allowedNetworkTypes); telephony.setAllowedNetworkTypesForReason(getSubId(), reason, allowedNetworkTypes); } else { @@ -13429,7 +13446,11 @@ public class TelephonyManager { */ public static final long NETWORK_TYPE_BITMASK_LTE = (1 << (NETWORK_TYPE_LTE -1)); /** + * NOT USED; this bitmask is exposed accidentally, will be deprecated in U. + * If used, will be converted to {@link #NETWORK_TYPE_BITMASK_LTE}. * network type bitmask indicating the support of radio tech LTE CA (carrier aggregation). + * + * @see #NETWORK_TYPE_BITMASK_LTE */ public static final long NETWORK_TYPE_BITMASK_LTE_CA = (1 << (NETWORK_TYPE_LTE_CA -1)); |