Merge "Add a developer option for controlling DNS over TLS" am: c8207de343
am: ed97eaeb4a

Change-Id: Iafc1e11d79f163d57e1d5e8bb3524c3d44f1b240
diff --git a/res/xml/development_prefs.xml b/res/xml/development_prefs.xml
index 4d5eb70..7c0c0b3 100644
--- a/res/xml/development_prefs.xml
+++ b/res/xml/development_prefs.xml
@@ -257,6 +257,11 @@
             android:entries="@array/bluetooth_a2dp_codec_ldac_playback_quality_titles"
             android:entryValues="@array/bluetooth_a2dp_codec_ldac_playback_quality_values" />
 
+        <SwitchPreference
+            android:key="dns_tls"
+            android:title="@string/dns_tls"
+            android:summary="@string/dns_tls_summary" />
+
     </PreferenceCategory>
 
     <PreferenceCategory android:key="debug_input_category"
diff --git a/src/com/android/settings/development/DevelopmentSettings.java b/src/com/android/settings/development/DevelopmentSettings.java
index 7d21a8e..c0792e7 100644
--- a/src/com/android/settings/development/DevelopmentSettings.java
+++ b/src/com/android/settings/development/DevelopmentSettings.java
@@ -217,6 +217,8 @@
     private static final String BLUETOOTH_SELECT_A2DP_CHANNEL_MODE_KEY = "bluetooth_select_a2dp_channel_mode";
     private static final String BLUETOOTH_SELECT_A2DP_LDAC_PLAYBACK_QUALITY_KEY = "bluetooth_select_a2dp_ldac_playback_quality";
 
+    private static final String DNS_TLS_KEY = "dns_tls";
+
     private static final String INACTIVE_APPS_KEY = "inactive_apps";
 
     private static final String IMMEDIATELY_DESTROY_ACTIVITIES_KEY
@@ -293,6 +295,8 @@
     private ListPreference mBluetoothSelectA2dpChannelMode;
     private ListPreference mBluetoothSelectA2dpLdacPlaybackQuality;
 
+    private SwitchPreference mDnsTls;
+
     private SwitchPreference mOtaDisableAutomaticUpdate;
     private SwitchPreference mWifiAllowScansWithTraffic;
     private SwitchPreference mStrictMode;
@@ -507,6 +511,8 @@
         mBluetoothSelectA2dpLdacPlaybackQuality = addListPreference(BLUETOOTH_SELECT_A2DP_LDAC_PLAYBACK_QUALITY_KEY);
         initBluetoothConfigurationValues();
 
+        mDnsTls = findAndInitSwitchPref(DNS_TLS_KEY);
+
         mWindowAnimationScale = addListPreference(WINDOW_ANIMATION_SCALE_KEY);
         mTransitionAnimationScale = addListPreference(TRANSITION_ANIMATION_SCALE_KEY);
         mAnimatorDurationScale = addListPreference(ANIMATOR_DURATION_SCALE_KEY);
@@ -823,6 +829,8 @@
         updateBluetoothDisableAbsVolumeOptions();
         updateBluetoothEnableInbandRingingOptions();
         updateBluetoothA2dpConfigurationValues();
+        updateSwitchPreference(mDnsTls, Settings.Global.getInt(cr,
+                Settings.Global.DNS_TLS_DISABLED, 0) == 0);
     }
 
     private void resetDangerousOptions() {
@@ -2526,6 +2534,10 @@
             writeBluetoothDisableAbsVolumeOptions();
         } else if (preference == mBluetoothEnableInbandRinging) {
             writeBluetoothEnableInbandRingingOptions();
+        } else if (preference == mDnsTls) {
+            Settings.Global.putInt(getActivity().getContentResolver(),
+                    Settings.Global.DNS_TLS_DISABLED,
+                    mDnsTls.isChecked() ? 0 : 1);
         } else if (SHORTCUT_MANAGER_RESET_KEY.equals(preference.getKey())) {
             resetShortcutManagerThrottling();
         } else {