mirror of
https://github.com/Divested-Mobile/DivestOS-Build.git
synced 2024-12-24 15:09:34 -05:00
19.1: Add the Private DNS presets
Signed-off-by: Tad <tad@spotco.us>
This commit is contained in:
parent
05930af014
commit
3114ca7157
@ -0,0 +1,144 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Tad <tad@spotco.us>
|
||||
Date: Tue, 21 Dec 2021 05:13:40 +0530
|
||||
Subject: [PATCH] Add more 'Private DNS' options
|
||||
|
||||
This adds thirteen DNS providers as available presets.
|
||||
|
||||
Credit: CalyxOS
|
||||
- Chirayu Desai <chirayudesai1@gmail.com>
|
||||
https://review.calyxos.org/c/CalyxOS/platform_frameworks_libs_net/+/9676
|
||||
|
||||
Signed-off-by: Tad <tad@spotco.us>
|
||||
Change-Id: Ide577115925a2a4991332524f670899f4d33f2a3
|
||||
---
|
||||
.../util/ConnectivitySettingsUtils.java | 91 +++++++++++++++++++
|
||||
1 file changed, 91 insertions(+)
|
||||
|
||||
diff --git a/common/framework/com/android/net/module/util/ConnectivitySettingsUtils.java b/common/framework/com/android/net/module/util/ConnectivitySettingsUtils.java
|
||||
index b7eb70b..3e8dd2e 100644
|
||||
--- a/common/framework/com/android/net/module/util/ConnectivitySettingsUtils.java
|
||||
+++ b/common/framework/com/android/net/module/util/ConnectivitySettingsUtils.java
|
||||
@@ -32,10 +32,36 @@ public class ConnectivitySettingsUtils {
|
||||
public static final int PRIVATE_DNS_MODE_OFF = 1;
|
||||
public static final int PRIVATE_DNS_MODE_OPPORTUNISTIC = 2;
|
||||
public static final int PRIVATE_DNS_MODE_PROVIDER_HOSTNAME = 3;
|
||||
+ public static final int PRIVATE_DNS_MODE_ADGUARD = 4;
|
||||
+ public static final int PRIVATE_DNS_MODE_APPLIEDPRIVACY = 5;
|
||||
+ public static final int PRIVATE_DNS_MODE_CLEANBROWSING = 6;
|
||||
+ public static final int PRIVATE_DNS_MODE_CIRA = 7;
|
||||
+ public static final int PRIVATE_DNS_MODE_CZNIC = 8;
|
||||
+ public static final int PRIVATE_DNS_MODE_CLOUDFLARE = 9;
|
||||
+ public static final int PRIVATE_DNS_MODE_GOOGLE = 10;
|
||||
+ public static final int PRIVATE_DNS_MODE_MULLVAD = 11;
|
||||
+ public static final int PRIVATE_DNS_MODE_QUADNINE = 12;
|
||||
+ public static final int PRIVATE_DNS_MODE_RESTENA = 13;
|
||||
+ public static final int PRIVATE_DNS_MODE_SWITCH = 14;
|
||||
+ public static final int PRIVATE_DNS_MODE_TWNIC = 15;
|
||||
+ public static final int PRIVATE_DNS_MODE_UNCENSOREDDNS = 16;
|
||||
|
||||
public static final String PRIVATE_DNS_DEFAULT_MODE = "private_dns_default_mode";
|
||||
public static final String PRIVATE_DNS_MODE = "private_dns_mode";
|
||||
public static final String PRIVATE_DNS_MODE_OFF_STRING = "off";
|
||||
+ public static final String PRIVATE_DNS_MODE_ADGUARD_STRING = "adguard";
|
||||
+ public static final String PRIVATE_DNS_MODE_APPLIEDPRIVACY_STRING = "appliedprivacy";
|
||||
+ public static final String PRIVATE_DNS_MODE_CLEANBROWSING_STRING = "cleanbrowsing";
|
||||
+ public static final String PRIVATE_DNS_MODE_CIRA_STRING = "cira";
|
||||
+ public static final String PRIVATE_DNS_MODE_CZNIC_STRING = "cznic";
|
||||
+ public static final String PRIVATE_DNS_MODE_CLOUDFLARE_STRING = "cloudflare";
|
||||
+ public static final String PRIVATE_DNS_MODE_GOOGLE_STRING = "google";
|
||||
+ public static final String PRIVATE_DNS_MODE_MULLVAD_STRING = "mullvad";
|
||||
+ public static final String PRIVATE_DNS_MODE_QUADNINE_STRING = "quadnine";
|
||||
+ public static final String PRIVATE_DNS_MODE_RESTENA_STRING = "restena";
|
||||
+ public static final String PRIVATE_DNS_MODE_SWITCH_STRING = "switch";
|
||||
+ public static final String PRIVATE_DNS_MODE_TWNIC_STRING = "twnic";
|
||||
+ public static final String PRIVATE_DNS_MODE_UNCENSOREDDNS_STRING = "uncensoreddns";
|
||||
public static final String PRIVATE_DNS_MODE_OPPORTUNISTIC_STRING = "opportunistic";
|
||||
public static final String PRIVATE_DNS_MODE_PROVIDER_HOSTNAME_STRING = "hostname";
|
||||
public static final String PRIVATE_DNS_SPECIFIER = "private_dns_specifier";
|
||||
@@ -50,6 +76,32 @@ public class ConnectivitySettingsUtils {
|
||||
switch (mode) {
|
||||
case PRIVATE_DNS_MODE_OFF:
|
||||
return PRIVATE_DNS_MODE_OFF_STRING;
|
||||
+ case PRIVATE_DNS_MODE_ADGUARD:
|
||||
+ return PRIVATE_DNS_MODE_ADGUARD_STRING;
|
||||
+ case PRIVATE_DNS_MODE_APPLIEDPRIVACY:
|
||||
+ return PRIVATE_DNS_MODE_APPLIEDPRIVACY_STRING;
|
||||
+ case PRIVATE_DNS_MODE_CLEANBROWSING:
|
||||
+ return PRIVATE_DNS_MODE_CLEANBROWSING_STRING;
|
||||
+ case PRIVATE_DNS_MODE_CIRA:
|
||||
+ return PRIVATE_DNS_MODE_CIRA_STRING;
|
||||
+ case PRIVATE_DNS_MODE_CZNIC:
|
||||
+ return PRIVATE_DNS_MODE_CZNIC_STRING;
|
||||
+ case PRIVATE_DNS_MODE_CLOUDFLARE:
|
||||
+ return PRIVATE_DNS_MODE_CLOUDFLARE_STRING;
|
||||
+ case PRIVATE_DNS_MODE_GOOGLE:
|
||||
+ return PRIVATE_DNS_MODE_GOOGLE_STRING;
|
||||
+ case PRIVATE_DNS_MODE_MULLVAD:
|
||||
+ return PRIVATE_DNS_MODE_MULLVAD_STRING;
|
||||
+ case PRIVATE_DNS_MODE_QUADNINE:
|
||||
+ return PRIVATE_DNS_MODE_QUADNINE_STRING;
|
||||
+ case PRIVATE_DNS_MODE_RESTENA:
|
||||
+ return PRIVATE_DNS_MODE_RESTENA_STRING;
|
||||
+ case PRIVATE_DNS_MODE_SWITCH:
|
||||
+ return PRIVATE_DNS_MODE_SWITCH_STRING;
|
||||
+ case PRIVATE_DNS_MODE_TWNIC:
|
||||
+ return PRIVATE_DNS_MODE_TWNIC_STRING;
|
||||
+ case PRIVATE_DNS_MODE_UNCENSOREDDNS:
|
||||
+ return PRIVATE_DNS_MODE_UNCENSOREDDNS_STRING;
|
||||
case PRIVATE_DNS_MODE_OPPORTUNISTIC:
|
||||
return PRIVATE_DNS_MODE_OPPORTUNISTIC_STRING;
|
||||
case PRIVATE_DNS_MODE_PROVIDER_HOSTNAME:
|
||||
@@ -63,6 +115,32 @@ public class ConnectivitySettingsUtils {
|
||||
switch (mode) {
|
||||
case "off":
|
||||
return PRIVATE_DNS_MODE_OFF;
|
||||
+ case "adguard":
|
||||
+ return PRIVATE_DNS_MODE_ADGUARD;
|
||||
+ case "appliedprivacy":
|
||||
+ return PRIVATE_DNS_MODE_APPLIEDPRIVACY;
|
||||
+ case "cleanbrowsing":
|
||||
+ return PRIVATE_DNS_MODE_CLEANBROWSING;
|
||||
+ case "cira":
|
||||
+ return PRIVATE_DNS_MODE_CIRA;
|
||||
+ case "cznic":
|
||||
+ return PRIVATE_DNS_MODE_CZNIC;
|
||||
+ case "cloudflare":
|
||||
+ return PRIVATE_DNS_MODE_CLOUDFLARE;
|
||||
+ case "google":
|
||||
+ return PRIVATE_DNS_MODE_GOOGLE;
|
||||
+ case "mullvad":
|
||||
+ return PRIVATE_DNS_MODE_MULLVAD;
|
||||
+ case "quadnine":
|
||||
+ return PRIVATE_DNS_MODE_QUADNINE;
|
||||
+ case "restena":
|
||||
+ return PRIVATE_DNS_MODE_RESTENA;
|
||||
+ case "switch":
|
||||
+ return PRIVATE_DNS_MODE_SWITCH;
|
||||
+ case "twnic":
|
||||
+ return PRIVATE_DNS_MODE_TWNIC;
|
||||
+ case "uncensoreddns":
|
||||
+ return PRIVATE_DNS_MODE_UNCENSOREDDNS;
|
||||
case "hostname":
|
||||
return PRIVATE_DNS_MODE_PROVIDER_HOSTNAME;
|
||||
case "opportunistic":
|
||||
@@ -96,6 +174,19 @@ public class ConnectivitySettingsUtils {
|
||||
*/
|
||||
public static void setPrivateDnsMode(@NonNull Context context, int mode) {
|
||||
if (!(mode == PRIVATE_DNS_MODE_OFF
|
||||
+ || mode == PRIVATE_DNS_MODE_ADGUARD
|
||||
+ || mode == PRIVATE_DNS_MODE_APPLIEDPRIVACY
|
||||
+ || mode == PRIVATE_DNS_MODE_CLEANBROWSING
|
||||
+ || mode == PRIVATE_DNS_MODE_CIRA
|
||||
+ || mode == PRIVATE_DNS_MODE_CZNIC
|
||||
+ || mode == PRIVATE_DNS_MODE_CLOUDFLARE
|
||||
+ || mode == PRIVATE_DNS_MODE_GOOGLE
|
||||
+ || mode == PRIVATE_DNS_MODE_MULLVAD
|
||||
+ || mode == PRIVATE_DNS_MODE_QUADNINE
|
||||
+ || mode == PRIVATE_DNS_MODE_RESTENA
|
||||
+ || mode == PRIVATE_DNS_MODE_SWITCH
|
||||
+ || mode == PRIVATE_DNS_MODE_TWNIC
|
||||
+ || mode == PRIVATE_DNS_MODE_UNCENSOREDDNS
|
||||
|| mode == PRIVATE_DNS_MODE_OPPORTUNISTIC
|
||||
|| mode == PRIVATE_DNS_MODE_PROVIDER_HOSTNAME)) {
|
||||
throw new IllegalArgumentException("Invalid private dns mode: " + mode);
|
@ -1,24 +1,21 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Tad <tad@spotco.us>
|
||||
Date: Thu, 21 Oct 2021 21:09:38 -0400
|
||||
Date: Mon, 24 Jun 2019 21:27:26 +0530
|
||||
Subject: [PATCH] Add more 'Private DNS' options
|
||||
|
||||
This adds thirteen DNS providers as available presets.
|
||||
|
||||
Credit: CalyxOS
|
||||
- Chirayu Desai <chirayudesai1@gmail.com>
|
||||
https://review.calyxos.org/c/CalyxOS/platform_packages_apps_Settings/+/458
|
||||
- Pavel Shirshov <pshirshov@eml.cc>
|
||||
https://review.calyxos.org/c/CalyxOS/platform_packages_apps_Settings/+/5357
|
||||
https://review.calyxos.org/c/CalyxOS/platform_packages_apps_Settings/+/9504
|
||||
|
||||
Signed-off-by: Tad <tad@spotco.us>
|
||||
Change-Id: I423ad5a3c360a687a226e61df3f75b5550f851c0
|
||||
Change-Id: I7e8a320d47e7c5ddbcb9acfaf23032ae92d5d70d
|
||||
---
|
||||
res/layout/private_dns_mode_dialog.xml | 52 +++++++++++
|
||||
res/values/cm_strings.xml | 15 +++
|
||||
.../PrivateDnsModeDialogPreference.java | 92 +++++++++++++++++++
|
||||
.../PrivateDnsPreferenceController.java | 65 +++++++++++++
|
||||
4 files changed, 224 insertions(+)
|
||||
.../PrivateDnsModeDialogPreference.java | 93 +++++++++++++++++++
|
||||
.../PrivateDnsPreferenceController.java | 67 +++++++++++++
|
||||
4 files changed, 227 insertions(+)
|
||||
|
||||
diff --git a/res/layout/private_dns_mode_dialog.xml b/res/layout/private_dns_mode_dialog.xml
|
||||
index 12e29e693b..b6745806b5 100644
|
||||
@ -84,7 +81,7 @@ index 12e29e693b..b6745806b5 100644
|
||||
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 9923c03f0e..9495cd3d0e 100644
|
||||
index 9b3dc03134..fff2ae2be4 100644
|
||||
--- a/res/values/cm_strings.xml
|
||||
+++ b/res/values/cm_strings.xml
|
||||
@@ -74,6 +74,21 @@
|
||||
@ -110,39 +107,37 @@ index 9923c03f0e..9495cd3d0e 100644
|
||||
<string name="unlock_scramble_pin_layout_title">Scramble layout</string>
|
||||
<string name="unlock_scramble_pin_layout_summary">Scramble PIN layout when unlocking device</string>
|
||||
diff --git a/src/com/android/settings/network/PrivateDnsModeDialogPreference.java b/src/com/android/settings/network/PrivateDnsModeDialogPreference.java
|
||||
index 1c3fc76dba..0be44c4fee 100644
|
||||
index 1c3fc76dba..0dfa81c6f3 100644
|
||||
--- a/src/com/android/settings/network/PrivateDnsModeDialogPreference.java
|
||||
+++ b/src/com/android/settings/network/PrivateDnsModeDialogPreference.java
|
||||
@@ -18,6 +18,19 @@ package com.android.settings.network;
|
||||
import static android.net.ConnectivitySettingsManager.PRIVATE_DNS_MODE_OFF;
|
||||
import static android.net.ConnectivitySettingsManager.PRIVATE_DNS_MODE_OPPORTUNISTIC;
|
||||
import static android.net.ConnectivitySettingsManager.PRIVATE_DNS_MODE_PROVIDER_HOSTNAME;
|
||||
+import static android.net.ConnectivitySettingsManager.PRIVATE_DNS_MODE_ADGUARD;
|
||||
+import static android.net.ConnectivitySettingsManager.PRIVATE_DNS_MODE_APPLIEDPRIVACY;
|
||||
+import static android.net.ConnectivitySettingsManager.PRIVATE_DNS_MODE_CIRA;
|
||||
+import static android.net.ConnectivitySettingsManager.PRIVATE_DNS_MODE_CLEANBROWSING;
|
||||
+import static android.net.ConnectivitySettingsManager.PRIVATE_DNS_MODE_CLOUDFLARE;
|
||||
+import static android.net.ConnectivitySettingsManager.PRIVATE_DNS_MODE_CZNIC;
|
||||
+import static android.net.ConnectivitySettingsManager.PRIVATE_DNS_MODE_GOOGLE;
|
||||
+import static android.net.ConnectivitySettingsManager.PRIVATE_DNS_MODE_MULLVAD;
|
||||
+import static android.net.ConnectivitySettingsManager.PRIVATE_DNS_MODE_QUADNINE;
|
||||
+import static android.net.ConnectivitySettingsManager.PRIVATE_DNS_MODE_RESTENA;
|
||||
+import static android.net.ConnectivitySettingsManager.PRIVATE_DNS_MODE_SWITCH;
|
||||
+import static android.net.ConnectivitySettingsManager.PRIVATE_DNS_MODE_TWNIC;
|
||||
+import static android.net.ConnectivitySettingsManager.PRIVATE_DNS_MODE_UNCENSOREDDNS;
|
||||
@@ -72,9 +72,37 @@ public class PrivateDnsModeDialogPreference extends CustomDialogPreferenceCompat
|
||||
// DNS_MODE -> RadioButton id
|
||||
private static final Map<Integer, Integer> PRIVATE_DNS_MAP;
|
||||
|
||||
import static com.android.settingslib.RestrictedLockUtils.EnforcedAdmin;
|
||||
|
||||
@@ -75,6 +88,19 @@ public class PrivateDnsModeDialogPreference extends CustomDialogPreferenceCompat
|
||||
+ // Must match ConnectivitySettingsUtils
|
||||
+ private static final int PRIVATE_DNS_MODE_ADGUARD = 4;
|
||||
+ private static final int PRIVATE_DNS_MODE_APPLIEDPRIVACY = 5;
|
||||
+ private static final int PRIVATE_DNS_MODE_CLEANBROWSING = 6;
|
||||
+ private static final int PRIVATE_DNS_MODE_CIRA = 7;
|
||||
+ private static final int PRIVATE_DNS_MODE_CZNIC = 8;
|
||||
+ private static final int PRIVATE_DNS_MODE_CLOUDFLARE = 9;
|
||||
+ private static final int PRIVATE_DNS_MODE_GOOGLE = 10;
|
||||
+ private static final int PRIVATE_DNS_MODE_MULLVAD = 11;
|
||||
+ private static final int PRIVATE_DNS_MODE_QUADNINE = 12;
|
||||
+ private static final int PRIVATE_DNS_MODE_RESTENA = 13;
|
||||
+ private static final int PRIVATE_DNS_MODE_SWITCH = 14;
|
||||
+ private static final int PRIVATE_DNS_MODE_TWNIC = 15;
|
||||
+ private static final int PRIVATE_DNS_MODE_UNCENSOREDDNS = 16;
|
||||
+
|
||||
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_ADGUARD, R.id.private_dns_mode_adguard);
|
||||
+ PRIVATE_DNS_MAP.put(PRIVATE_DNS_MODE_APPLIEDPRIVACY, R.id.private_dns_mode_appliedprivacy);
|
||||
+ PRIVATE_DNS_MAP.put(PRIVATE_DNS_MODE_CIRA, R.id.private_dns_mode_cira);
|
||||
+ PRIVATE_DNS_MAP.put(PRIVATE_DNS_MODE_CLEANBROWSING, R.id.private_dns_mode_cleanbrowsing);
|
||||
+ PRIVATE_DNS_MAP.put(PRIVATE_DNS_MODE_CLOUDFLARE, R.id.private_dns_mode_cloudflare);
|
||||
+ PRIVATE_DNS_MAP.put(PRIVATE_DNS_MODE_CIRA, R.id.private_dns_mode_cira);
|
||||
+ PRIVATE_DNS_MAP.put(PRIVATE_DNS_MODE_CZNIC, R.id.private_dns_mode_cznic);
|
||||
+ PRIVATE_DNS_MAP.put(PRIVATE_DNS_MODE_CLOUDFLARE, R.id.private_dns_mode_cloudflare);
|
||||
+ 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_QUADNINE, R.id.private_dns_mode_quadnine);
|
||||
@ -153,7 +148,7 @@ index 1c3fc76dba..0be44c4fee 100644
|
||||
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);
|
||||
}
|
||||
@@ -173,6 +199,46 @@ public class PrivateDnsModeDialogPreference extends CustomDialogPreferenceCompat
|
||||
@@ -173,6 +201,45 @@ public class PrivateDnsModeDialogPreference extends CustomDialogPreferenceCompat
|
||||
// Initial radio button text
|
||||
final RadioButton offRadioButton = view.findViewById(R.id.private_dns_mode_off);
|
||||
offRadioButton.setText(R.string.private_dns_mode_off);
|
||||
@ -196,11 +191,10 @@ index 1c3fc76dba..0be44c4fee 100644
|
||||
+ final RadioButton uncensoreddnsRadioButton =
|
||||
+ view.findViewById(R.id.private_dns_mode_uncensoreddns);
|
||||
+ uncensoreddnsRadioButton.setText(R.string.private_dns_mode_uncensoreddns);
|
||||
+
|
||||
final RadioButton opportunisticRadioButton =
|
||||
view.findViewById(R.id.private_dns_mode_opportunistic);
|
||||
opportunisticRadioButton.setText(R.string.private_dns_mode_opportunistic);
|
||||
@@ -212,6 +278,32 @@ public class PrivateDnsModeDialogPreference extends CustomDialogPreferenceCompat
|
||||
@@ -212,6 +279,32 @@ 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;
|
||||
@ -234,30 +228,32 @@ index 1c3fc76dba..0be44c4fee 100644
|
||||
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 07d57140ec..ee9bf84faf 100644
|
||||
index ed6f9ed955..03f8d230ef 100644
|
||||
--- a/src/com/android/settings/network/PrivateDnsPreferenceController.java
|
||||
+++ b/src/com/android/settings/network/PrivateDnsPreferenceController.java
|
||||
@@ -19,6 +19,19 @@ package com.android.settings.network;
|
||||
import static android.net.ConnectivitySettingsManager.PRIVATE_DNS_MODE_OFF;
|
||||
import static android.net.ConnectivitySettingsManager.PRIVATE_DNS_MODE_OPPORTUNISTIC;
|
||||
import static android.net.ConnectivitySettingsManager.PRIVATE_DNS_MODE_PROVIDER_HOSTNAME;
|
||||
+import static android.net.ConnectivitySettingsManager.PRIVATE_DNS_MODE_ADGUARD;
|
||||
+import static android.net.ConnectivitySettingsManager.PRIVATE_DNS_MODE_APPLIEDPRIVACY;
|
||||
+import static android.net.ConnectivitySettingsManager.PRIVATE_DNS_MODE_CIRA;
|
||||
+import static android.net.ConnectivitySettingsManager.PRIVATE_DNS_MODE_CLEANBROWSING;
|
||||
+import static android.net.ConnectivitySettingsManager.PRIVATE_DNS_MODE_CLOUDFLARE;
|
||||
+import static android.net.ConnectivitySettingsManager.PRIVATE_DNS_MODE_CZNIC;
|
||||
+import static android.net.ConnectivitySettingsManager.PRIVATE_DNS_MODE_GOOGLE;
|
||||
+import static android.net.ConnectivitySettingsManager.PRIVATE_DNS_MODE_MULLVAD;
|
||||
+import static android.net.ConnectivitySettingsManager.PRIVATE_DNS_MODE_QUADNINE;
|
||||
+import static android.net.ConnectivitySettingsManager.PRIVATE_DNS_MODE_RESTENA;
|
||||
+import static android.net.ConnectivitySettingsManager.PRIVATE_DNS_MODE_SWITCH;
|
||||
+import static android.net.ConnectivitySettingsManager.PRIVATE_DNS_MODE_TWNIC;
|
||||
+import static android.net.ConnectivitySettingsManager.PRIVATE_DNS_MODE_UNCENSOREDDNS;
|
||||
import static android.provider.Settings.Global.PRIVATE_DNS_DEFAULT_MODE;
|
||||
import static android.provider.Settings.Global.PRIVATE_DNS_MODE;
|
||||
import static android.provider.Settings.Global.PRIVATE_DNS_SPECIFIER;
|
||||
@@ -126,6 +139,58 @@ public class PrivateDnsPreferenceController extends BasePreferenceController
|
||||
@@ -65,6 +65,21 @@ public class PrivateDnsPreferenceController extends BasePreferenceController
|
||||
Settings.Global.getUriFor(PRIVATE_DNS_SPECIFIER),
|
||||
};
|
||||
|
||||
+ // Must match ConnectivitySettingsUtils
|
||||
+ private static final int PRIVATE_DNS_MODE_ADGUARD = 4;
|
||||
+ private static final int PRIVATE_DNS_MODE_APPLIEDPRIVACY = 5;
|
||||
+ private static final int PRIVATE_DNS_MODE_CLEANBROWSING = 6;
|
||||
+ private static final int PRIVATE_DNS_MODE_CIRA = 7;
|
||||
+ private static final int PRIVATE_DNS_MODE_CZNIC = 8;
|
||||
+ private static final int PRIVATE_DNS_MODE_CLOUDFLARE = 9;
|
||||
+ private static final int PRIVATE_DNS_MODE_GOOGLE = 10;
|
||||
+ private static final int PRIVATE_DNS_MODE_MULLVAD = 11;
|
||||
+ private static final int PRIVATE_DNS_MODE_QUADNINE = 12;
|
||||
+ private static final int PRIVATE_DNS_MODE_RESTENA = 13;
|
||||
+ private static final int PRIVATE_DNS_MODE_SWITCH = 14;
|
||||
+ private static final int PRIVATE_DNS_MODE_TWNIC = 15;
|
||||
+ private static final int PRIVATE_DNS_MODE_UNCENSOREDDNS = 16;
|
||||
+
|
||||
private final Handler mHandler;
|
||||
private final ContentObserver mSettingsObserver;
|
||||
private final ConnectivityManager mConnectivityManager;
|
||||
@@ -129,6 +144,58 @@ public class PrivateDnsPreferenceController extends BasePreferenceController
|
||||
switch (mode) {
|
||||
case PRIVATE_DNS_MODE_OFF:
|
||||
return res.getString(R.string.private_dns_mode_off);
|
||||
|
@ -1,225 +1,311 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Tad <tad@spotco.us>
|
||||
Date: Thu, 21 Oct 2021 20:54:37 -0400
|
||||
Date: Mon, 24 Jun 2019 21:27:35 +0530
|
||||
Subject: [PATCH] Add more 'Private DNS' options
|
||||
|
||||
This adds thirteen DNS providers as available presets.
|
||||
|
||||
Credit: CalyxOS
|
||||
- Chirayu Desai <chirayudesai1@gmail.com>
|
||||
https://review.calyxos.org/c/CalyxOS/platform_frameworks_base/+/446
|
||||
- Oliver Scott <olivercscott@gmail.com>
|
||||
https://review.calyxos.org/c/CalyxOS/platform_frameworks_base/+/2327
|
||||
- Pavel Shirshov <pshirshov@eml.cc>
|
||||
https://review.calyxos.org/c/CalyxOS/platform_frameworks_base/+/5356
|
||||
https://review.calyxos.org/c/CalyxOS/platform_packages_modules_Connectivity/+/9588
|
||||
|
||||
Signed-off-by: Tad <tad@spotco.us>
|
||||
Change-Id: Id75a774ce1ed109a83c6a5bf512536c643165d71
|
||||
Change-Id: I4e51da9d8fe08d1c4a287808f4464c0338b40334
|
||||
---
|
||||
.../java/android/net/ConnectivityManager.java | 104 ++++++++++++++++++
|
||||
.../server/connectivity/DnsManager.java | 66 +++++++++++
|
||||
2 files changed, 170 insertions(+)
|
||||
.../net/ConnectivitySettingsManager.java | 170 ++++++++++++++++++
|
||||
.../server/connectivity/DnsManager.java | 78 ++++++++
|
||||
2 files changed, 248 insertions(+)
|
||||
|
||||
diff --git a/core/java/android/net/ConnectivityManager.java b/core/java/android/net/ConnectivityManager.java
|
||||
index ed03f5198d6f..7df32c10b16b 100644
|
||||
--- a/core/java/android/net/ConnectivityManager.java
|
||||
+++ b/core/java/android/net/ConnectivityManager.java
|
||||
@@ -796,6 +796,58 @@ public class ConnectivityManager {
|
||||
* @hide
|
||||
diff --git a/framework/src/android/net/ConnectivitySettingsManager.java b/framework/src/android/net/ConnectivitySettingsManager.java
|
||||
index 9c8d08fb1..00da8bf9d 100644
|
||||
--- a/framework/src/android/net/ConnectivitySettingsManager.java
|
||||
+++ b/framework/src/android/net/ConnectivitySettingsManager.java
|
||||
@@ -351,6 +351,84 @@ public class ConnectivitySettingsManager {
|
||||
*/
|
||||
public static final String PRIVATE_DNS_MODE_OFF = "off";
|
||||
public static final int PRIVATE_DNS_MODE_OFF = ConnectivitySettingsUtils.PRIVATE_DNS_MODE_OFF;
|
||||
|
||||
+ /**
|
||||
+ * @hide
|
||||
+ */
|
||||
+ public static final String PRIVATE_DNS_MODE_ADGUARD = "adguard";
|
||||
+ public static final int PRIVATE_DNS_MODE_ADGUARD =
|
||||
+ ConnectivitySettingsUtils.PRIVATE_DNS_MODE_ADGUARD;
|
||||
+
|
||||
+ /**
|
||||
+ * @hide
|
||||
+ */
|
||||
+ public static final String PRIVATE_DNS_MODE_APPLIEDPRIVACY = "appliedprivacy";
|
||||
+ public static final int PRIVATE_DNS_MODE_APPLIEDPRIVACY =
|
||||
+ ConnectivitySettingsUtils.PRIVATE_DNS_MODE_APPLIEDPRIVACY;
|
||||
+
|
||||
+ /**
|
||||
+ * @hide
|
||||
+ */
|
||||
+ public static final String PRIVATE_DNS_MODE_CLEANBROWSING = "cleanbrowsing";
|
||||
+ public static final int PRIVATE_DNS_MODE_CLEANBROWSING =
|
||||
+ ConnectivitySettingsUtils.PRIVATE_DNS_MODE_CLEANBROWSING;
|
||||
+
|
||||
+ /**
|
||||
+ * @hide
|
||||
+ */
|
||||
+ public static final String PRIVATE_DNS_MODE_CIRA = "cira";
|
||||
+ public static final int PRIVATE_DNS_MODE_CIRA =
|
||||
+ ConnectivitySettingsUtils.PRIVATE_DNS_MODE_CIRA;
|
||||
+
|
||||
+ /**
|
||||
+ * @hide
|
||||
+ */
|
||||
+ public static final String PRIVATE_DNS_MODE_CZNIC = "cznic";
|
||||
+ public static final int PRIVATE_DNS_MODE_CZNIC =
|
||||
+ ConnectivitySettingsUtils.PRIVATE_DNS_MODE_CZNIC;
|
||||
+
|
||||
+ /**
|
||||
+ * @hide
|
||||
+ */
|
||||
+ public static final String PRIVATE_DNS_MODE_CLOUDFLARE = "cloudflare";
|
||||
+ public static final int PRIVATE_DNS_MODE_CLOUDFLARE =
|
||||
+ ConnectivitySettingsUtils.PRIVATE_DNS_MODE_CLOUDFLARE;
|
||||
+
|
||||
+ /**
|
||||
+ * @hide
|
||||
+ */
|
||||
+ public static final String PRIVATE_DNS_MODE_GOOGLE = "google";
|
||||
+ public static final int PRIVATE_DNS_MODE_GOOGLE =
|
||||
+ ConnectivitySettingsUtils.PRIVATE_DNS_MODE_GOOGLE;
|
||||
+
|
||||
+ /**
|
||||
+ * @hide
|
||||
+ */
|
||||
+ public static final String PRIVATE_DNS_MODE_MULLVAD = "mullvad";
|
||||
+ public static final int PRIVATE_DNS_MODE_MULLVAD =
|
||||
+ ConnectivitySettingsUtils.PRIVATE_DNS_MODE_MULLVAD;
|
||||
+
|
||||
+ /**
|
||||
+ * @hide
|
||||
+ */
|
||||
+ public static final String PRIVATE_DNS_MODE_QUADNINE = "quadnine";
|
||||
+ public static final int PRIVATE_DNS_MODE_QUADNINE =
|
||||
+ ConnectivitySettingsUtils.PRIVATE_DNS_MODE_QUADNINE;
|
||||
+
|
||||
+ /**
|
||||
+ * @hide
|
||||
+ */
|
||||
+ public static final String PRIVATE_DNS_MODE_RESTENA = "restena";
|
||||
+ public static final int PRIVATE_DNS_MODE_RESTENA =
|
||||
+ ConnectivitySettingsUtils.PRIVATE_DNS_MODE_RESTENA;
|
||||
+
|
||||
+ /**
|
||||
+ * @hide
|
||||
+ */
|
||||
+ public static final String PRIVATE_DNS_MODE_SWITCH = "switch";
|
||||
+ public static final int PRIVATE_DNS_MODE_SWITCH =
|
||||
+ ConnectivitySettingsUtils.PRIVATE_DNS_MODE_SWITCH;
|
||||
+
|
||||
+ /**
|
||||
+ * @hide
|
||||
+ */
|
||||
+ public static final String PRIVATE_DNS_MODE_TWNIC = "twnic";
|
||||
+ public static final int PRIVATE_DNS_MODE_TWNIC =
|
||||
+ ConnectivitySettingsUtils.PRIVATE_DNS_MODE_TWNIC;
|
||||
+
|
||||
+ /**
|
||||
+ * @hide
|
||||
+ */
|
||||
+ public static final String PRIVATE_DNS_MODE_UNCENSOREDDNS = "uncensoreddns";
|
||||
+ public static final int PRIVATE_DNS_MODE_UNCENSOREDDNS =
|
||||
+ ConnectivitySettingsUtils.PRIVATE_DNS_MODE_UNCENSOREDDNS;
|
||||
+
|
||||
/**
|
||||
* @hide
|
||||
*/
|
||||
@@ -804,6 +856,58 @@ public class ConnectivityManager {
|
||||
* @hide
|
||||
*/
|
||||
public static final String PRIVATE_DNS_MODE_PROVIDER_HOSTNAME = "hostname";
|
||||
+ /**
|
||||
+ * @hide
|
||||
+ */
|
||||
+ public static final String PRIVATE_DNS_SPECIFIER_APPLIEDPRIVACY = "dot1.applied-privacy.net";
|
||||
* One of the private DNS modes that indicates the private DNS mode is automatic, which
|
||||
* will try to use the current DNS as private DNS.
|
||||
@@ -366,10 +444,89 @@ public class ConnectivitySettingsManager {
|
||||
public static final int PRIVATE_DNS_MODE_PROVIDER_HOSTNAME =
|
||||
ConnectivitySettingsUtils.PRIVATE_DNS_MODE_PROVIDER_HOSTNAME;
|
||||
|
||||
+ /**
|
||||
+ * @hide
|
||||
+ */
|
||||
+ public static final String PRIVATE_DNS_SPECIFIER_ADGUARD = "dns.adguard.com";
|
||||
+
|
||||
+ /**
|
||||
+ * @hide
|
||||
+ */
|
||||
+ public static final String PRIVATE_DNS_SPECIFIER_APPLIEDPRIVACY = "dot1.applied-privacy.net";
|
||||
+
|
||||
+ /**
|
||||
+ * @hide
|
||||
+ */
|
||||
+ public static final String PRIVATE_DNS_SPECIFIER_CIRA = "protected.canadianshield.cira.ca";
|
||||
+
|
||||
+ /**
|
||||
+ * @hide
|
||||
+ */
|
||||
+ public static final String PRIVATE_DNS_SPECIFIER_CZNIC = "odvr.nic.cz";
|
||||
+
|
||||
+ /**
|
||||
+ * @hide
|
||||
+ */
|
||||
+ public static final String PRIVATE_DNS_SPECIFIER_CLEANBROWSING = "security-filter-dns.cleanbrowsing.org";
|
||||
+
|
||||
+ /**
|
||||
+ * @hide
|
||||
+ */
|
||||
+ public static final String PRIVATE_DNS_SPECIFIER_CLOUDFLARE = "security.cloudflare-dns.com";
|
||||
+
|
||||
+ /**
|
||||
+ * @hide
|
||||
+ */
|
||||
+ public static final String PRIVATE_DNS_SPECIFIER_GOOGLE = "dns.google";
|
||||
+
|
||||
+ /**
|
||||
+ * @hide
|
||||
+ */
|
||||
+ public static final String PRIVATE_DNS_SPECIFIER_MULLVAD = "adblock.doh.mullvad.net";
|
||||
+
|
||||
+ /**
|
||||
+ * @hide
|
||||
+ */
|
||||
+ public static final String PRIVATE_DNS_SPECIFIER_QUADNINE = "dns.quad9.net";
|
||||
+
|
||||
+ /**
|
||||
+ * @hide
|
||||
+ */
|
||||
+ public static final String PRIVATE_DNS_SPECIFIER_RESTENA = "kaitain.restena.lu";
|
||||
+
|
||||
+ /**
|
||||
+ * @hide
|
||||
+ */
|
||||
+ public static final String PRIVATE_DNS_SPECIFIER_SWITCH = "dns.switch.ch";
|
||||
+
|
||||
+ /**
|
||||
+ * @hide
|
||||
+ */
|
||||
+ public static final String PRIVATE_DNS_SPECIFIER_TWNIC = "101.101.101.101";
|
||||
+
|
||||
+ /**
|
||||
+ * @hide
|
||||
+ */
|
||||
+ public static final String PRIVATE_DNS_SPECIFIER_UNCENSOREDDNS = "unicast.censurfridns.dk";
|
||||
/**
|
||||
* The default Private DNS mode.
|
||||
*
|
||||
diff --git a/services/core/java/com/android/server/connectivity/DnsManager.java b/services/core/java/com/android/server/connectivity/DnsManager.java
|
||||
index cf6a7f6e8d70..5d3de9edc930 100644
|
||||
--- a/services/core/java/com/android/server/connectivity/DnsManager.java
|
||||
+++ b/services/core/java/com/android/server/connectivity/DnsManager.java
|
||||
@@ -18,6 +18,32 @@ package com.android.server.connectivity;
|
||||
+
|
||||
+
|
||||
/** @hide */
|
||||
@Retention(RetentionPolicy.SOURCE)
|
||||
@IntDef(value = {
|
||||
PRIVATE_DNS_MODE_OFF,
|
||||
+ PRIVATE_DNS_MODE_ADGUARD,
|
||||
+ PRIVATE_DNS_MODE_APPLIEDPRIVACY,
|
||||
+ PRIVATE_DNS_MODE_CLEANBROWSING,
|
||||
+ PRIVATE_DNS_MODE_CIRA,
|
||||
+ PRIVATE_DNS_MODE_CZNIC,
|
||||
+ PRIVATE_DNS_MODE_CLOUDFLARE,
|
||||
+ PRIVATE_DNS_MODE_GOOGLE,
|
||||
+ PRIVATE_DNS_MODE_MULLVAD,
|
||||
+ PRIVATE_DNS_MODE_QUADNINE,
|
||||
+ PRIVATE_DNS_MODE_RESTENA,
|
||||
+ PRIVATE_DNS_MODE_SWITCH,
|
||||
+ PRIVATE_DNS_MODE_TWNIC,
|
||||
+ PRIVATE_DNS_MODE_UNCENSOREDDNS,
|
||||
PRIVATE_DNS_MODE_OPPORTUNISTIC,
|
||||
PRIVATE_DNS_MODE_PROVIDER_HOSTNAME,
|
||||
})
|
||||
@@ -798,6 +955,19 @@ public class ConnectivitySettingsManager {
|
||||
public static void setPrivateDnsDefaultMode(@NonNull Context context,
|
||||
@NonNull @PrivateDnsMode int mode) {
|
||||
if (!(mode == PRIVATE_DNS_MODE_OFF
|
||||
+ || mode == PRIVATE_DNS_MODE_ADGUARD
|
||||
+ || mode == PRIVATE_DNS_MODE_APPLIEDPRIVACY
|
||||
+ || mode == PRIVATE_DNS_MODE_CLEANBROWSING
|
||||
+ || mode == PRIVATE_DNS_MODE_CIRA
|
||||
+ || mode == PRIVATE_DNS_MODE_CZNIC
|
||||
+ || mode == PRIVATE_DNS_MODE_CLOUDFLARE
|
||||
+ || mode == PRIVATE_DNS_MODE_GOOGLE
|
||||
+ || mode == PRIVATE_DNS_MODE_MULLVAD
|
||||
+ || mode == PRIVATE_DNS_MODE_QUADNINE
|
||||
+ || mode == PRIVATE_DNS_MODE_RESTENA
|
||||
+ || mode == PRIVATE_DNS_MODE_SWITCH
|
||||
+ || mode == PRIVATE_DNS_MODE_TWNIC
|
||||
+ || mode == PRIVATE_DNS_MODE_UNCENSOREDDNS
|
||||
|| mode == PRIVATE_DNS_MODE_OPPORTUNISTIC
|
||||
|| mode == PRIVATE_DNS_MODE_PROVIDER_HOSTNAME)) {
|
||||
throw new IllegalArgumentException("Invalid private dns mode");
|
||||
diff --git a/service/src/com/android/server/connectivity/DnsManager.java b/service/src/com/android/server/connectivity/DnsManager.java
|
||||
index 1493cae79..2a5058c3c 100644
|
||||
--- a/service/src/com/android/server/connectivity/DnsManager.java
|
||||
+++ b/service/src/com/android/server/connectivity/DnsManager.java
|
||||
@@ -23,8 +23,34 @@ import static android.net.ConnectivitySettingsManager.DNS_RESOLVER_SUCCESS_THRES
|
||||
import static android.net.ConnectivitySettingsManager.PRIVATE_DNS_DEFAULT_MODE;
|
||||
import static android.net.ConnectivitySettingsManager.PRIVATE_DNS_MODE;
|
||||
import static android.net.ConnectivitySettingsManager.PRIVATE_DNS_MODE_OFF;
|
||||
+import static android.net.ConnectivitySettingsManager.PRIVATE_DNS_MODE_ADGUARD;
|
||||
+import static android.net.ConnectivitySettingsManager.PRIVATE_DNS_MODE_APPLIEDPRIVACY;
|
||||
+import static android.net.ConnectivitySettingsManager.PRIVATE_DNS_MODE_CLEANBROWSING;
|
||||
+import static android.net.ConnectivitySettingsManager.PRIVATE_DNS_MODE_CIRA;
|
||||
+import static android.net.ConnectivitySettingsManager.PRIVATE_DNS_MODE_CZNIC;
|
||||
+import static android.net.ConnectivitySettingsManager.PRIVATE_DNS_MODE_CLOUDFLARE;
|
||||
+import static android.net.ConnectivitySettingsManager.PRIVATE_DNS_MODE_GOOGLE;
|
||||
+import static android.net.ConnectivitySettingsManager.PRIVATE_DNS_MODE_MULLVAD;
|
||||
+import static android.net.ConnectivitySettingsManager.PRIVATE_DNS_MODE_QUADNINE;
|
||||
+import static android.net.ConnectivitySettingsManager.PRIVATE_DNS_MODE_RESTENA;
|
||||
+import static android.net.ConnectivitySettingsManager.PRIVATE_DNS_MODE_SWITCH;
|
||||
+import static android.net.ConnectivitySettingsManager.PRIVATE_DNS_MODE_TWNIC;
|
||||
+import static android.net.ConnectivitySettingsManager.PRIVATE_DNS_MODE_UNCENSOREDDNS;
|
||||
import static android.net.ConnectivitySettingsManager.PRIVATE_DNS_MODE_PROVIDER_HOSTNAME;
|
||||
import static android.net.ConnectivitySettingsManager.PRIVATE_DNS_SPECIFIER;
|
||||
+import static android.net.ConnectivitySettingsManager.PRIVATE_DNS_SPECIFIER_ADGUARD;
|
||||
+import static android.net.ConnectivitySettingsManager.PRIVATE_DNS_SPECIFIER_APPLIEDPRIVACY;
|
||||
+import static android.net.ConnectivitySettingsManager.PRIVATE_DNS_SPECIFIER_CLEANBROWSING;
|
||||
+import static android.net.ConnectivitySettingsManager.PRIVATE_DNS_SPECIFIER_CIRA;
|
||||
+import static android.net.ConnectivitySettingsManager.PRIVATE_DNS_SPECIFIER_CZNIC;
|
||||
+import static android.net.ConnectivitySettingsManager.PRIVATE_DNS_SPECIFIER_CLOUDFLARE;
|
||||
+import static android.net.ConnectivitySettingsManager.PRIVATE_DNS_SPECIFIER_GOOGLE;
|
||||
+import static android.net.ConnectivitySettingsManager.PRIVATE_DNS_SPECIFIER_MULLVAD;
|
||||
+import static android.net.ConnectivitySettingsManager.PRIVATE_DNS_SPECIFIER_QUADNINE;
|
||||
+import static android.net.ConnectivitySettingsManager.PRIVATE_DNS_SPECIFIER_RESTENA;
|
||||
+import static android.net.ConnectivitySettingsManager.PRIVATE_DNS_SPECIFIER_SWITCH;
|
||||
+import static android.net.ConnectivitySettingsManager.PRIVATE_DNS_SPECIFIER_TWNIC;
|
||||
+import static android.net.ConnectivitySettingsManager.PRIVATE_DNS_SPECIFIER_UNCENSOREDDNS;
|
||||
import static android.net.resolv.aidl.IDnsResolverUnsolicitedEventListener.VALIDATION_RESULT_FAILURE;
|
||||
import static android.net.resolv.aidl.IDnsResolverUnsolicitedEventListener.VALIDATION_RESULT_SUCCESS;
|
||||
|
||||
import static android.net.ConnectivityManager.PRIVATE_DNS_DEFAULT_MODE_FALLBACK;
|
||||
import static android.net.ConnectivityManager.PRIVATE_DNS_MODE_OFF;
|
||||
+import static android.net.ConnectivityManager.PRIVATE_DNS_MODE_ADGUARD;
|
||||
+import static android.net.ConnectivityManager.PRIVATE_DNS_MODE_APPLIEDPRIVACY;
|
||||
+import static android.net.ConnectivityManager.PRIVATE_DNS_MODE_CIRA;
|
||||
+import static android.net.ConnectivityManager.PRIVATE_DNS_MODE_CLEANBROWSING;
|
||||
+import static android.net.ConnectivityManager.PRIVATE_DNS_MODE_CLOUDFLARE;
|
||||
+import static android.net.ConnectivityManager.PRIVATE_DNS_MODE_CZNIC;
|
||||
+import static android.net.ConnectivityManager.PRIVATE_DNS_MODE_GOOGLE;
|
||||
+import static android.net.ConnectivityManager.PRIVATE_DNS_MODE_MULLVAD;
|
||||
+import static android.net.ConnectivityManager.PRIVATE_DNS_MODE_QUADNINE;
|
||||
+import static android.net.ConnectivityManager.PRIVATE_DNS_MODE_RESTENA;
|
||||
+import static android.net.ConnectivityManager.PRIVATE_DNS_MODE_SWITCH;
|
||||
+import static android.net.ConnectivityManager.PRIVATE_DNS_MODE_TWNIC;
|
||||
+import static android.net.ConnectivityManager.PRIVATE_DNS_MODE_UNCENSOREDDNS;
|
||||
+import static android.net.ConnectivityManager.PRIVATE_DNS_SPECIFIER_ADGUARD;
|
||||
+import static android.net.ConnectivityManager.PRIVATE_DNS_SPECIFIER_APPLIEDPRIVACY;
|
||||
+import static android.net.ConnectivityManager.PRIVATE_DNS_SPECIFIER_CIRA;
|
||||
+import static android.net.ConnectivityManager.PRIVATE_DNS_SPECIFIER_CLEANBROWSING;
|
||||
+import static android.net.ConnectivityManager.PRIVATE_DNS_SPECIFIER_CLOUDFLARE;
|
||||
+import static android.net.ConnectivityManager.PRIVATE_DNS_SPECIFIER_CZNIC;
|
||||
+import static android.net.ConnectivityManager.PRIVATE_DNS_SPECIFIER_GOOGLE;
|
||||
+import static android.net.ConnectivityManager.PRIVATE_DNS_SPECIFIER_MULLVAD;
|
||||
+import static android.net.ConnectivityManager.PRIVATE_DNS_SPECIFIER_QUADNINE;
|
||||
+import static android.net.ConnectivityManager.PRIVATE_DNS_SPECIFIER_RESTENA;
|
||||
+import static android.net.ConnectivityManager.PRIVATE_DNS_SPECIFIER_SWITCH;
|
||||
+import static android.net.ConnectivityManager.PRIVATE_DNS_SPECIFIER_TWNIC;
|
||||
+import static android.net.ConnectivityManager.PRIVATE_DNS_SPECIFIER_UNCENSOREDDNS;
|
||||
import static android.net.ConnectivityManager.PRIVATE_DNS_MODE_PROVIDER_HOSTNAME;
|
||||
import static android.provider.Settings.Global.DNS_RESOLVER_MAX_SAMPLES;
|
||||
import static android.provider.Settings.Global.DNS_RESOLVER_MIN_SAMPLES;
|
||||
@@ -136,6 +162,46 @@ public class DnsManager {
|
||||
@@ -141,6 +167,58 @@ public class DnsManager {
|
||||
return new PrivateDnsConfig(specifier, null);
|
||||
}
|
||||
|
||||
+ if (PRIVATE_DNS_MODE_ADGUARD.equals(mode)) {
|
||||
+ if (PRIVATE_DNS_MODE_ADGUARD == mode) {
|
||||
+ return new PrivateDnsConfig(PRIVATE_DNS_SPECIFIER_ADGUARD, null);
|
||||
+ }
|
||||
+ if (PRIVATE_DNS_MODE_APPLIEDPRIVACY.equals(mode)) {
|
||||
+
|
||||
+ if (PRIVATE_DNS_MODE_APPLIEDPRIVACY == mode) {
|
||||
+ return new PrivateDnsConfig(PRIVATE_DNS_SPECIFIER_APPLIEDPRIVACY, null);
|
||||
+ }
|
||||
+ if (PRIVATE_DNS_MODE_CIRA.equals(mode)) {
|
||||
+ return new PrivateDnsConfig(PRIVATE_DNS_SPECIFIER_CIRA, null);
|
||||
+ }
|
||||
+ if (PRIVATE_DNS_MODE_CLEANBROWSING.equals(mode)) {
|
||||
+
|
||||
+ if (PRIVATE_DNS_MODE_CLEANBROWSING == mode) {
|
||||
+ return new PrivateDnsConfig(PRIVATE_DNS_SPECIFIER_CLEANBROWSING, null);
|
||||
+ }
|
||||
+ if (PRIVATE_DNS_MODE_CLOUDFLARE.equals(mode)) {
|
||||
+ return new PrivateDnsConfig(PRIVATE_DNS_SPECIFIER_CLOUDFLARE, null);
|
||||
+
|
||||
+ if (PRIVATE_DNS_MODE_CIRA == mode) {
|
||||
+ return new PrivateDnsConfig(PRIVATE_DNS_SPECIFIER_CIRA, null);
|
||||
+ }
|
||||
+ if (PRIVATE_DNS_MODE_CZNIC.equals(mode)) {
|
||||
+
|
||||
+ if (PRIVATE_DNS_MODE_CZNIC == mode) {
|
||||
+ return new PrivateDnsConfig(PRIVATE_DNS_SPECIFIER_CZNIC, null);
|
||||
+ }
|
||||
+ if (PRIVATE_DNS_MODE_GOOGLE.equals(mode)) {
|
||||
+
|
||||
+ if (PRIVATE_DNS_MODE_CLOUDFLARE == mode) {
|
||||
+ return new PrivateDnsConfig(PRIVATE_DNS_SPECIFIER_CLOUDFLARE, null);
|
||||
+ }
|
||||
+
|
||||
+ if (PRIVATE_DNS_MODE_GOOGLE == mode) {
|
||||
+ return new PrivateDnsConfig(PRIVATE_DNS_SPECIFIER_GOOGLE, null);
|
||||
+ }
|
||||
+ if (PRIVATE_DNS_MODE_MULLVAD.equals(mode)) {
|
||||
+
|
||||
+ if (PRIVATE_DNS_MODE_MULLVAD == mode) {
|
||||
+ return new PrivateDnsConfig(PRIVATE_DNS_SPECIFIER_MULLVAD, null);
|
||||
+ }
|
||||
+ if (PRIVATE_DNS_MODE_QUADNINE.equals(mode)) {
|
||||
+
|
||||
+ if (PRIVATE_DNS_MODE_QUADNINE == mode) {
|
||||
+ return new PrivateDnsConfig(PRIVATE_DNS_SPECIFIER_QUADNINE, null);
|
||||
+ }
|
||||
+ if (PRIVATE_DNS_MODE_RESTENA.equals(mode)) {
|
||||
+
|
||||
+ if (PRIVATE_DNS_MODE_RESTENA == mode) {
|
||||
+ return new PrivateDnsConfig(PRIVATE_DNS_SPECIFIER_RESTENA, null);
|
||||
+ }
|
||||
+ if (PRIVATE_DNS_MODE_SWITCH.equals(mode)) {
|
||||
+
|
||||
+ if (PRIVATE_DNS_MODE_SWITCH == mode) {
|
||||
+ return new PrivateDnsConfig(PRIVATE_DNS_SPECIFIER_SWITCH, null);
|
||||
+ }
|
||||
+ if (PRIVATE_DNS_MODE_TWNIC.equals(mode)) {
|
||||
+
|
||||
+ if (PRIVATE_DNS_MODE_TWNIC == mode) {
|
||||
+ return new PrivateDnsConfig(PRIVATE_DNS_SPECIFIER_TWNIC, null);
|
||||
+ }
|
||||
+ if (PRIVATE_DNS_MODE_UNCENSOREDDNS.equals(mode)) {
|
||||
+
|
||||
+ if (PRIVATE_DNS_MODE_UNCENSOREDDNS == mode) {
|
||||
+ return new PrivateDnsConfig(PRIVATE_DNS_SPECIFIER_UNCENSOREDDNS, null);
|
||||
+ }
|
||||
+
|
||||
|
@ -178,8 +178,12 @@ if enterAndClear "frameworks/ex"; then
|
||||
if [ "$DOS_GRAPHENE_CONSTIFY" = true ]; then applyPatch "$DOS_PATCHES/android_frameworks_ex/0001-constify_JNINativeMethod.patch"; fi; #Constify JNINativeMethod tables (GrapheneOS)
|
||||
fi;
|
||||
|
||||
if enterAndClear "frameworks/libs/net"; then
|
||||
applyPatch "$DOS_PATCHES/android_frameworks_libs_net/0001-Private_DNS.patch"; #More 'Private DNS' options (heavily based off of a CalyxOS patch)
|
||||
fi;
|
||||
|
||||
if enterAndClear "frameworks/libs/systemui"; then
|
||||
applyPatch "$DOS_PATCHES/android_frameworks_libs_systemui/0001-Icon_Cache.patch"; #Invalidate icon cache between OS releases (GrapheneOS)
|
||||
applyPatch "$DOS_PATCHES/android_frameworks_libs_systemui/0001-Icon_Cache.patch"; #Invalidate icon cache between OS releases (GrapheneOS)
|
||||
fi;
|
||||
|
||||
if enterAndClear "frameworks/native"; then
|
||||
@ -250,7 +254,7 @@ fi;
|
||||
|
||||
if enterAndClear "packages/apps/Settings"; then
|
||||
#applyPatch "$DOS_PATCHES/android_packages_apps_Settings/0001-Captive_Portal_Toggle.patch"; #Add option to disable captive portal checks (MSe1969) #XXX 19REBASE: broken?
|
||||
#applyPatch "$DOS_PATCHES/android_packages_apps_Settings/0004-Private_DNS.patch"; #More 'Private DNS' options (heavily based off of a CalyxOS patch) #XXX 19REBASE
|
||||
applyPatch "$DOS_PATCHES/android_packages_apps_Settings/0004-Private_DNS.patch"; #More 'Private DNS' options (heavily based off of a CalyxOS patch)
|
||||
applyPatch "$DOS_PATCHES/android_packages_apps_Settings/0005-Automatic_Reboot.patch"; #Timeout for reboot (GrapheneOS)
|
||||
applyPatch "$DOS_PATCHES/android_packages_apps_Settings/0006-Bluetooth_Timeout.patch"; #Timeout for Bluetooth (CalyxOS)
|
||||
applyPatch "$DOS_PATCHES/android_packages_apps_Settings/0007-WiFi_Timeout.patch"; #Timeout for Wi-Fi (CalyxOS)
|
||||
@ -286,7 +290,7 @@ if enterAndClear "packages/modules/Connectivity"; then
|
||||
applyPatch "$DOS_PATCHES/android_packages_modules_Connectivity/0001-Network_Permission-1.patch"; #Add callback for enforcing INTERNET permission changes (GrapheneOS)
|
||||
applyPatch "$DOS_PATCHES/android_packages_modules_Connectivity/0001-Network_Permission-2.patch"; #Use uid instead of app id (GrapheneOS)
|
||||
applyPatch "$DOS_PATCHES/android_packages_modules_Connectivity/0001-Network_Permission-3.patch"; #Skip reportNetworkConnectivity() when permission is revoked (GrapheneOS)
|
||||
#applyPatch "$DOS_PATCHES/android_packages_modules_Connectivity/0002-Private_DNS.patch"; #More 'Private DNS' options (heavily based off of a CalyxOS patch) #XXX 19REBASE
|
||||
applyPatch "$DOS_PATCHES/android_packages_modules_Connectivity/0002-Private_DNS.patch"; #More 'Private DNS' options (heavily based off of a CalyxOS patch)
|
||||
fi;
|
||||
|
||||
if enterAndClear "packages/modules/DnsResolver"; then
|
||||
|
Loading…
Reference in New Issue
Block a user