diff options
-rw-r--r-- | core/api/current.txt | 1 | ||||
-rw-r--r-- | core/api/system-current.txt | 1 | ||||
-rw-r--r-- | core/java/android/provider/Telephony.java | 3 | ||||
-rw-r--r-- | telephony/java/android/telephony/CarrierConfigManager.java | 9 | ||||
-rw-r--r-- | telephony/java/android/telephony/TelephonyManager.java | 14 |
5 files changed, 26 insertions, 2 deletions
diff --git a/core/api/current.txt b/core/api/current.txt index 4d55bf90ad40..c2fac3df90f6 100644 --- a/core/api/current.txt +++ b/core/api/current.txt @@ -39225,6 +39225,7 @@ package android.telephony { field public static final String KEY_GSM_ROAMING_NETWORKS_STRING_ARRAY = "gsm_roaming_networks_string_array"; field public static final String KEY_HAS_IN_CALL_NOISE_SUPPRESSION_BOOL = "has_in_call_noise_suppression_bool"; field public static final String KEY_HIDE_CARRIER_NETWORK_SETTINGS_BOOL = "hide_carrier_network_settings_bool"; + field public static final String KEY_HIDE_ENABLE_2G = "hide_enable_2g_bool"; field public static final String KEY_HIDE_ENHANCED_4G_LTE_BOOL = "hide_enhanced_4g_lte_bool"; field public static final String KEY_HIDE_IMS_APN_BOOL = "hide_ims_apn_bool"; field public static final String KEY_HIDE_LTE_PLUS_DATA_ICON_BOOL = "hide_lte_plus_data_icon_bool"; diff --git a/core/api/system-current.txt b/core/api/system-current.txt index 68be0bfa1f24..dbd17a91a576 100644 --- a/core/api/system-current.txt +++ b/core/api/system-current.txt @@ -10216,6 +10216,7 @@ package android.telephony { field public static final String ACTION_SIM_CARD_STATE_CHANGED = "android.telephony.action.SIM_CARD_STATE_CHANGED"; field public static final String ACTION_SIM_SLOT_STATUS_CHANGED = "android.telephony.action.SIM_SLOT_STATUS_CHANGED"; field public static final int ALLOWED_NETWORK_TYPES_REASON_CARRIER = 2; // 0x2 + field public static final int ALLOWED_NETWORK_TYPES_REASON_ENABLE_2G = 3; // 0x3 field public static final int ALLOWED_NETWORK_TYPES_REASON_POWER = 1; // 0x1 field public static final int ALLOWED_NETWORK_TYPES_REASON_USER = 0; // 0x0 field public static final int CALL_WAITING_STATUS_DISABLED = 2; // 0x2 diff --git a/core/java/android/provider/Telephony.java b/core/java/android/provider/Telephony.java index 9cb76c1ffb5d..753abea2cfe2 100644 --- a/core/java/android/provider/Telephony.java +++ b/core/java/android/provider/Telephony.java @@ -5284,7 +5284,8 @@ public final class Telephony { * which network types are allowed for * {@link TelephonyManager#ALLOWED_NETWORK_TYPES_REASON_USER}, * {@link TelephonyManager#ALLOWED_NETWORK_TYPES_REASON_POWER}, - * {@link TelephonyManager#ALLOWED_NETWORK_TYPES_REASON_CARRIER}. + * {@link TelephonyManager#ALLOWED_NETWORK_TYPES_REASON_CARRIER}, + * {@link TelephonyManager#ALLOWED_NETWORK_TYPES_REASON_ENABLE_2G}. * <P>Type: TEXT </P> * * @hide diff --git a/telephony/java/android/telephony/CarrierConfigManager.java b/telephony/java/android/telephony/CarrierConfigManager.java index 217570e1401c..464d37510034 100644 --- a/telephony/java/android/telephony/CarrierConfigManager.java +++ b/telephony/java/android/telephony/CarrierConfigManager.java @@ -4268,6 +4268,14 @@ public class CarrierConfigManager { public static final String KEY_STORE_SIM_PIN_FOR_UNATTENDED_REBOOT_BOOL = "store_sim_pin_for_unattended_reboot_bool"; + /** + * Determine whether "Enable 2G" toggle can be shown. + * + * Used to trade privacy/security against potentially reduced carrier coverage for some + * carriers. + */ + public static final String KEY_HIDE_ENABLE_2G = "hide_enable_2g_bool"; + /** The default value for every variable. */ private final static PersistableBundle sDefaults; @@ -4825,6 +4833,7 @@ public class CarrierConfigManager { sDefaults.putStringArray(KEY_ALLOWED_INITIAL_ATTACH_APN_TYPES_STRING_ARRAY, new String[]{"ia", "default", "ims", "mms", "dun", "emergency"}); sDefaults.putBoolean(KEY_STORE_SIM_PIN_FOR_UNATTENDED_REBOOT_BOOL, true); + sDefaults.putBoolean(KEY_HIDE_ENABLE_2G, false); } /** diff --git a/telephony/java/android/telephony/TelephonyManager.java b/telephony/java/android/telephony/TelephonyManager.java index e77ee365b4d3..e54877d70816 100644 --- a/telephony/java/android/telephony/TelephonyManager.java +++ b/telephony/java/android/telephony/TelephonyManager.java @@ -8224,7 +8224,8 @@ public class TelephonyManager { @IntDef({ ALLOWED_NETWORK_TYPES_REASON_USER, ALLOWED_NETWORK_TYPES_REASON_POWER, - ALLOWED_NETWORK_TYPES_REASON_CARRIER + ALLOWED_NETWORK_TYPES_REASON_CARRIER, + ALLOWED_NETWORK_TYPES_REASON_ENABLE_2G }) @Retention(RetentionPolicy.SOURCE) public @interface AllowedNetworkTypesReason { @@ -8261,6 +8262,14 @@ public class TelephonyManager { public static final int ALLOWED_NETWORK_TYPES_REASON_CARRIER = 2; /** + * To indicate allowed network type change is requested by the user via the 2G toggle. + * + * @hide + */ + @SystemApi + public static final int ALLOWED_NETWORK_TYPES_REASON_ENABLE_2G = 3; + + /** * Set the allowed network types of the device and * provide the reason triggering the allowed network change. * This can be called for following reasons @@ -8269,6 +8278,8 @@ public class TelephonyManager { * <li>Allowed network types control by power manager * {@link #ALLOWED_NETWORK_TYPES_REASON_POWER} * <li>Allowed network types control by carrier {@link #ALLOWED_NETWORK_TYPES_REASON_CARRIER} + * <li>Allowed network types control by the user-controlled "Allow 2G" toggle + * {@link #ALLOWED_NETWORK_TYPES_REASON_ENABLE_2G} * </ol> * This API will result in allowing an intersection of allowed network types for all reasons, * including the configuration done through other reasons. @@ -8358,6 +8369,7 @@ public class TelephonyManager { case TelephonyManager.ALLOWED_NETWORK_TYPES_REASON_USER: case TelephonyManager.ALLOWED_NETWORK_TYPES_REASON_POWER: case TelephonyManager.ALLOWED_NETWORK_TYPES_REASON_CARRIER: + case TelephonyManager.ALLOWED_NETWORK_TYPES_REASON_ENABLE_2G: return true; } return false; |