Add more 'Private DNS' options

Based off of patches from CalyxOS as noted in each included patch.

Tested and verified working on klte and mata 18.1

Signed-off-by: Tad <tad@spotco.us>
This commit is contained in:
Tad 2021-10-21 20:58:47 -04:00
parent 70b96aa211
commit fe8e8201a9
10 changed files with 763 additions and 10 deletions

View File

@ -0,0 +1,105 @@
From c8583ef74a188973fae22b1589d6634944fada12 Mon Sep 17 00:00:00 2001
From: Tad <tad@spotco.us>
Date: Thu, 21 Oct 2021 20:54:37 -0400
Subject: [PATCH] Add more 'Private DNS' options
This adds: Quad9, Cloudflare, and AdGuard
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
Signed-off-by: Tad <tad@spotco.us>
Change-Id: Id75a774ce1ed109a83c6a5bf512536c643165d71
---
.../java/android/net/ConnectivityManager.java | 24 +++++++++++++++++++
.../server/connectivity/DnsManager.java | 18 ++++++++++++++
2 files changed, 42 insertions(+)
diff --git a/core/java/android/net/ConnectivityManager.java b/core/java/android/net/ConnectivityManager.java
index c5cb1f5b7cf8..e9271b3fe03f 100644
--- a/core/java/android/net/ConnectivityManager.java
+++ b/core/java/android/net/ConnectivityManager.java
@@ -688,6 +688,18 @@ public class ConnectivityManager {
* @hide
*/
public static final String PRIVATE_DNS_MODE_OFF = "off";
+ /**
+ * @hide
+ */
+ public static final String PRIVATE_DNS_MODE_QUADNINE = "quadnine";
+ /**
+ * @hide
+ */
+ public static final String PRIVATE_DNS_MODE_CLOUDFLARE = "cloudflare";
+ /**
+ * @hide
+ */
+ public static final String PRIVATE_DNS_MODE_ADGUARD = "adguard";
/**
* @hide
*/
@@ -696,6 +708,18 @@ public class ConnectivityManager {
* @hide
*/
public static final String PRIVATE_DNS_MODE_PROVIDER_HOSTNAME = "hostname";
+ /**
+ * @hide
+ */
+ public static final String PRIVATE_DNS_SPECIFIER_QUADNINE = "dns.quad9.net";
+ /**
+ * @hide
+ */
+ public static final String PRIVATE_DNS_SPECIFIER_CLOUDFLARE = "one.one.one.one";
+ /**
+ * @hide
+ */
+ public static final String PRIVATE_DNS_SPECIFIER_ADGUARD = "dns.adguard.com";
/**
* 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 c0beb37577fc..953a0ff57ae5 100644
--- a/services/core/java/com/android/server/connectivity/DnsManager.java
+++ b/services/core/java/com/android/server/connectivity/DnsManager.java
@@ -18,8 +18,14 @@ package com.android.server.connectivity;
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_QUADNINE;
+import static android.net.ConnectivityManager.PRIVATE_DNS_MODE_CLOUDFLARE;
+import static android.net.ConnectivityManager.PRIVATE_DNS_MODE_ADGUARD;
import static android.net.ConnectivityManager.PRIVATE_DNS_MODE_OPPORTUNISTIC;
import static android.net.ConnectivityManager.PRIVATE_DNS_MODE_PROVIDER_HOSTNAME;
+import static android.net.ConnectivityManager.PRIVATE_DNS_SPECIFIER_QUADNINE;
+import static android.net.ConnectivityManager.PRIVATE_DNS_SPECIFIER_CLOUDFLARE;
+import static android.net.ConnectivityManager.PRIVATE_DNS_SPECIFIER_ADGUARD;
import static android.provider.Settings.Global.DNS_RESOLVER_MIN_SAMPLES;
import static android.provider.Settings.Global.DNS_RESOLVER_MAX_SAMPLES;
import static android.provider.Settings.Global.DNS_RESOLVER_SAMPLE_VALIDITY_SECONDS;
@@ -171,6 +177,18 @@ public class DnsManager {
return new PrivateDnsConfig(specifier, null);
}
+ if (PRIVATE_DNS_MODE_QUADNINE.equals(mode)) {
+ return new PrivateDnsConfig(PRIVATE_DNS_SPECIFIER_QUADNINE, null);
+ }
+
+ if (PRIVATE_DNS_MODE_CLOUDFLARE.equals(mode)) {
+ return new PrivateDnsConfig(PRIVATE_DNS_SPECIFIER_CLOUDFLARE, null);
+ }
+
+ if (PRIVATE_DNS_MODE_ADGUARD.equals(mode)) {
+ return new PrivateDnsConfig(PRIVATE_DNS_SPECIFIER_ADGUARD, null);
+ }
+
return new PrivateDnsConfig(useTls);
}
--
2.31.1

View File

@ -0,0 +1,146 @@
From d9fb7d098be24dbb397e525a94f32b36df720e40 Mon Sep 17 00:00:00 2001
From: Tad <tad@spotco.us>
Date: Thu, 21 Oct 2021 21:09:38 -0400
Subject: [PATCH] Add more 'Private DNS' options
This adds: Quad9, Cloudflare, and AdGuard
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
Signed-off-by: Tad <tad@spotco.us>
Change-Id: I423ad5a3c360a687a226e61df3f75b5550f851c0
---
res/layout/private_dns_mode_dialog.xml | 21 +++++++++++++++++++
res/values/cm_strings.xml | 5 +++++
.../PrivateDnsModeDialogPreference.java | 15 +++++++++++++
.../PrivateDnsPreferenceController.java | 15 +++++++++++++
4 files changed, 56 insertions(+)
diff --git a/res/layout/private_dns_mode_dialog.xml b/res/layout/private_dns_mode_dialog.xml
index 652bc63ae3..2290a61183 100644
--- a/res/layout/private_dns_mode_dialog.xml
+++ b/res/layout/private_dns_mode_dialog.xml
@@ -33,6 +33,27 @@
android:layout_height="wrap_content"
android:layout_margin="8dp"/>
+ <RadioButton
+ android:id="@+id/private_dns_mode_quadnine"
+ android:text="@string/private_dns_mode_quadnine"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_margin="8dp"/>
+
+ <RadioButton
+ android:id="@+id/private_dns_mode_cloudflare"
+ android:text="@string/private_dns_mode_cloudflare"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_margin="8dp"/>
+
+ <RadioButton
+ android:id="@+id/private_dns_mode_adguard"
+ android:text="@string/private_dns_mode_adguard"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_margin="8dp"/>
+
<RadioButton
android:id="@+id/private_dns_mode_opportunistic"
android:text="@string/private_dns_mode_opportunistic"
diff --git a/res/values/cm_strings.xml b/res/values/cm_strings.xml
index 7d0b80d3c0..a7bf8a7fcf 100644
--- a/res/values/cm_strings.xml
+++ b/res/values/cm_strings.xml
@@ -337,6 +337,11 @@
<string name="unlock_scramble_pin_layout_title">Scramble layout</string>
<string name="unlock_scramble_pin_layout_summary">Scramble PIN layout when unlocking device</string>
+ <!-- Private DNS -->
+ <string name="private_dns_mode_quadnine" translatable="false">Quad9</string>
+ <string name="private_dns_mode_cloudflare" translatable="false">Cloudflare</string>
+ <string name="private_dns_mode_adguard" translatable="false">AdGuard</string>
+
<!-- Proximity wake -->
<string name="proximity_wake_title">Prevent accidental wake-up</string>
<string name="proximity_wake_summary">Check the proximity sensor prior to waking up screen</string>
diff --git a/src/com/android/settings/network/PrivateDnsModeDialogPreference.java b/src/com/android/settings/network/PrivateDnsModeDialogPreference.java
index 290ffd599e..a59bcac291 100644
--- a/src/com/android/settings/network/PrivateDnsModeDialogPreference.java
+++ b/src/com/android/settings/network/PrivateDnsModeDialogPreference.java
@@ -17,6 +17,9 @@ package com.android.settings.network;
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_QUADNINE;
+import static android.net.ConnectivityManager.PRIVATE_DNS_MODE_CLOUDFLARE;
+import static android.net.ConnectivityManager.PRIVATE_DNS_MODE_ADGUARD;
import static android.net.ConnectivityManager.PRIVATE_DNS_MODE_OPPORTUNISTIC;
import static android.net.ConnectivityManager.PRIVATE_DNS_MODE_PROVIDER_HOSTNAME;
import static android.system.OsConstants.AF_INET;
@@ -68,6 +71,9 @@ public class PrivateDnsModeDialogPreference extends CustomDialogPreference imple
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_QUADNINE, R.id.private_dns_mode_quadnine);
+ PRIVATE_DNS_MAP.put(PRIVATE_DNS_MODE_CLOUDFLARE, R.id.private_dns_mode_cloudflare);
+ PRIVATE_DNS_MAP.put(PRIVATE_DNS_MODE_ADGUARD, R.id.private_dns_mode_adguard);
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);
}
@@ -180,6 +186,15 @@ public class PrivateDnsModeDialogPreference extends CustomDialogPreference imple
case R.id.private_dns_mode_off:
mMode = PRIVATE_DNS_MODE_OFF;
break;
+ case R.id.private_dns_mode_quadnine:
+ mMode = PRIVATE_DNS_MODE_QUADNINE;
+ break;
+ case R.id.private_dns_mode_cloudflare:
+ mMode = PRIVATE_DNS_MODE_CLOUDFLARE;
+ break;
+ case R.id.private_dns_mode_adguard:
+ mMode = PRIVATE_DNS_MODE_ADGUARD;
+ break;
case R.id.private_dns_mode_opportunistic:
mMode = PRIVATE_DNS_MODE_OPPORTUNISTIC;
break;
diff --git a/src/com/android/settings/network/PrivateDnsPreferenceController.java b/src/com/android/settings/network/PrivateDnsPreferenceController.java
index 6f38569673..20495388e6 100644
--- a/src/com/android/settings/network/PrivateDnsPreferenceController.java
+++ b/src/com/android/settings/network/PrivateDnsPreferenceController.java
@@ -17,6 +17,9 @@
package com.android.settings.network;
import static android.net.ConnectivityManager.PRIVATE_DNS_MODE_OFF;
+import static android.net.ConnectivityManager.PRIVATE_DNS_MODE_QUADNINE;
+import static android.net.ConnectivityManager.PRIVATE_DNS_MODE_CLOUDFLARE;
+import static android.net.ConnectivityManager.PRIVATE_DNS_MODE_ADGUARD;
import static android.net.ConnectivityManager.PRIVATE_DNS_MODE_OPPORTUNISTIC;
import static android.net.ConnectivityManager.PRIVATE_DNS_MODE_PROVIDER_HOSTNAME;
import static android.provider.Settings.Global.PRIVATE_DNS_DEFAULT_MODE;
@@ -118,6 +121,18 @@ public class PrivateDnsPreferenceController extends BasePreferenceController
switch (mode) {
case PRIVATE_DNS_MODE_OFF:
return res.getString(R.string.private_dns_mode_off);
+ case PRIVATE_DNS_MODE_QUADNINE:
+ return dnsesResolved
+ ? res.getString(R.string.private_dns_mode_quadnine)
+ : res.getString(R.string.private_dns_mode_provider_failure);
+ case PRIVATE_DNS_MODE_CLOUDFLARE:
+ return dnsesResolved
+ ? res.getString(R.string.private_dns_mode_cloudflare)
+ : res.getString(R.string.private_dns_mode_provider_failure);
+ case PRIVATE_DNS_MODE_ADGUARD:
+ return dnsesResolved
+ ? res.getString(R.string.private_dns_mode_adguard)
+ : res.getString(R.string.private_dns_mode_provider_failure);
case PRIVATE_DNS_MODE_OPPORTUNISTIC:
// TODO (b/79122154) : create a string specifically for this, instead of
// hijacking a string from notifications. This is necessary at this time
--
2.31.1

View File

@ -0,0 +1,104 @@
From cb680f5b02741c6770d8f7c356cd5a2d1de46746 Mon Sep 17 00:00:00 2001
From: Tad <tad@spotco.us>
Date: Thu, 21 Oct 2021 20:54:37 -0400
Subject: [PATCH] Add more 'Private DNS' options
This adds: Quad9, Cloudflare, and AdGuard
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
Signed-off-by: Tad <tad@spotco.us>
Change-Id: Id75a774ce1ed109a83c6a5bf512536c643165d71
---
.../java/android/net/ConnectivityManager.java | 24 +++++++++++++++++++
.../server/connectivity/DnsManager.java | 18 ++++++++++++++
2 files changed, 42 insertions(+)
diff --git a/core/java/android/net/ConnectivityManager.java b/core/java/android/net/ConnectivityManager.java
index 111a8c48a46c..13d0d699cb2d 100644
--- a/core/java/android/net/ConnectivityManager.java
+++ b/core/java/android/net/ConnectivityManager.java
@@ -757,6 +757,18 @@ public class ConnectivityManager {
* @hide
*/
public static final String PRIVATE_DNS_MODE_OFF = "off";
+ /**
+ * @hide
+ */
+ public static final String PRIVATE_DNS_MODE_QUADNINE = "quadnine";
+ /**
+ * @hide
+ */
+ public static final String PRIVATE_DNS_MODE_CLOUDFLARE = "cloudflare";
+ /**
+ * @hide
+ */
+ public static final String PRIVATE_DNS_MODE_ADGUARD = "adguard";
/**
* @hide
*/
@@ -765,6 +777,18 @@ public class ConnectivityManager {
* @hide
*/
public static final String PRIVATE_DNS_MODE_PROVIDER_HOSTNAME = "hostname";
+ /**
+ * @hide
+ */
+ public static final String PRIVATE_DNS_SPECIFIER_QUADNINE = "dns.quad9.net";
+ /**
+ * @hide
+ */
+ public static final String PRIVATE_DNS_SPECIFIER_CLOUDFLARE = "one.one.one.one";
+ /**
+ * @hide
+ */
+ public static final String PRIVATE_DNS_SPECIFIER_ADGUARD = "dns.adguard.com";
/**
* 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 2321afb7df43..bb4b829d6584 100644
--- a/services/core/java/com/android/server/connectivity/DnsManager.java
+++ b/services/core/java/com/android/server/connectivity/DnsManager.java
@@ -18,7 +18,13 @@ package com.android.server.connectivity;
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_QUADNINE;
+import static android.net.ConnectivityManager.PRIVATE_DNS_MODE_CLOUDFLARE;
+import static android.net.ConnectivityManager.PRIVATE_DNS_MODE_ADGUARD;
import static android.net.ConnectivityManager.PRIVATE_DNS_MODE_PROVIDER_HOSTNAME;
+import static android.net.ConnectivityManager.PRIVATE_DNS_SPECIFIER_QUADNINE;
+import static android.net.ConnectivityManager.PRIVATE_DNS_SPECIFIER_CLOUDFLARE;
+import static android.net.ConnectivityManager.PRIVATE_DNS_SPECIFIER_ADGUARD;
import static android.provider.Settings.Global.DNS_RESOLVER_MAX_SAMPLES;
import static android.provider.Settings.Global.DNS_RESOLVER_MIN_SAMPLES;
import static android.provider.Settings.Global.DNS_RESOLVER_SAMPLE_VALIDITY_SECONDS;
@@ -131,6 +137,18 @@ public class DnsManager {
return new PrivateDnsConfig(specifier, null);
}
+ if (PRIVATE_DNS_MODE_QUADNINE.equals(mode)) {
+ return new PrivateDnsConfig(PRIVATE_DNS_SPECIFIER_QUADNINE, null);
+ }
+
+ if (PRIVATE_DNS_MODE_CLOUDFLARE.equals(mode)) {
+ return new PrivateDnsConfig(PRIVATE_DNS_SPECIFIER_CLOUDFLARE, null);
+ }
+
+ if (PRIVATE_DNS_MODE_ADGUARD.equals(mode)) {
+ return new PrivateDnsConfig(PRIVATE_DNS_SPECIFIER_ADGUARD, null);
+ }
+
return new PrivateDnsConfig(useTls);
}
--
2.31.1

View File

@ -0,0 +1,149 @@
From 803814d0fe7363a63ec5b9ad6776e37f5cb14f30 Mon Sep 17 00:00:00 2001
From: Tad <tad@spotco.us>
Date: Thu, 21 Oct 2021 21:09:38 -0400
Subject: [PATCH] Add more 'Private DNS' options
This adds: Quad9, Cloudflare, and AdGuard
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
Signed-off-by: Tad <tad@spotco.us>
Change-Id: I423ad5a3c360a687a226e61df3f75b5550f851c0
---
res/layout/private_dns_mode_dialog.xml | 24 +++++++++++++++++++
res/values/cm_strings.xml | 5 ++++
.../PrivateDnsModeDialogPreference.java | 15 ++++++++++++
.../PrivateDnsPreferenceController.java | 15 ++++++++++++
4 files changed, 59 insertions(+)
diff --git a/res/layout/private_dns_mode_dialog.xml b/res/layout/private_dns_mode_dialog.xml
index 641905dc01..4f13464a27 100644
--- a/res/layout/private_dns_mode_dialog.xml
+++ b/res/layout/private_dns_mode_dialog.xml
@@ -38,6 +38,30 @@
android:layout_marginStart="8dp"
android:minHeight="48dp"/>
+ <RadioButton
+ android:id="@+id/private_dns_mode_quadnine"
+ android:text="@string/private_dns_mode_quadnine"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginStart="8dp"
+ android:minHeight="48dp"/>
+
+ <RadioButton
+ android:id="@+id/private_dns_mode_cloudflare"
+ android:text="@string/private_dns_mode_cloudflare"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginStart="8dp"
+ android:minHeight="48dp"/>
+
+ <RadioButton
+ android:id="@+id/private_dns_mode_adguard"
+ android:text="@string/private_dns_mode_adguard"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginStart="8dp"
+ android:minHeight="48dp"/>
+
<RadioButton
android:id="@+id/private_dns_mode_opportunistic"
android:text="@string/private_dns_mode_opportunistic"
diff --git a/res/values/cm_strings.xml b/res/values/cm_strings.xml
index 12ad48e683..78f835e4e1 100644
--- a/res/values/cm_strings.xml
+++ b/res/values/cm_strings.xml
@@ -104,6 +104,11 @@
<string name="unlock_scramble_pin_layout_title">Scramble layout</string>
<string name="unlock_scramble_pin_layout_summary">Scramble PIN layout when unlocking device</string>
+ <!-- Private DNS -->
+ <string name="private_dns_mode_quadnine" translatable="false">Quad9</string>
+ <string name="private_dns_mode_cloudflare" translatable="false">Cloudflare</string>
+ <string name="private_dns_mode_adguard" translatable="false">AdGuard</string>
+
<!-- Volume link notification -->
<string name="volume_link_notification_title">Link ring &amp; notification volumes</string>
diff --git a/src/com/android/settings/network/PrivateDnsModeDialogPreference.java b/src/com/android/settings/network/PrivateDnsModeDialogPreference.java
index 1655c69cea..26f68f1cf7 100644
--- a/src/com/android/settings/network/PrivateDnsModeDialogPreference.java
+++ b/src/com/android/settings/network/PrivateDnsModeDialogPreference.java
@@ -17,6 +17,9 @@ package com.android.settings.network;
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_QUADNINE;
+import static android.net.ConnectivityManager.PRIVATE_DNS_MODE_CLOUDFLARE;
+import static android.net.ConnectivityManager.PRIVATE_DNS_MODE_ADGUARD;
import static android.net.ConnectivityManager.PRIVATE_DNS_MODE_OPPORTUNISTIC;
import static android.net.ConnectivityManager.PRIVATE_DNS_MODE_PROVIDER_HOSTNAME;
@@ -73,6 +76,9 @@ public class PrivateDnsModeDialogPreference extends CustomDialogPreferenceCompat
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_QUADNINE, R.id.private_dns_mode_quadnine);
+ PRIVATE_DNS_MAP.put(PRIVATE_DNS_MODE_CLOUDFLARE, R.id.private_dns_mode_cloudflare);
+ PRIVATE_DNS_MAP.put(PRIVATE_DNS_MODE_ADGUARD, R.id.private_dns_mode_adguard);
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);
}
@@ -211,6 +217,15 @@ public class PrivateDnsModeDialogPreference extends CustomDialogPreferenceCompat
case R.id.private_dns_mode_off:
mMode = PRIVATE_DNS_MODE_OFF;
break;
+ case R.id.private_dns_mode_quadnine:
+ mMode = PRIVATE_DNS_MODE_QUADNINE;
+ break;
+ case R.id.private_dns_mode_cloudflare:
+ mMode = PRIVATE_DNS_MODE_CLOUDFLARE;
+ break;
+ case R.id.private_dns_mode_adguard:
+ mMode = PRIVATE_DNS_MODE_ADGUARD;
+ break;
case R.id.private_dns_mode_opportunistic:
mMode = PRIVATE_DNS_MODE_OPPORTUNISTIC;
break;
diff --git a/src/com/android/settings/network/PrivateDnsPreferenceController.java b/src/com/android/settings/network/PrivateDnsPreferenceController.java
index 47c3a95c9f..0a76cc245e 100644
--- a/src/com/android/settings/network/PrivateDnsPreferenceController.java
+++ b/src/com/android/settings/network/PrivateDnsPreferenceController.java
@@ -17,6 +17,9 @@
package com.android.settings.network;
import static android.net.ConnectivityManager.PRIVATE_DNS_MODE_OFF;
+import static android.net.ConnectivityManager.PRIVATE_DNS_MODE_QUADNINE;
+import static android.net.ConnectivityManager.PRIVATE_DNS_MODE_CLOUDFLARE;
+import static android.net.ConnectivityManager.PRIVATE_DNS_MODE_ADGUARD;
import static android.net.ConnectivityManager.PRIVATE_DNS_MODE_OPPORTUNISTIC;
import static android.net.ConnectivityManager.PRIVATE_DNS_MODE_PROVIDER_HOSTNAME;
import static android.provider.Settings.Global.PRIVATE_DNS_DEFAULT_MODE;
@@ -125,6 +128,18 @@ public class PrivateDnsPreferenceController extends BasePreferenceController
switch (mode) {
case PRIVATE_DNS_MODE_OFF:
return res.getString(R.string.private_dns_mode_off);
+ case PRIVATE_DNS_MODE_QUADNINE:
+ return dnsesResolved
+ ? res.getString(R.string.private_dns_mode_quadnine)
+ : res.getString(R.string.private_dns_mode_provider_failure);
+ case PRIVATE_DNS_MODE_CLOUDFLARE:
+ return dnsesResolved
+ ? res.getString(R.string.private_dns_mode_cloudflare)
+ : res.getString(R.string.private_dns_mode_provider_failure);
+ case PRIVATE_DNS_MODE_ADGUARD:
+ return dnsesResolved
+ ? res.getString(R.string.private_dns_mode_adguard)
+ : res.getString(R.string.private_dns_mode_provider_failure);
case PRIVATE_DNS_MODE_OPPORTUNISTIC:
// TODO (b/79122154) : create a string specifically for this, instead of
// hijacking a string from notifications. This is necessary at this time
--
2.31.1

View File

@ -0,0 +1,104 @@
From f62f32f8dc9940f7da0c1f527035367de2ae5fc5 Mon Sep 17 00:00:00 2001
From: Tad <tad@spotco.us>
Date: Thu, 21 Oct 2021 20:54:37 -0400
Subject: [PATCH] Add more 'Private DNS' options
This adds: Quad9, Cloudflare, and AdGuard
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
Signed-off-by: Tad <tad@spotco.us>
Change-Id: Id75a774ce1ed109a83c6a5bf512536c643165d71
---
.../java/android/net/ConnectivityManager.java | 24 +++++++++++++++++++
.../server/connectivity/DnsManager.java | 18 ++++++++++++++
2 files changed, 42 insertions(+)
diff --git a/core/java/android/net/ConnectivityManager.java b/core/java/android/net/ConnectivityManager.java
index ed03f5198d6f..754ee2583002 100644
--- a/core/java/android/net/ConnectivityManager.java
+++ b/core/java/android/net/ConnectivityManager.java
@@ -796,6 +796,18 @@ public class ConnectivityManager {
* @hide
*/
public static final String PRIVATE_DNS_MODE_OFF = "off";
+ /**
+ * @hide
+ */
+ public static final String PRIVATE_DNS_MODE_QUADNINE = "quadnine";
+ /**
+ * @hide
+ */
+ public static final String PRIVATE_DNS_MODE_CLOUDFLARE = "cloudflare";
+ /**
+ * @hide
+ */
+ public static final String PRIVATE_DNS_MODE_ADGUARD = "adguard";
/**
* @hide
*/
@@ -804,6 +816,18 @@ public class ConnectivityManager {
* @hide
*/
public static final String PRIVATE_DNS_MODE_PROVIDER_HOSTNAME = "hostname";
+ /**
+ * @hide
+ */
+ public static final String PRIVATE_DNS_SPECIFIER_QUADNINE = "dns.quad9.net";
+ /**
+ * @hide
+ */
+ public static final String PRIVATE_DNS_SPECIFIER_CLOUDFLARE = "one.one.one.one";
+ /**
+ * @hide
+ */
+ public static final String PRIVATE_DNS_SPECIFIER_ADGUARD = "dns.adguard.com";
/**
* 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..0410d54ac8a7 100644
--- a/services/core/java/com/android/server/connectivity/DnsManager.java
+++ b/services/core/java/com/android/server/connectivity/DnsManager.java
@@ -18,7 +18,13 @@ package com.android.server.connectivity;
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_QUADNINE;
+import static android.net.ConnectivityManager.PRIVATE_DNS_MODE_CLOUDFLARE;
+import static android.net.ConnectivityManager.PRIVATE_DNS_MODE_ADGUARD;
import static android.net.ConnectivityManager.PRIVATE_DNS_MODE_PROVIDER_HOSTNAME;
+import static android.net.ConnectivityManager.PRIVATE_DNS_SPECIFIER_QUADNINE;
+import static android.net.ConnectivityManager.PRIVATE_DNS_SPECIFIER_CLOUDFLARE;
+import static android.net.ConnectivityManager.PRIVATE_DNS_SPECIFIER_ADGUARD;
import static android.provider.Settings.Global.DNS_RESOLVER_MAX_SAMPLES;
import static android.provider.Settings.Global.DNS_RESOLVER_MIN_SAMPLES;
import static android.provider.Settings.Global.DNS_RESOLVER_SAMPLE_VALIDITY_SECONDS;
@@ -136,6 +142,18 @@ public class DnsManager {
return new PrivateDnsConfig(specifier, null);
}
+ if (PRIVATE_DNS_MODE_QUADNINE.equals(mode)) {
+ return new PrivateDnsConfig(PRIVATE_DNS_SPECIFIER_QUADNINE, null);
+ }
+
+ if (PRIVATE_DNS_MODE_CLOUDFLARE.equals(mode)) {
+ return new PrivateDnsConfig(PRIVATE_DNS_SPECIFIER_CLOUDFLARE, null);
+ }
+
+ if (PRIVATE_DNS_MODE_ADGUARD.equals(mode)) {
+ return new PrivateDnsConfig(PRIVATE_DNS_SPECIFIER_ADGUARD, null);
+ }
+
return new PrivateDnsConfig(useTls);
}
--
2.31.1

View File

@ -0,0 +1,148 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Tad <tad@spotco.us>
Date: Thu, 21 Oct 2021 21:09:38 -0400
Subject: [PATCH] Add more 'Private DNS' options
This adds: Quad9, Cloudflare, and AdGuard
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
Signed-off-by: Tad <tad@spotco.us>
Change-Id: I423ad5a3c360a687a226e61df3f75b5550f851c0
---
res/layout/private_dns_mode_dialog.xml | 12 +++++++++++
res/values/cm_strings.xml | 5 +++++
.../PrivateDnsModeDialogPreference.java | 21 +++++++++++++++++++
.../PrivateDnsPreferenceController.java | 15 +++++++++++++
4 files changed, 53 insertions(+)
diff --git a/res/layout/private_dns_mode_dialog.xml b/res/layout/private_dns_mode_dialog.xml
index 0b4f4db6c4..8b1d28450c 100644
--- a/res/layout/private_dns_mode_dialog.xml
+++ b/res/layout/private_dns_mode_dialog.xml
@@ -35,6 +35,18 @@
android:id="@+id/private_dns_mode_off"
layout="@layout/preference_widget_dialog_radiobutton"/>
+ <include
+ android:id="@+id/private_dns_mode_quadnine"
+ 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_adguard"
+ 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 c35c696b16..d18f0af87f 100644
--- a/res/values/cm_strings.xml
+++ b/res/values/cm_strings.xml
@@ -177,4 +177,9 @@
<string name="captive_portal_switch_title">Captive portal mode</string>
<string name="captive_portal_switch_summary">Enable or disable the captive portal probing for connection attempts (default ON).</string>
<string name="captive_portal_switch_warning">If you switch off the captive portal, you will not receive connectivity informations any longer. Really switch off?</string>
+
+ <!-- Private DNS -->
+ <string name="private_dns_mode_quadnine" translatable="false">Quad9</string>
+ <string name="private_dns_mode_cloudflare" translatable="false">Cloudflare</string>
+ <string name="private_dns_mode_adguard" translatable="false">AdGuard</string>
</resources>
diff --git a/src/com/android/settings/network/PrivateDnsModeDialogPreference.java b/src/com/android/settings/network/PrivateDnsModeDialogPreference.java
index 3fc5086cd6..af4b08f3a7 100644
--- a/src/com/android/settings/network/PrivateDnsModeDialogPreference.java
+++ b/src/com/android/settings/network/PrivateDnsModeDialogPreference.java
@@ -17,6 +17,9 @@ package com.android.settings.network;
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_QUADNINE;
+import static android.net.ConnectivityManager.PRIVATE_DNS_MODE_CLOUDFLARE;
+import static android.net.ConnectivityManager.PRIVATE_DNS_MODE_ADGUARD;
import static android.net.ConnectivityManager.PRIVATE_DNS_MODE_OPPORTUNISTIC;
import static android.net.ConnectivityManager.PRIVATE_DNS_MODE_PROVIDER_HOSTNAME;
@@ -74,6 +77,9 @@ public class PrivateDnsModeDialogPreference extends CustomDialogPreferenceCompat
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_QUADNINE, R.id.private_dns_mode_quadnine);
+ PRIVATE_DNS_MAP.put(PRIVATE_DNS_MODE_CLOUDFLARE, R.id.private_dns_mode_cloudflare);
+ PRIVATE_DNS_MAP.put(PRIVATE_DNS_MODE_ADGUARD, R.id.private_dns_mode_adguard);
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);
}
@@ -180,6 +186,15 @@ 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);
+ final RadioButton quadnineRadioButton =
+ view.findViewById(R.id.private_dns_mode_quadnine);
+ quadnineRadioButton.setText(R.string.private_dns_mode_quadnine);
+ final RadioButton cloudflareRadioButton =
+ view.findViewById(R.id.private_dns_mode_cloudflare);
+ cloudflareRadioButton.setText(R.string.private_dns_mode_cloudflare);
+ final RadioButton adguardRadioButton =
+ view.findViewById(R.id.private_dns_mode_adguard);
+ adguardRadioButton.setText(R.string.private_dns_mode_adguard);
final RadioButton opportunisticRadioButton =
view.findViewById(R.id.private_dns_mode_opportunistic);
opportunisticRadioButton.setText(R.string.private_dns_mode_opportunistic);
@@ -221,6 +236,12 @@ 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_quadnine) {
+ mMode = PRIVATE_DNS_MODE_QUADNINE;
+ } else if (checkedId == R.id.private_dns_mode_cloudflare) {
+ mMode = PRIVATE_DNS_MODE_CLOUDFLARE;
+ } else if (checkedId == R.id.private_dns_mode_adguard) {
+ mMode = PRIVATE_DNS_MODE_ADGUARD;
} 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 84cae88f85..e0d416e412 100644
--- a/src/com/android/settings/network/PrivateDnsPreferenceController.java
+++ b/src/com/android/settings/network/PrivateDnsPreferenceController.java
@@ -17,6 +17,9 @@
package com.android.settings.network;
import static android.net.ConnectivityManager.PRIVATE_DNS_MODE_OFF;
+import static android.net.ConnectivityManager.PRIVATE_DNS_MODE_QUADNINE;
+import static android.net.ConnectivityManager.PRIVATE_DNS_MODE_CLOUDFLARE;
+import static android.net.ConnectivityManager.PRIVATE_DNS_MODE_ADGUARD;
import static android.net.ConnectivityManager.PRIVATE_DNS_MODE_OPPORTUNISTIC;
import static android.net.ConnectivityManager.PRIVATE_DNS_MODE_PROVIDER_HOSTNAME;
import static android.provider.Settings.Global.PRIVATE_DNS_DEFAULT_MODE;
@@ -125,6 +128,18 @@ public class PrivateDnsPreferenceController extends BasePreferenceController
switch (mode) {
case PRIVATE_DNS_MODE_OFF:
return res.getString(R.string.private_dns_mode_off);
+ case PRIVATE_DNS_MODE_QUADNINE:
+ return dnsesResolved
+ ? res.getString(R.string.private_dns_mode_quadnine)
+ : res.getString(R.string.private_dns_mode_provider_failure);
+ case PRIVATE_DNS_MODE_CLOUDFLARE:
+ return dnsesResolved
+ ? res.getString(R.string.private_dns_mode_cloudflare)
+ : res.getString(R.string.private_dns_mode_provider_failure);
+ case PRIVATE_DNS_MODE_ADGUARD:
+ return dnsesResolved
+ ? res.getString(R.string.private_dns_mode_adguard)
+ : res.getString(R.string.private_dns_mode_provider_failure);
case PRIVATE_DNS_MODE_OPPORTUNISTIC:
return dnsesResolved ? res.getString(R.string.private_dns_mode_on)
: res.getString(R.string.private_dns_mode_opportunistic);
--
2.31.1

View File

@ -595,11 +595,6 @@ changeDefaultDNS() {
dnsPrimaryV6="2606:4700:4700::1002"; dnsPrimaryV6="2606:4700:4700::1002";
dnsSecondary="1.1.1.2"; dnsSecondary="1.1.1.2";
dnsSecondaryV6="2606:4700:4700::1112"; dnsSecondaryV6="2606:4700:4700::1112";
elif [[ "$DOS_DEFAULT_DNS_PRESET" == "OpenNIC" ]]; then #https://servers.opennicproject.org/edit.php?srv=ns3.any.dns.opennic.glue
dnsPrimary="169.239.202.202"; #FIXME
dnsPrimaryV6="2a05:dfc7:5353::53";
dnsSecondary="185.121.177.177";
dnsSecondaryV6="2a05:dfc7:5::53";
elif [[ "$DOS_DEFAULT_DNS_PRESET" == "DNSWATCH" ]]; then #https://dns.watch elif [[ "$DOS_DEFAULT_DNS_PRESET" == "DNSWATCH" ]]; then #https://dns.watch
dnsPrimary="84.200.69.80"; dnsPrimary="84.200.69.80";
dnsPrimaryV6="2001:1608:10:25::1c04:b12f"; dnsPrimaryV6="2001:1608:10:25::1c04:b12f";
@ -620,11 +615,6 @@ changeDefaultDNS() {
dnsPrimaryV6="2610:a1:1018::5"; dnsPrimaryV6="2610:a1:1018::5";
dnsSecondary="156.154.71.5"; dnsSecondary="156.154.71.5";
dnsSecondaryV6="2610:a1:1019::5"; dnsSecondaryV6="2610:a1:1019::5";
elif [[ "$DOS_DEFAULT_DNS_PRESET" == "NixNet" ]]; then #https://docs.nixnet.services/DNS
dnsPrimary="198.251.90.114";
dnsPrimaryV6="2605:6400:20:e6d::1";
dnsSecondary="198.251.90.114";
dnsSecondaryV6="2605:6400:30:f881::1";
elif [[ "$DOS_DEFAULT_DNS_PRESET" == "OpenDNS" ]]; then #https://www.cisco.com/c/en/us/about/legal/privacy-full.html elif [[ "$DOS_DEFAULT_DNS_PRESET" == "OpenDNS" ]]; then #https://www.cisco.com/c/en/us/about/legal/privacy-full.html
dnsPrimary="208.67.222.222"; dnsPrimary="208.67.222.222";
dnsPrimaryV6="2620:0:ccc::2"; dnsPrimaryV6="2620:0:ccc::2";
@ -665,6 +655,7 @@ changeDefaultDNS() {
echo "You must first set a preset via the DOS_DEFAULT_DNS_PRESET variable in init.sh!"; echo "You must first set a preset via the DOS_DEFAULT_DNS_PRESET variable in init.sh!";
fi; fi;
#TODO: bionic/libc/dns/net/getaddrinfo.c
local files="core/res/res/values/config.xml packages/SettingsLib/res/values/strings.xml services/core/java/com/android/server/connectivity/NetworkDiagnostics.java services/core/java/com/android/server/connectivity/Tethering.java services/core/java/com/android/server/connectivity/tethering/TetheringConfiguration.java services/java/com/android/server/connectivity/Tethering.java packages/Tethering/src/com/android/networkstack/tethering/TetheringConfiguration.java core/java/android/net/util/DnsUtils.java"; local files="core/res/res/values/config.xml packages/SettingsLib/res/values/strings.xml services/core/java/com/android/server/connectivity/NetworkDiagnostics.java services/core/java/com/android/server/connectivity/Tethering.java services/core/java/com/android/server/connectivity/tethering/TetheringConfiguration.java services/java/com/android/server/connectivity/Tethering.java packages/Tethering/src/com/android/networkstack/tethering/TetheringConfiguration.java core/java/android/net/util/DnsUtils.java";
sed -i "s/8\.8\.8\.8/$dnsPrimary/" $files &>/dev/null || true; sed -i "s/8\.8\.8\.8/$dnsPrimary/" $files &>/dev/null || true;
sed -i "s/2001:4860:4860::8888/$dnsPrimaryV6/" $files &>/dev/null || true; sed -i "s/2001:4860:4860::8888/$dnsPrimaryV6/" $files &>/dev/null || true;

View File

@ -113,6 +113,7 @@ if [ "$DOS_GRAPHENE_EXEC" = true ]; then applyPatch "$DOS_PATCHES/android_framew
applyPatch "$DOS_PATCHES_COMMON/android_frameworks_base/0003-SUPL_No_IMSI.patch"; #Don't send IMSI to SUPL (MSe1969) applyPatch "$DOS_PATCHES_COMMON/android_frameworks_base/0003-SUPL_No_IMSI.patch"; #Don't send IMSI to SUPL (MSe1969)
applyPatch "$DOS_PATCHES_COMMON/android_frameworks_base/0004-Fingerprint_Lockout.patch"; #Enable fingerprint lockout after three failed attempts (GrapheneOS) applyPatch "$DOS_PATCHES_COMMON/android_frameworks_base/0004-Fingerprint_Lockout.patch"; #Enable fingerprint lockout after three failed attempts (GrapheneOS)
applyPatch "$DOS_PATCHES/android_frameworks_base/0011-Sensors.patch"; #Permission for sensors access (MSe1969) applyPatch "$DOS_PATCHES/android_frameworks_base/0011-Sensors.patch"; #Permission for sensors access (MSe1969)
applyPatch "$DOS_PATCHES/android_frameworks_base/0012-Private_DNS.patch"; #More 'Private DNS' options (CalyxOS)
if [ "$DOS_MICROG_INCLUDED" = "FULL" ]; then applyPatch "$DOS_PATCHES/android_frameworks_base/0002-Signature_Spoofing.patch"; fi; #Allow packages to spoof their signature (microG) if [ "$DOS_MICROG_INCLUDED" = "FULL" ]; then applyPatch "$DOS_PATCHES/android_frameworks_base/0002-Signature_Spoofing.patch"; fi; #Allow packages to spoof their signature (microG)
if [ "$DOS_MICROG_INCLUDED" = "FULL" ]; then applyPatch "$DOS_PATCHES/android_frameworks_base/0003-Harden_Sig_Spoofing.patch"; fi; #Restrict signature spoofing to system apps signed with the platform key if [ "$DOS_MICROG_INCLUDED" = "FULL" ]; then applyPatch "$DOS_PATCHES/android_frameworks_base/0003-Harden_Sig_Spoofing.patch"; fi; #Restrict signature spoofing to system apps signed with the platform key
sed -i 's/DEFAULT_MAX_FILES = 1000;/DEFAULT_MAX_FILES = 0;/' services/core/java/com/android/server/DropBoxManagerService.java; #Disable DropBox internal logging service sed -i 's/DEFAULT_MAX_FILES = 1000;/DEFAULT_MAX_FILES = 0;/' services/core/java/com/android/server/DropBoxManagerService.java; #Disable DropBox internal logging service
@ -206,6 +207,7 @@ git revert --no-edit c240992b4c86c7f226290807a2f41f2619e7e5e8; #Don't hide OEM u
applyPatch "$DOS_PATCHES/android_packages_apps_Settings/0001-Captive_Portal_Toggle.patch"; #Add option to disable captive portal checks (MSe1969) applyPatch "$DOS_PATCHES/android_packages_apps_Settings/0001-Captive_Portal_Toggle.patch"; #Add option to disable captive portal checks (MSe1969)
applyPatch "$DOS_PATCHES/android_packages_apps_Settings/0002-Sensors-P1.patch"; #Permission for sensors access (MSe1969) applyPatch "$DOS_PATCHES/android_packages_apps_Settings/0002-Sensors-P1.patch"; #Permission for sensors access (MSe1969)
applyPatch "$DOS_PATCHES/android_packages_apps_Settings/0002-Sensors-P2.patch"; applyPatch "$DOS_PATCHES/android_packages_apps_Settings/0002-Sensors-P2.patch";
applyPatch "$DOS_PATCHES/android_packages_apps_Settings/0004-Private_DNS.patch"; #More 'Private DNS' options (CalyxOS)
sed -i 's/private int mPasswordMaxLength = 16;/private int mPasswordMaxLength = 48;/' src/com/android/settings/password/ChooseLockPassword.java; #Increase max password length (GrapheneOS) sed -i 's/private int mPasswordMaxLength = 16;/private int mPasswordMaxLength = 48;/' src/com/android/settings/password/ChooseLockPassword.java; #Increase max password length (GrapheneOS)
sed -i 's/if (isFullDiskEncrypted()) {/if (false) {/' src/com/android/settings/accessibility/*AccessibilityService*.java; #Never disable secure start-up when enabling an accessibility service sed -i 's/if (isFullDiskEncrypted()) {/if (false) {/' src/com/android/settings/accessibility/*AccessibilityService*.java; #Never disable secure start-up when enabling an accessibility service
if [ "$DOS_MICROG_INCLUDED" = "FULL" ]; then sed -i 's/GSETTINGS_PROVIDER = "com.google.settings";/GSETTINGS_PROVIDER = "com.google.oQuae4av";/' src/com/android/settings/PrivacySettings.java; fi; #microG doesn't support Backup, hide the options if [ "$DOS_MICROG_INCLUDED" = "FULL" ]; then sed -i 's/GSETTINGS_PROVIDER = "com.google.settings";/GSETTINGS_PROVIDER = "com.google.oQuae4av";/' src/com/android/settings/PrivacySettings.java; fi; #microG doesn't support Backup, hide the options

View File

@ -110,6 +110,7 @@ applyPatch "$DOS_PATCHES/android_frameworks_base/0003-SUPL_No_IMSI.patch"; #Don'
applyPatch "$DOS_PATCHES/android_frameworks_base/0004-Fingerprint_Lockout.patch"; #Enable fingerprint lockout after three failed attempts (GrapheneOS) applyPatch "$DOS_PATCHES/android_frameworks_base/0004-Fingerprint_Lockout.patch"; #Enable fingerprint lockout after three failed attempts (GrapheneOS)
applyPatch "$DOS_PATCHES/android_frameworks_base/0011-Sensors.patch"; #Permission for sensors access (MSe1969) applyPatch "$DOS_PATCHES/android_frameworks_base/0011-Sensors.patch"; #Permission for sensors access (MSe1969)
applyPatch "$DOS_PATCHES/android_frameworks_base/0012-Restore_SensorsOff.patch"; #Restore the Sensors Off tile applyPatch "$DOS_PATCHES/android_frameworks_base/0012-Restore_SensorsOff.patch"; #Restore the Sensors Off tile
applyPatch "$DOS_PATCHES/android_frameworks_base/0013-Private_DNS.patch"; #More 'Private DNS' options (CalyxOS)
if [ "$DOS_MICROG_INCLUDED" = "FULL" ]; then applyPatch "$DOS_PATCHES/android_frameworks_base/0002-Signature_Spoofing.patch"; fi; #Allow packages to spoof their signature (microG) if [ "$DOS_MICROG_INCLUDED" = "FULL" ]; then applyPatch "$DOS_PATCHES/android_frameworks_base/0002-Signature_Spoofing.patch"; fi; #Allow packages to spoof their signature (microG)
if [ "$DOS_MICROG_INCLUDED" = "FULL" ]; then applyPatch "$DOS_PATCHES/android_frameworks_base/0003-Harden_Sig_Spoofing.patch"; fi; #Restrict signature spoofing to system apps signed with the platform key if [ "$DOS_MICROG_INCLUDED" = "FULL" ]; then applyPatch "$DOS_PATCHES/android_frameworks_base/0003-Harden_Sig_Spoofing.patch"; fi; #Restrict signature spoofing to system apps signed with the platform key
sed -i 's/DEFAULT_MAX_FILES = 1000;/DEFAULT_MAX_FILES = 0;/' services/core/java/com/android/server/DropBoxManagerService.java; #Disable DropBox internal logging service sed -i 's/DEFAULT_MAX_FILES = 1000;/DEFAULT_MAX_FILES = 0;/' services/core/java/com/android/server/DropBoxManagerService.java; #Disable DropBox internal logging service
@ -206,6 +207,7 @@ git revert --no-edit 486980cfecce2ca64267f41462f9371486308e9d; #Don't hide OEM u
applyPatch "$DOS_PATCHES/android_packages_apps_Settings/0001-Captive_Portal_Toggle.patch"; #Add option to disable captive portal checks (MSe1969) applyPatch "$DOS_PATCHES/android_packages_apps_Settings/0001-Captive_Portal_Toggle.patch"; #Add option to disable captive portal checks (MSe1969)
applyPatch "$DOS_PATCHES/android_packages_apps_Settings/0002-Sensors.patch"; #Permission for sensors access (MSe1969) applyPatch "$DOS_PATCHES/android_packages_apps_Settings/0002-Sensors.patch"; #Permission for sensors access (MSe1969)
applyPatch "$DOS_PATCHES/android_packages_apps_Settings/0003-Remove_SensorsOff_Tile.patch"; #Remove the Sensors Off development tile applyPatch "$DOS_PATCHES/android_packages_apps_Settings/0003-Remove_SensorsOff_Tile.patch"; #Remove the Sensors Off development tile
applyPatch "$DOS_PATCHES/android_packages_apps_Settings/0004-Private_DNS.patch"; #More 'Private DNS' options (CalyxOS)
sed -i 's/private int mPasswordMaxLength = 16;/private int mPasswordMaxLength = 48;/' src/com/android/settings/password/ChooseLockPassword.java; #Increase max password length (GrapheneOS) sed -i 's/private int mPasswordMaxLength = 16;/private int mPasswordMaxLength = 48;/' src/com/android/settings/password/ChooseLockPassword.java; #Increase max password length (GrapheneOS)
sed -i 's/if (isFullDiskEncrypted()) {/if (false) {/' src/com/android/settings/accessibility/*AccessibilityService*.java; #Never disable secure start-up when enabling an accessibility service sed -i 's/if (isFullDiskEncrypted()) {/if (false) {/' src/com/android/settings/accessibility/*AccessibilityService*.java; #Never disable secure start-up when enabling an accessibility service
if [ "$DOS_MICROG_INCLUDED" = "FULL" ]; then sed -i 's/GSETTINGS_PROVIDER = "com.google.settings";/GSETTINGS_PROVIDER = "com.google.oQuae4av";/' src/com/android/settings/backup/PrivacySettingsUtils.java; fi; #microG doesn't support Backup, hide the options if [ "$DOS_MICROG_INCLUDED" = "FULL" ]; then sed -i 's/GSETTINGS_PROVIDER = "com.google.settings";/GSETTINGS_PROVIDER = "com.google.oQuae4av";/' src/com/android/settings/backup/PrivacySettingsUtils.java; fi; #microG doesn't support Backup, hide the options

View File

@ -92,6 +92,7 @@ applyPatch "$DOS_PATCHES/android_frameworks_base/0003-SUPL_No_IMSI.patch"; #Don'
applyPatch "$DOS_PATCHES/android_frameworks_base/0004-Fingerprint_Lockout.patch"; #Enable fingerprint lockout after three failed attempts (GrapheneOS) applyPatch "$DOS_PATCHES/android_frameworks_base/0004-Fingerprint_Lockout.patch"; #Enable fingerprint lockout after three failed attempts (GrapheneOS)
applyPatch "$DOS_PATCHES/android_frameworks_base/0010-Sensors.patch"; #Permission for sensors access (MSe1969) applyPatch "$DOS_PATCHES/android_frameworks_base/0010-Sensors.patch"; #Permission for sensors access (MSe1969)
applyPatch "$DOS_PATCHES/android_frameworks_base/0011-Restore_SensorsOff.patch"; #Restore the Sensors Off tile applyPatch "$DOS_PATCHES/android_frameworks_base/0011-Restore_SensorsOff.patch"; #Restore the Sensors Off tile
applyPatch "$DOS_PATCHES/android_frameworks_base/0012-Private_DNS.patch"; #More 'Private DNS' options (CalyxOS)
if [ "$DOS_MICROG_INCLUDED" = "FULL" ]; then applyPatch "$DOS_PATCHES/android_frameworks_base/0002-Signature_Spoofing.patch"; fi; #Allow packages to spoof their signature (microG) if [ "$DOS_MICROG_INCLUDED" = "FULL" ]; then applyPatch "$DOS_PATCHES/android_frameworks_base/0002-Signature_Spoofing.patch"; fi; #Allow packages to spoof their signature (microG)
if [ "$DOS_MICROG_INCLUDED" = "FULL" ]; then applyPatch "$DOS_PATCHES/android_frameworks_base/0003-Harden_Sig_Spoofing.patch"; fi; #Restrict signature spoofing to system apps signed with the platform key if [ "$DOS_MICROG_INCLUDED" = "FULL" ]; then applyPatch "$DOS_PATCHES/android_frameworks_base/0003-Harden_Sig_Spoofing.patch"; fi; #Restrict signature spoofing to system apps signed with the platform key
hardenLocationConf services/core/java/com/android/server/location/gps_debug.conf; #Harden the default GPS config hardenLocationConf services/core/java/com/android/server/location/gps_debug.conf; #Harden the default GPS config
@ -193,6 +194,7 @@ 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) applyPatch "$DOS_PATCHES/android_packages_apps_Settings/0001-Captive_Portal_Toggle.patch"; #Add option to disable captive portal checks (MSe1969)
applyPatch "$DOS_PATCHES/android_packages_apps_Settings/0002-Sensors.patch"; #Permission for sensors access (MSe1969) applyPatch "$DOS_PATCHES/android_packages_apps_Settings/0002-Sensors.patch"; #Permission for sensors access (MSe1969)
applyPatch "$DOS_PATCHES/android_packages_apps_Settings/0003-Remove_SensorsOff_Tile.patch"; #Remove the Sensors Off development tile applyPatch "$DOS_PATCHES/android_packages_apps_Settings/0003-Remove_SensorsOff_Tile.patch"; #Remove the Sensors Off development tile
applyPatch "$DOS_PATCHES/android_packages_apps_Settings/0004-Private_DNS.patch"; #More 'Private DNS' options (CalyxOS)
sed -i 's/if (isFullDiskEncrypted()) {/if (false) {/' src/com/android/settings/accessibility/*AccessibilityService*.java; #Never disable secure start-up when enabling an accessibility service sed -i 's/if (isFullDiskEncrypted()) {/if (false) {/' src/com/android/settings/accessibility/*AccessibilityService*.java; #Never disable secure start-up when enabling an accessibility service
if [ "$DOS_MICROG_INCLUDED" = "FULL" ]; then sed -i 's/GSETTINGS_PROVIDER = "com.google.settings";/GSETTINGS_PROVIDER = "com.google.oQuae4av";/' src/com/android/settings/backup/PrivacySettingsUtils.java; fi; #microG doesn't support Backup, hide the options if [ "$DOS_MICROG_INCLUDED" = "FULL" ]; then sed -i 's/GSETTINGS_PROVIDER = "com.google.settings";/GSETTINGS_PROVIDER = "com.google.oQuae4av";/' src/com/android/settings/backup/PrivacySettingsUtils.java; fi; #microG doesn't support Backup, hide the options
fi; fi;