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

Commit c0df6623 authored by Erik Kline's avatar Erik Kline Committed by Android (Google) Code Review
Browse files

Merge "Add settings for persisting the mobile data connection." into mnc-dev

parents 6a03d113 54861e12
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -3561,6 +3561,8 @@
    <string name="wifi_allow_scan_with_traffic">Always allow Wi\u2011Fi Roam Scans</string>
    <!-- Setting Checkbox title whether to enable WiFi Scanning in the presence of traffic. [CHAR LIMIT=80] -->
    <string name="legacy_dhcp_client">Use legacy DHCP client</string>
    <!-- Setting Checkbox title whether to always keep cellular data active. [CHAR LIMIT=80] -->
    <string name="mobile_data_always_on">Cellular data always active</string>

    <!-- setting Checkbox summary whether to show options for wireless display certification  -->
    <string name="wifi_display_certification_summary">Show options for wireless display certification</string>
@@ -3587,6 +3589,7 @@
    <!-- Title of warning dialog about the implications of enabling USB debugging -->
    <!-- Setting Checkbox summary whether to use DHCP client from Lollipop (Android 5.0) [CHAR LIMIT=130] -->
    <string name="legacy_dhcp_client_summary">Use the DHCP client from Lollipop instead of the new Android DHCP client.</string>
    <string name="mobile_data_always_on_summary">Always keep mobile data active, even when Wi\u2011Fi is active (for fast network switching).</string>
    <string name="adb_warning_title">Allow USB debugging?</string>
    <!-- Warning text to user about the implications of enabling USB debugging -->
    <string name="adb_warning_message">USB debugging is intended for development purposes only. Use it to copy data between your computer and your device, install apps on your device without notification, and read log data.</string>
+6 −1
Original line number Diff line number Diff line
@@ -137,9 +137,14 @@

       <SwitchPreference
            android:key="legacy_dhcp_client"
            android:title="@string/legacy_dhcp_client" />
            android:title="@string/legacy_dhcp_client"
            android:summary="@string/legacy_dhcp_client_summary"/>

       <SwitchPreference
            android:key="mobile_data_always_on"
            android:title="@string/mobile_data_always_on"
            android:summary="@string/mobile_data_always_on_summary"/>

        <ListPreference
            android:key="select_usb_configuration"
            android:title="@string/select_usb_configuration_title"
+18 −0
Original line number Diff line number Diff line
@@ -155,6 +155,7 @@ public class DevelopmentSettings extends SettingsPreferenceFragment
    private static final String USB_CONFIGURATION_KEY = "select_usb_configuration";
    private static final String SELECT_USB_CONFIGURATION_PROPERTY = "sys.usb.config";
    private static final String WIFI_LEGACY_DHCP_CLIENT_KEY = "legacy_dhcp_client";
    private static final String MOBILE_DATA_ALWAYS_ON = "mobile_data_always_on";

    private static final String OPENGL_TRACES_KEY = "enable_opengl_traces";

@@ -208,6 +209,7 @@ public class DevelopmentSettings extends SettingsPreferenceFragment
    private SwitchPreference mWifiVerboseLogging;
    private SwitchPreference mWifiAggressiveHandover;
    private SwitchPreference mLegacyDhcpClient;
    private SwitchPreference mMobileDataAlwaysOn;

    private SwitchPreference mWifiAllowScansWithTraffic;
    private SwitchPreference mStrictMode;
@@ -353,6 +355,7 @@ public class DevelopmentSettings extends SettingsPreferenceFragment
        mWifiAggressiveHandover = findAndInitSwitchPref(WIFI_AGGRESSIVE_HANDOVER_KEY);
        mWifiAllowScansWithTraffic = findAndInitSwitchPref(WIFI_ALLOW_SCAN_WITH_TRAFFIC_KEY);
        mLegacyDhcpClient = findAndInitSwitchPref(WIFI_LEGACY_DHCP_CLIENT_KEY);
        mMobileDataAlwaysOn = findAndInitSwitchPref(MOBILE_DATA_ALWAYS_ON);
        mLogdSize = addListPreference(SELECT_LOGD_SIZE_KEY);
        mUsbConfiguration = addListPreference(USB_CONFIGURATION_KEY);

@@ -586,6 +589,7 @@ public class DevelopmentSettings extends SettingsPreferenceFragment
        updateWifiAggressiveHandoverOptions();
        updateWifiAllowScansWithTrafficOptions();
        updateLegacyDhcpClientOptions();
        updateMobileDataAlwaysOnOptions();
        updateSimulateColorSpace();
        updateUseNuplayerOptions();
        updateUSBAudioOptions();
@@ -1152,6 +1156,18 @@ public class DevelopmentSettings extends SettingsPreferenceFragment
                mLegacyDhcpClient.isChecked() ? 1 : 0);
    }

    private void updateMobileDataAlwaysOnOptions() {
        updateSwitchPreference(mMobileDataAlwaysOn, Settings.Global.getInt(
                getActivity().getContentResolver(),
                Settings.Global.MOBILE_DATA_ALWAYS_ON, 0) != 0);
    }

    private void writeMobileDataAlwaysOnOptions() {
        Settings.Global.putInt(getActivity().getContentResolver(),
                Settings.Global.MOBILE_DATA_ALWAYS_ON,
                mMobileDataAlwaysOn.isChecked() ? 1 : 0);
    }

    private void updateLogdSizeValues() {
        if (mLogdSize != null) {
            String currentValue = SystemProperties.get(SELECT_LOGD_SIZE_PROPERTY);
@@ -1592,6 +1608,8 @@ public class DevelopmentSettings extends SettingsPreferenceFragment
            writeWifiAllowScansWithTrafficOptions();
        } else if (preference == mLegacyDhcpClient) {
            writeLegacyDhcpClientOptions();
        } else if (preference == mMobileDataAlwaysOn) {
            writeMobileDataAlwaysOnOptions();
        } else if (preference == mUseAwesomePlayer) {
            writeUseAwesomePlayerOptions();
        } else if (preference == mUSBAudio) {