20.0: add dot.sb DNS preset
Signed-off-by: Tad <tad@spotco.us>
This commit is contained in:
parent
7ed06bc763
commit
e2ca79c607
@ -3,7 +3,7 @@ From: Tad <tad@spotco.us>
|
|||||||
Date: Mon, 24 Jun 2019 21:27:26 +0530
|
Date: Mon, 24 Jun 2019 21:27:26 +0530
|
||||||
Subject: [PATCH] Add more 'Private DNS' options
|
Subject: [PATCH] Add more 'Private DNS' options
|
||||||
|
|
||||||
This adds fourteen DNS providers as available presets.
|
This adds fifteen DNS providers as available presets.
|
||||||
|
|
||||||
Credit: CalyxOS
|
Credit: CalyxOS
|
||||||
- Chirayu Desai <chirayudesai1@gmail.com>
|
- Chirayu Desai <chirayudesai1@gmail.com>
|
||||||
@ -11,17 +11,17 @@ Credit: CalyxOS
|
|||||||
|
|
||||||
Change-Id: I7e8a320d47e7c5ddbcb9acfaf23032ae92d5d70d
|
Change-Id: I7e8a320d47e7c5ddbcb9acfaf23032ae92d5d70d
|
||||||
---
|
---
|
||||||
res/layout/private_dns_mode_dialog.xml | 56 ++++++
|
res/layout/private_dns_mode_dialog.xml | 60 ++++++
|
||||||
res/values/cm_strings.xml | 43 +++++
|
res/values/cm_strings.xml | 46 +++++
|
||||||
.../PrivateDnsModeDialogPreference.java | 180 +++++++++++++++++-
|
.../PrivateDnsModeDialogPreference.java | 192 +++++++++++++++++-
|
||||||
.../PrivateDnsPreferenceController.java | 38 +++-
|
.../PrivateDnsPreferenceController.java | 40 +++-
|
||||||
4 files changed, 312 insertions(+), 5 deletions(-)
|
4 files changed, 333 insertions(+), 5 deletions(-)
|
||||||
|
|
||||||
diff --git a/res/layout/private_dns_mode_dialog.xml b/res/layout/private_dns_mode_dialog.xml
|
diff --git a/res/layout/private_dns_mode_dialog.xml b/res/layout/private_dns_mode_dialog.xml
|
||||||
index 12e29e693b..feaaabac3d 100644
|
index 12e29e693b..b264bef20a 100644
|
||||||
--- a/res/layout/private_dns_mode_dialog.xml
|
--- a/res/layout/private_dns_mode_dialog.xml
|
||||||
+++ b/res/layout/private_dns_mode_dialog.xml
|
+++ b/res/layout/private_dns_mode_dialog.xml
|
||||||
@@ -35,6 +35,62 @@
|
@@ -35,6 +35,66 @@
|
||||||
android:id="@+id/private_dns_mode_off"
|
android:id="@+id/private_dns_mode_off"
|
||||||
layout="@layout/preference_widget_dialog_radiobutton"/>
|
layout="@layout/preference_widget_dialog_radiobutton"/>
|
||||||
|
|
||||||
@ -58,6 +58,10 @@ index 12e29e693b..feaaabac3d 100644
|
|||||||
+ layout="@layout/preference_widget_dialog_radiobutton"/>
|
+ layout="@layout/preference_widget_dialog_radiobutton"/>
|
||||||
+
|
+
|
||||||
+ <include
|
+ <include
|
||||||
|
+ android:id="@+id/private_dns_mode_dnssb"
|
||||||
|
+ layout="@layout/preference_widget_dialog_radiobutton"/>
|
||||||
|
+
|
||||||
|
+ <include
|
||||||
+ android:id="@+id/private_dns_mode_google"
|
+ android:id="@+id/private_dns_mode_google"
|
||||||
+ layout="@layout/preference_widget_dialog_radiobutton"/>
|
+ layout="@layout/preference_widget_dialog_radiobutton"/>
|
||||||
+
|
+
|
||||||
@ -85,10 +89,10 @@ index 12e29e693b..feaaabac3d 100644
|
|||||||
android:id="@+id/private_dns_mode_opportunistic"
|
android:id="@+id/private_dns_mode_opportunistic"
|
||||||
layout="@layout/preference_widget_dialog_radiobutton"/>
|
layout="@layout/preference_widget_dialog_radiobutton"/>
|
||||||
diff --git a/res/values/cm_strings.xml b/res/values/cm_strings.xml
|
diff --git a/res/values/cm_strings.xml b/res/values/cm_strings.xml
|
||||||
index d9ca157167..38ac11f64e 100644
|
index d9ca157167..73c78cc87e 100644
|
||||||
--- a/res/values/cm_strings.xml
|
--- a/res/values/cm_strings.xml
|
||||||
+++ b/res/values/cm_strings.xml
|
+++ b/res/values/cm_strings.xml
|
||||||
@@ -15,6 +15,49 @@
|
@@ -15,6 +15,52 @@
|
||||||
limitations under the License.
|
limitations under the License.
|
||||||
-->
|
-->
|
||||||
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
|
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
|
||||||
@ -117,6 +121,9 @@ index d9ca157167..38ac11f64e 100644
|
|||||||
+ <string name="private_dns_mode_dnszero" translatable="false">DNS0 (FR)</string>
|
+ <string name="private_dns_mode_dnszero" translatable="false">DNS0 (FR)</string>
|
||||||
+ <string name="private_dns_hostname_dnszero" translatable="false">zero.dns0.eu</string>
|
+ <string name="private_dns_hostname_dnszero" translatable="false">zero.dns0.eu</string>
|
||||||
+
|
+
|
||||||
|
+ <string name="private_dns_mode_dnssb" translatable="false">DNS.SB (DE)</string>
|
||||||
|
+ <string name="private_dns_hostname_dnssb" translatable="false">dot.sb</string>
|
||||||
|
+
|
||||||
+ <string name="private_dns_mode_google" translatable="false">Google (US)</string>
|
+ <string name="private_dns_mode_google" translatable="false">Google (US)</string>
|
||||||
+ <string name="private_dns_hostname_google" translatable="false">dns.google</string>
|
+ <string name="private_dns_hostname_google" translatable="false">dns.google</string>
|
||||||
+
|
+
|
||||||
@ -139,10 +146,10 @@ index d9ca157167..38ac11f64e 100644
|
|||||||
<string name="keyboard_extras_title">Extras</string>
|
<string name="keyboard_extras_title">Extras</string>
|
||||||
<string name="advanced_keyboard_settings_title">Advanced settings</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
|
diff --git a/src/com/android/settings/network/PrivateDnsModeDialogPreference.java b/src/com/android/settings/network/PrivateDnsModeDialogPreference.java
|
||||||
index 5c7c54eda3..c321b6cbaf 100644
|
index 5c7c54eda3..4656b73df5 100644
|
||||||
--- a/src/com/android/settings/network/PrivateDnsModeDialogPreference.java
|
--- a/src/com/android/settings/network/PrivateDnsModeDialogPreference.java
|
||||||
+++ b/src/com/android/settings/network/PrivateDnsModeDialogPreference.java
|
+++ b/src/com/android/settings/network/PrivateDnsModeDialogPreference.java
|
||||||
@@ -72,9 +72,39 @@ public class PrivateDnsModeDialogPreference extends CustomDialogPreferenceCompat
|
@@ -72,9 +72,41 @@ public class PrivateDnsModeDialogPreference extends CustomDialogPreferenceCompat
|
||||||
// DNS_MODE -> RadioButton id
|
// DNS_MODE -> RadioButton id
|
||||||
private static final Map<Integer, Integer> PRIVATE_DNS_MAP;
|
private static final Map<Integer, Integer> PRIVATE_DNS_MAP;
|
||||||
|
|
||||||
@ -161,6 +168,7 @@ index 5c7c54eda3..c321b6cbaf 100644
|
|||||||
+ private static final int PRIVATE_DNS_MODE_RESTENA = 15;
|
+ private static final int PRIVATE_DNS_MODE_RESTENA = 15;
|
||||||
+ private static final int PRIVATE_DNS_MODE_SWITCH = 16;
|
+ private static final int PRIVATE_DNS_MODE_SWITCH = 16;
|
||||||
+ private static final int PRIVATE_DNS_MODE_UNCENSOREDDNS = 17;
|
+ private static final int PRIVATE_DNS_MODE_UNCENSOREDDNS = 17;
|
||||||
|
+ private static final int PRIVATE_DNS_MODE_DNSSB = 18;
|
||||||
+
|
+
|
||||||
static {
|
static {
|
||||||
PRIVATE_DNS_MAP = new HashMap<>();
|
PRIVATE_DNS_MAP = new HashMap<>();
|
||||||
@ -173,6 +181,7 @@ index 5c7c54eda3..c321b6cbaf 100644
|
|||||||
+ PRIVATE_DNS_MAP.put(PRIVATE_DNS_MODE_CONTROLD, R.id.private_dns_mode_controld);
|
+ PRIVATE_DNS_MAP.put(PRIVATE_DNS_MODE_CONTROLD, R.id.private_dns_mode_controld);
|
||||||
+ PRIVATE_DNS_MAP.put(PRIVATE_DNS_MODE_CZNIC, R.id.private_dns_mode_cznic);
|
+ PRIVATE_DNS_MAP.put(PRIVATE_DNS_MODE_CZNIC, R.id.private_dns_mode_cznic);
|
||||||
+ PRIVATE_DNS_MAP.put(PRIVATE_DNS_MODE_DNSZERO, R.id.private_dns_mode_dnszero);
|
+ PRIVATE_DNS_MAP.put(PRIVATE_DNS_MODE_DNSZERO, R.id.private_dns_mode_dnszero);
|
||||||
|
+ PRIVATE_DNS_MAP.put(PRIVATE_DNS_MODE_DNSSB, R.id.private_dns_mode_dnssb);
|
||||||
+ PRIVATE_DNS_MAP.put(PRIVATE_DNS_MODE_GOOGLE, R.id.private_dns_mode_google);
|
+ PRIVATE_DNS_MAP.put(PRIVATE_DNS_MODE_GOOGLE, R.id.private_dns_mode_google);
|
||||||
+ PRIVATE_DNS_MAP.put(PRIVATE_DNS_MODE_MULLVAD, R.id.private_dns_mode_mullvad);
|
+ PRIVATE_DNS_MAP.put(PRIVATE_DNS_MODE_MULLVAD, R.id.private_dns_mode_mullvad);
|
||||||
+ PRIVATE_DNS_MAP.put(PRIVATE_DNS_MODE_QUADNINE, R.id.private_dns_mode_quadnine);
|
+ PRIVATE_DNS_MAP.put(PRIVATE_DNS_MODE_QUADNINE, R.id.private_dns_mode_quadnine);
|
||||||
@ -182,7 +191,7 @@ index 5c7c54eda3..c321b6cbaf 100644
|
|||||||
PRIVATE_DNS_MAP.put(PRIVATE_DNS_MODE_OPPORTUNISTIC, R.id.private_dns_mode_opportunistic);
|
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);
|
PRIVATE_DNS_MAP.put(PRIVATE_DNS_MODE_PROVIDER_HOSTNAME, R.id.private_dns_mode_provider);
|
||||||
}
|
}
|
||||||
@@ -144,6 +174,39 @@ public class PrivateDnsModeDialogPreference extends CustomDialogPreferenceCompat
|
@@ -144,6 +176,41 @@ public class PrivateDnsModeDialogPreference extends CustomDialogPreferenceCompat
|
||||||
final ContentResolver contentResolver = context.getContentResolver();
|
final ContentResolver contentResolver = context.getContentResolver();
|
||||||
|
|
||||||
mMode = ConnectivitySettingsManager.getPrivateDnsMode(context);
|
mMode = ConnectivitySettingsManager.getPrivateDnsMode(context);
|
||||||
@ -205,6 +214,8 @@ index 5c7c54eda3..c321b6cbaf 100644
|
|||||||
+ mMode = PRIVATE_DNS_MODE_CZNIC;
|
+ mMode = PRIVATE_DNS_MODE_CZNIC;
|
||||||
+ } else if (privateDnsHostname.equals(context.getString(R.string.private_dns_hostname_dnszero))) {
|
+ } else if (privateDnsHostname.equals(context.getString(R.string.private_dns_hostname_dnszero))) {
|
||||||
+ mMode = PRIVATE_DNS_MODE_DNSZERO;
|
+ mMode = PRIVATE_DNS_MODE_DNSZERO;
|
||||||
|
+ } else if (privateDnsHostname.equals(context.getString(R.string.private_dns_hostname_dnssb))) {
|
||||||
|
+ mMode = PRIVATE_DNS_MODE_DNSSB;
|
||||||
+ } else if (privateDnsHostname.equals(context.getString(R.string.private_dns_hostname_google))) {
|
+ } else if (privateDnsHostname.equals(context.getString(R.string.private_dns_hostname_google))) {
|
||||||
+ mMode = PRIVATE_DNS_MODE_GOOGLE;
|
+ mMode = PRIVATE_DNS_MODE_GOOGLE;
|
||||||
+ } else if (privateDnsHostname.equals(context.getString(R.string.private_dns_hostname_mullvad))) {
|
+ } else if (privateDnsHostname.equals(context.getString(R.string.private_dns_hostname_mullvad))) {
|
||||||
@ -222,7 +233,7 @@ index 5c7c54eda3..c321b6cbaf 100644
|
|||||||
|
|
||||||
mEditText = view.findViewById(R.id.private_dns_mode_provider_hostname);
|
mEditText = view.findViewById(R.id.private_dns_mode_provider_hostname);
|
||||||
mEditText.addTextChangedListener(this);
|
mEditText.addTextChangedListener(this);
|
||||||
@@ -156,6 +219,48 @@ public class PrivateDnsModeDialogPreference extends CustomDialogPreferenceCompat
|
@@ -156,6 +223,51 @@ public class PrivateDnsModeDialogPreference extends CustomDialogPreferenceCompat
|
||||||
// Initial radio button text
|
// Initial radio button text
|
||||||
final RadioButton offRadioButton = view.findViewById(R.id.private_dns_mode_off);
|
final RadioButton offRadioButton = view.findViewById(R.id.private_dns_mode_off);
|
||||||
offRadioButton.setText(R.string.private_dns_mode_off);
|
offRadioButton.setText(R.string.private_dns_mode_off);
|
||||||
@ -250,6 +261,9 @@ index 5c7c54eda3..c321b6cbaf 100644
|
|||||||
+ final RadioButton dnszeroRadioButton =
|
+ final RadioButton dnszeroRadioButton =
|
||||||
+ view.findViewById(R.id.private_dns_mode_dnszero);
|
+ view.findViewById(R.id.private_dns_mode_dnszero);
|
||||||
+ dnszeroRadioButton.setText(R.string.private_dns_mode_dnszero);
|
+ dnszeroRadioButton.setText(R.string.private_dns_mode_dnszero);
|
||||||
|
+ final RadioButton dnssbRadioButton =
|
||||||
|
+ view.findViewById(R.id.private_dns_mode_dnssb);
|
||||||
|
+ dnssbRadioButton.setText(R.string.private_dns_mode_dnssb);
|
||||||
+ final RadioButton googleRadioButton =
|
+ final RadioButton googleRadioButton =
|
||||||
+ view.findViewById(R.id.private_dns_mode_google);
|
+ view.findViewById(R.id.private_dns_mode_google);
|
||||||
+ googleRadioButton.setText(R.string.private_dns_mode_google);
|
+ googleRadioButton.setText(R.string.private_dns_mode_google);
|
||||||
@ -271,7 +285,7 @@ index 5c7c54eda3..c321b6cbaf 100644
|
|||||||
final RadioButton opportunisticRadioButton =
|
final RadioButton opportunisticRadioButton =
|
||||||
view.findViewById(R.id.private_dns_mode_opportunistic);
|
view.findViewById(R.id.private_dns_mode_opportunistic);
|
||||||
opportunisticRadioButton.setText(R.string.private_dns_mode_opportunistic);
|
opportunisticRadioButton.setText(R.string.private_dns_mode_opportunistic);
|
||||||
@@ -181,15 +286,58 @@ public class PrivateDnsModeDialogPreference extends CustomDialogPreferenceCompat
|
@@ -181,15 +293,61 @@ public class PrivateDnsModeDialogPreference extends CustomDialogPreferenceCompat
|
||||||
public void onClick(DialogInterface dialog, int which) {
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
if (which == DialogInterface.BUTTON_POSITIVE) {
|
if (which == DialogInterface.BUTTON_POSITIVE) {
|
||||||
final Context context = getContext();
|
final Context context = getContext();
|
||||||
@ -304,6 +318,9 @@ index 5c7c54eda3..c321b6cbaf 100644
|
|||||||
+ } else if (mMode == PRIVATE_DNS_MODE_DNSZERO) {
|
+ } else if (mMode == PRIVATE_DNS_MODE_DNSZERO) {
|
||||||
+ ConnectivitySettingsManager.setPrivateDnsHostname(context, context.getString(R.string.private_dns_hostname_dnszero));
|
+ ConnectivitySettingsManager.setPrivateDnsHostname(context, context.getString(R.string.private_dns_hostname_dnszero));
|
||||||
+ modeToSet = PRIVATE_DNS_MODE_PROVIDER_HOSTNAME;
|
+ modeToSet = PRIVATE_DNS_MODE_PROVIDER_HOSTNAME;
|
||||||
|
+ } else if (mMode == PRIVATE_DNS_MODE_DNSSB) {
|
||||||
|
+ ConnectivitySettingsManager.setPrivateDnsHostname(context, context.getString(R.string.private_dns_hostname_dnssb));
|
||||||
|
+ modeToSet = PRIVATE_DNS_MODE_PROVIDER_HOSTNAME;
|
||||||
+ } else if (mMode == PRIVATE_DNS_MODE_GOOGLE) {
|
+ } else if (mMode == PRIVATE_DNS_MODE_GOOGLE) {
|
||||||
+ ConnectivitySettingsManager.setPrivateDnsHostname(context, context.getString(R.string.private_dns_hostname_google));
|
+ ConnectivitySettingsManager.setPrivateDnsHostname(context, context.getString(R.string.private_dns_hostname_google));
|
||||||
+ modeToSet = PRIVATE_DNS_MODE_PROVIDER_HOSTNAME;
|
+ modeToSet = PRIVATE_DNS_MODE_PROVIDER_HOSTNAME;
|
||||||
@ -332,7 +349,7 @@ index 5c7c54eda3..c321b6cbaf 100644
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -197,6 +345,34 @@ public class PrivateDnsModeDialogPreference extends CustomDialogPreferenceCompat
|
@@ -197,6 +355,36 @@ public class PrivateDnsModeDialogPreference extends CustomDialogPreferenceCompat
|
||||||
public void onCheckedChanged(RadioGroup group, int checkedId) {
|
public void onCheckedChanged(RadioGroup group, int checkedId) {
|
||||||
if (checkedId == R.id.private_dns_mode_off) {
|
if (checkedId == R.id.private_dns_mode_off) {
|
||||||
mMode = PRIVATE_DNS_MODE_OFF;
|
mMode = PRIVATE_DNS_MODE_OFF;
|
||||||
@ -352,6 +369,8 @@ index 5c7c54eda3..c321b6cbaf 100644
|
|||||||
+ mMode = PRIVATE_DNS_MODE_CZNIC;
|
+ mMode = PRIVATE_DNS_MODE_CZNIC;
|
||||||
+ } else if (checkedId == R.id.private_dns_mode_dnszero) {
|
+ } else if (checkedId == R.id.private_dns_mode_dnszero) {
|
||||||
+ mMode = PRIVATE_DNS_MODE_DNSZERO;
|
+ mMode = PRIVATE_DNS_MODE_DNSZERO;
|
||||||
|
+ } else if (checkedId == R.id.private_dns_mode_dnssb) {
|
||||||
|
+ mMode = PRIVATE_DNS_MODE_DNSSB;
|
||||||
+ } else if (checkedId == R.id.private_dns_mode_google) {
|
+ } else if (checkedId == R.id.private_dns_mode_google) {
|
||||||
+ mMode = PRIVATE_DNS_MODE_GOOGLE;
|
+ mMode = PRIVATE_DNS_MODE_GOOGLE;
|
||||||
+ } else if (checkedId == R.id.private_dns_mode_mullvad) {
|
+ } else if (checkedId == R.id.private_dns_mode_mullvad) {
|
||||||
@ -368,10 +387,10 @@ index 5c7c54eda3..c321b6cbaf 100644
|
|||||||
mMode = PRIVATE_DNS_MODE_OPPORTUNISTIC;
|
mMode = PRIVATE_DNS_MODE_OPPORTUNISTIC;
|
||||||
} else if (checkedId == R.id.private_dns_mode_provider) {
|
} 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
|
diff --git a/src/com/android/settings/network/PrivateDnsPreferenceController.java b/src/com/android/settings/network/PrivateDnsPreferenceController.java
|
||||||
index 42974be8e0..8ff447f05f 100644
|
index 42974be8e0..7b9dd3d36f 100644
|
||||||
--- a/src/com/android/settings/network/PrivateDnsPreferenceController.java
|
--- a/src/com/android/settings/network/PrivateDnsPreferenceController.java
|
||||||
+++ b/src/com/android/settings/network/PrivateDnsPreferenceController.java
|
+++ b/src/com/android/settings/network/PrivateDnsPreferenceController.java
|
||||||
@@ -133,9 +133,41 @@ public class PrivateDnsPreferenceController extends BasePreferenceController
|
@@ -133,9 +133,43 @@ public class PrivateDnsPreferenceController extends BasePreferenceController
|
||||||
return dnsesResolved ? res.getString(R.string.private_dns_mode_on)
|
return dnsesResolved ? res.getString(R.string.private_dns_mode_on)
|
||||||
: res.getString(R.string.private_dns_mode_opportunistic);
|
: res.getString(R.string.private_dns_mode_opportunistic);
|
||||||
case PRIVATE_DNS_MODE_PROVIDER_HOSTNAME:
|
case PRIVATE_DNS_MODE_PROVIDER_HOSTNAME:
|
||||||
@ -399,6 +418,8 @@ index 42974be8e0..8ff447f05f 100644
|
|||||||
+ return res.getString(R.string.private_dns_mode_cznic);
|
+ return res.getString(R.string.private_dns_mode_cznic);
|
||||||
+ } else if (privateDnsHostname.equals(res.getString(R.string.private_dns_hostname_dnszero))) {
|
+ } else if (privateDnsHostname.equals(res.getString(R.string.private_dns_hostname_dnszero))) {
|
||||||
+ return res.getString(R.string.private_dns_mode_dnszero);
|
+ return res.getString(R.string.private_dns_mode_dnszero);
|
||||||
|
+ } else if (privateDnsHostname.equals(res.getString(R.string.private_dns_hostname_dnssb))) {
|
||||||
|
+ return res.getString(R.string.private_dns_mode_dnssb);
|
||||||
+ } else if (privateDnsHostname.equals(res.getString(R.string.private_dns_hostname_google))) {
|
+ } else if (privateDnsHostname.equals(res.getString(R.string.private_dns_hostname_google))) {
|
||||||
+ return res.getString(R.string.private_dns_mode_google);
|
+ return res.getString(R.string.private_dns_mode_google);
|
||||||
+ } else if (privateDnsHostname.equals(res.getString(R.string.private_dns_hostname_mullvad))) {
|
+ } else if (privateDnsHostname.equals(res.getString(R.string.private_dns_hostname_mullvad))) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user