mirror of
https://github.com/Divested-Mobile/DivestOS-Build.git
synced 2024-12-14 02:14:34 -05:00
26f1ce99a9
packages/apps/Settings done Signed-off-by: Tavi <tavi@divested.dev>
166 lines
8.9 KiB
Diff
166 lines
8.9 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Tavi <tavi@divested.dev>
|
|
Date: Mon, 20 May 2024 13:55:34 -0400
|
|
Subject: [PATCH] Revert "Add Cloudflare DNS as a private DNS provider"
|
|
|
|
This reverts commit 0dfbfff41cc28699c1e218e20b10d9d42688f950.
|
|
|
|
Change-Id: I2d713cc74d34c65b77e7664fd3f5615d3ab6ac6a
|
|
---
|
|
res/layout/private_dns_mode_dialog.xml | 4 ---
|
|
res/values/cm_strings.xml | 5 ----
|
|
.../PrivateDnsModeDialogPreference.java | 29 ++-----------------
|
|
.../PrivateDnsPreferenceController.java | 19 ++----------
|
|
4 files changed, 5 insertions(+), 52 deletions(-)
|
|
|
|
diff --git a/res/layout/private_dns_mode_dialog.xml b/res/layout/private_dns_mode_dialog.xml
|
|
index 7c765d5a22f..12e29e693b7 100644
|
|
--- a/res/layout/private_dns_mode_dialog.xml
|
|
+++ b/res/layout/private_dns_mode_dialog.xml
|
|
@@ -35,10 +35,6 @@
|
|
android:id="@+id/private_dns_mode_off"
|
|
layout="@layout/preference_widget_dialog_radiobutton"/>
|
|
|
|
- <include
|
|
- android:id="@+id/private_dns_mode_cloudflare"
|
|
- layout="@layout/preference_widget_dialog_radiobutton"/>
|
|
-
|
|
<include
|
|
android:id="@+id/private_dns_mode_opportunistic"
|
|
layout="@layout/preference_widget_dialog_radiobutton"/>
|
|
diff --git a/res/values/cm_strings.xml b/res/values/cm_strings.xml
|
|
index d5c162e6650..aa89f73f47c 100644
|
|
--- a/res/values/cm_strings.xml
|
|
+++ b/res/values/cm_strings.xml
|
|
@@ -15,11 +15,6 @@
|
|
limitations under the License.
|
|
-->
|
|
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
|
|
- <!-- Private DNS -->
|
|
- <string name="private_dns_mode_cloudflare" translatable="false">Cloudflare DNS</string>
|
|
- <!-- Alternative: 1dot1dot1dot1.cloudflare-dns.com -->
|
|
- <string name="private_dns_hostname_cloudflare" translatable="false">one.one.one.one</string>
|
|
-
|
|
<!-- Advanced keyboard settings -->
|
|
<string name="keyboard_extras_title">Extras</string>
|
|
<string name="advanced_keyboard_settings_title">Advanced settings</string>
|
|
diff --git a/src/com/android/settings/network/PrivateDnsModeDialogPreference.java b/src/com/android/settings/network/PrivateDnsModeDialogPreference.java
|
|
index a5317ff4909..b1985ab0182 100644
|
|
--- a/src/com/android/settings/network/PrivateDnsModeDialogPreference.java
|
|
+++ b/src/com/android/settings/network/PrivateDnsModeDialogPreference.java
|
|
@@ -72,13 +72,9 @@ public class PrivateDnsModeDialogPreference extends CustomDialogPreferenceCompat
|
|
// DNS_MODE -> RadioButton id
|
|
private static final Map<Integer, Integer> PRIVATE_DNS_MAP;
|
|
|
|
- // Only used in Settings, update on additions to ConnectivitySettingsUtils
|
|
- private static final int PRIVATE_DNS_MODE_CLOUDFLARE = 4;
|
|
-
|
|
static {
|
|
PRIVATE_DNS_MAP = new HashMap<>();
|
|
PRIVATE_DNS_MAP.put(PRIVATE_DNS_MODE_OFF, R.id.private_dns_mode_off);
|
|
- PRIVATE_DNS_MAP.put(PRIVATE_DNS_MODE_CLOUDFLARE, R.id.private_dns_mode_cloudflare);
|
|
PRIVATE_DNS_MAP.put(PRIVATE_DNS_MODE_OPPORTUNISTIC, R.id.private_dns_mode_opportunistic);
|
|
PRIVATE_DNS_MAP.put(PRIVATE_DNS_MODE_PROVIDER_HOSTNAME, R.id.private_dns_mode_provider);
|
|
}
|
|
@@ -148,15 +144,6 @@ public class PrivateDnsModeDialogPreference extends CustomDialogPreferenceCompat
|
|
final ContentResolver contentResolver = context.getContentResolver();
|
|
|
|
mMode = ConnectivitySettingsManager.getPrivateDnsMode(context);
|
|
- if (mMode == PRIVATE_DNS_MODE_PROVIDER_HOSTNAME) {
|
|
- final String privateDnsHostname =
|
|
- ConnectivitySettingsManager.getPrivateDnsHostname(context);
|
|
- final String cloudflareHostname =
|
|
- context.getString(R.string.private_dns_hostname_cloudflare);
|
|
- if (privateDnsHostname.equals(cloudflareHostname)) {
|
|
- mMode = PRIVATE_DNS_MODE_CLOUDFLARE;
|
|
- }
|
|
- }
|
|
|
|
mEditText = view.findViewById(R.id.private_dns_mode_provider_hostname);
|
|
mEditText.addTextChangedListener(this);
|
|
@@ -169,9 +156,6 @@ public class PrivateDnsModeDialogPreference extends CustomDialogPreferenceCompat
|
|
// Initial radio button text
|
|
final RadioButton offRadioButton = view.findViewById(R.id.private_dns_mode_off);
|
|
offRadioButton.setText(com.android.settingslib.R.string.private_dns_mode_off);
|
|
- final RadioButton cloudflareRadioButton =
|
|
- view.findViewById(R.id.private_dns_mode_cloudflare);
|
|
- cloudflareRadioButton.setText(R.string.private_dns_mode_cloudflare);
|
|
final RadioButton opportunisticRadioButton =
|
|
view.findViewById(R.id.private_dns_mode_opportunistic);
|
|
opportunisticRadioButton.setText(
|
|
@@ -198,21 +182,14 @@ public class PrivateDnsModeDialogPreference extends CustomDialogPreferenceCompat
|
|
public void onClick(DialogInterface dialog, int which) {
|
|
if (which == DialogInterface.BUTTON_POSITIVE) {
|
|
final Context context = getContext();
|
|
- int modeToSet = mMode;
|
|
if (mMode == PRIVATE_DNS_MODE_PROVIDER_HOSTNAME) {
|
|
// Only clickable if hostname is valid, so we could save it safely
|
|
ConnectivitySettingsManager.setPrivateDnsHostname(context,
|
|
mEditText.getText().toString());
|
|
- } else if (mMode == PRIVATE_DNS_MODE_CLOUDFLARE) {
|
|
- final String cloudflareHostname =
|
|
- context.getString(R.string.private_dns_hostname_cloudflare);
|
|
- ConnectivitySettingsManager.setPrivateDnsHostname(context, cloudflareHostname);
|
|
- modeToSet = PRIVATE_DNS_MODE_PROVIDER_HOSTNAME;
|
|
}
|
|
-
|
|
FeatureFactory.getFeatureFactory().getMetricsFeatureProvider().action(context,
|
|
- SettingsEnums.ACTION_PRIVATE_DNS_MODE, modeToSet);
|
|
- ConnectivitySettingsManager.setPrivateDnsMode(context, modeToSet);
|
|
+ SettingsEnums.ACTION_PRIVATE_DNS_MODE, mMode);
|
|
+ ConnectivitySettingsManager.setPrivateDnsMode(context, mMode);
|
|
}
|
|
}
|
|
|
|
@@ -220,8 +197,6 @@ public class PrivateDnsModeDialogPreference extends CustomDialogPreferenceCompat
|
|
public void onCheckedChanged(RadioGroup group, int checkedId) {
|
|
if (checkedId == R.id.private_dns_mode_off) {
|
|
mMode = PRIVATE_DNS_MODE_OFF;
|
|
- } else if (checkedId == R.id.private_dns_mode_cloudflare) {
|
|
- mMode = PRIVATE_DNS_MODE_CLOUDFLARE;
|
|
} else if (checkedId == R.id.private_dns_mode_opportunistic) {
|
|
mMode = PRIVATE_DNS_MODE_OPPORTUNISTIC;
|
|
} else if (checkedId == R.id.private_dns_mode_provider) {
|
|
diff --git a/src/com/android/settings/network/PrivateDnsPreferenceController.java b/src/com/android/settings/network/PrivateDnsPreferenceController.java
|
|
index 17aaaeb869a..26091599893 100644
|
|
--- a/src/com/android/settings/network/PrivateDnsPreferenceController.java
|
|
+++ b/src/com/android/settings/network/PrivateDnsPreferenceController.java
|
|
@@ -65,9 +65,6 @@ public class PrivateDnsPreferenceController extends BasePreferenceController
|
|
Settings.Global.getUriFor(PRIVATE_DNS_SPECIFIER),
|
|
};
|
|
|
|
- // Only used in Settings, update on additions to ConnectivitySettingsUtils
|
|
- private static final int PRIVATE_DNS_MODE_CLOUDFLARE = 4;
|
|
-
|
|
private final Handler mHandler;
|
|
private final ContentObserver mSettingsObserver;
|
|
private final ConnectivityManager mConnectivityManager;
|
|
@@ -132,24 +129,14 @@ public class PrivateDnsPreferenceController extends BasePreferenceController
|
|
switch (mode) {
|
|
case PRIVATE_DNS_MODE_OFF:
|
|
return res.getString(com.android.settingslib.R.string.private_dns_mode_off);
|
|
- case PRIVATE_DNS_MODE_CLOUDFLARE:
|
|
case PRIVATE_DNS_MODE_OPPORTUNISTIC:
|
|
return dnsesResolved ? res.getString(R.string.private_dns_mode_on)
|
|
: res.getString(
|
|
com.android.settingslib.R.string.private_dns_mode_opportunistic);
|
|
case PRIVATE_DNS_MODE_PROVIDER_HOSTNAME:
|
|
- if (!dnsesResolved) {
|
|
- return res.getString(
|
|
- com.android.settingslib.R.string.private_dns_mode_provider_failure);
|
|
- }
|
|
- final String privateDnsHostname =
|
|
- ConnectivitySettingsManager.getPrivateDnsHostname(mContext);
|
|
- final String cloudflareHostname =
|
|
- res.getString(R.string.private_dns_hostname_cloudflare);
|
|
- if (privateDnsHostname.equals(cloudflareHostname)) {
|
|
- return res.getString(R.string.private_dns_mode_cloudflare);
|
|
- }
|
|
- return PrivateDnsModeDialogPreference.getHostnameFromSettings(cr);
|
|
+ return dnsesResolved
|
|
+ ? PrivateDnsModeDialogPreference.getHostnameFromSettings(cr)
|
|
+ : res.getString(com.android.settingslib.R.string.private_dns_mode_provider_failure);
|
|
}
|
|
return "";
|
|
}
|