Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8fa54b7c authored by Yomna Nasser's avatar Yomna Nasser
Browse files

Implementation of "Enable 2G" for Settings.

(1) Adds KEY_HIDE_ENABLE_2G_BOOL to CarrierConfigManager, and
(2) Adds new reason ALLOWED_NETWORK_TYPES_REASON_ENABLE_2G.

Test: manual & atest -c Enable2gPreferenceControllerTest
Bug: b/163168917
Change-Id: I81052549f8dde491697c35365320145fd24c3842
parent 6516885e
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -40270,6 +40270,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";
+1 −0
Original line number Diff line number Diff line
@@ -11944,6 +11944,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
+2 −1
Original line number Diff line number Diff line
@@ -5286,7 +5286,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
+5 −3
Original line number Diff line number Diff line
@@ -1840,13 +1840,15 @@ public class PhoneStateListener {
         *
         * @param allowedNetworkTypesList Map associating all allowed network type reasons
         * ({@link TelephonyManager#ALLOWED_NETWORK_TYPES_REASON_USER},
         * {@link TelephonyManager#ALLOWED_NETWORK_TYPES_REASON_POWER}, and
         * {@link TelephonyManager#ALLOWED_NETWORK_TYPES_REASON_CARRIER}) with reason's allowed
         * {@link TelephonyManager#ALLOWED_NETWORK_TYPES_REASON_POWER},
         * {@link TelephonyManager#ALLOWED_NETWORK_TYPES_REASON_CARRIER}, and
         * {@link TelephonyManager#ALLOWED_NETWORK_TYPES_REASON_ENABLE_2G}) with reason's allowed
         * network type values.
         * For example:
         * map{{TelephonyManager#ALLOWED_NETWORK_TYPES_REASON_USER, long type value},
         *     {TelephonyManager#ALLOWED_NETWORK_TYPES_REASON_POWER, long type value},
         *     {TelephonyManager#ALLOWED_NETWORK_TYPES_REASON_CARRIER, long type value}}
         *     {TelephonyManager#ALLOWED_NETWORK_TYPES_REASON_CARRIER, long type value},
         *     {TelephonyManager#ALLOWED_NETWORK_TYPES_REASON_ENABLE_2G, long type value}}
         */
        @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE)
        void onAllowedNetworkTypesChanged(
+9 −0
Original line number Diff line number Diff line
@@ -4763,6 +4763,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;

@@ -5320,6 +5328,7 @@ public class CarrierConfigManager {
        sDefaults.putBoolean(KEY_NETWORK_TEMP_NOT_METERED_SUPPORTED_BOOL, true);
        sDefaults.putInt(KEY_DEFAULT_RTT_MODE_INT, 0);
        sDefaults.putBoolean(KEY_STORE_SIM_PIN_FOR_UNATTENDED_REBOOT_BOOL, true);
        sDefaults.putBoolean(KEY_HIDE_ENABLE_2G, false);
    }

    /**
Loading