Replace dns_tls with private_dns_mode setting

Also includes:
    - new layout fragment for private DNS configuration
    - PrivateDnsModeDialogPreference handler class

Test: as follows
    - built
    - flashed
    - booted
    - runtest frameworks-net passes
    - manual interaction with private dns developer option works
Bug: 34953048
Bug: 6413396
Change-Id: I3a5490c21f7f3b3e523a247c287f213d19b75a8b
This commit is contained in:
Erik Kline
2017-10-30 15:30:18 +09:00
parent b13f2e0fb0
commit 1ea5dd05c3
4 changed files with 322 additions and 14 deletions

View File

@@ -217,7 +217,7 @@ public class DevelopmentSettings extends RestrictedSettingsFragment
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 PRIVATE_DNS_PREF_KEY = "select_private_dns_configuration";
private static final String INACTIVE_APPS_KEY = "inactive_apps";
@@ -295,8 +295,6 @@ public class DevelopmentSettings extends RestrictedSettingsFragment
private ListPreference mBluetoothSelectA2dpChannelMode;
private ListPreference mBluetoothSelectA2dpLdacPlaybackQuality;
private SwitchPreference mDnsTls;
private SwitchPreference mOtaDisableAutomaticUpdate;
private SwitchPreference mWifiAllowScansWithTraffic;
private SwitchPreference mStrictMode;
@@ -511,7 +509,7 @@ public class DevelopmentSettings extends RestrictedSettingsFragment
mBluetoothSelectA2dpLdacPlaybackQuality = addListPreference(BLUETOOTH_SELECT_A2DP_LDAC_PLAYBACK_QUALITY_KEY);
initBluetoothConfigurationValues();
mDnsTls = findAndInitSwitchPref(DNS_TLS_KEY);
updatePrivateDnsSummary();
mWindowAnimationScale = addListPreference(WINDOW_ANIMATION_SCALE_KEY);
mTransitionAnimationScale = addListPreference(TRANSITION_ANIMATION_SCALE_KEY);
@@ -829,8 +827,7 @@ public class DevelopmentSettings extends RestrictedSettingsFragment
updateBluetoothDisableAbsVolumeOptions();
updateBluetoothEnableInbandRingingOptions();
updateBluetoothA2dpConfigurationValues();
updateSwitchPreference(mDnsTls, Settings.Global.getInt(cr,
Settings.Global.DNS_TLS_DISABLED, 0) == 0);
updatePrivateDnsSummary();
}
private void resetDangerousOptions() {
@@ -2183,6 +2180,13 @@ public class DevelopmentSettings extends RestrictedSettingsFragment
}
}
private void updatePrivateDnsSummary() {
final String summary = PrivateDnsModeDialogPreference.getSummaryStringForModeFromSettings(
getActivity().getContentResolver(), getActivity().getResources());
final Preference pref = findPreference(PRIVATE_DNS_PREF_KEY);
pref.setSummary(summary);
}
private void writeImmediatelyDestroyActivitiesOptions() {
try {
ActivityManager.getService().setAlwaysFinish(
@@ -2534,10 +2538,6 @@ public class DevelopmentSettings extends RestrictedSettingsFragment
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 {