mirror of
https://github.com/Divested-Mobile/DivestOS-Build.git
synced 2024-10-01 01:35:54 -04:00
d98f33a337
TODO: - f/w/b - settings Signed-off-by: Tavi <tavi@divested.dev>
86 lines
5.8 KiB
Diff
86 lines
5.8 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Tad <tad@spotco.us>
|
|
Date: Wed, 31 May 2023 12:38:29 -0400
|
|
Subject: [PATCH] Migrate Private DNS preset modes to hostname-mode based
|
|
|
|
Credit: CalyxOS
|
|
- Tommy Webb <tommy@calyxinstitute.org>
|
|
https://review.calyxos.org/c/CalyxOS/platform_calyx-sdk/+/17311
|
|
|
|
Change-Id: Ie3990a6e789be22da0c7771d85ad71034ed334eb
|
|
---
|
|
.../LineageDatabaseHelper.java | 60 +++++++++++++++++++
|
|
1 file changed, 60 insertions(+)
|
|
|
|
diff --git a/packages/LineageSettingsProvider/src/org/lineageos/lineagesettings/LineageDatabaseHelper.java b/packages/LineageSettingsProvider/src/org/lineageos/lineagesettings/LineageDatabaseHelper.java
|
|
index 2a77cec7..83322355 100644
|
|
--- a/packages/LineageSettingsProvider/src/org/lineageos/lineagesettings/LineageDatabaseHelper.java
|
|
+++ b/packages/LineageSettingsProvider/src/org/lineageos/lineagesettings/LineageDatabaseHelper.java
|
|
@@ -120,6 +120,66 @@ public class LineageDatabaseHelper extends SQLiteOpenHelper{
|
|
} catch (PackageManager.NameNotFoundException e) {
|
|
e.printStackTrace();
|
|
}
|
|
+
|
|
+ // DNS migration XXX: shouldn't be here
|
|
+ final String currentPrivateDnsMode = Settings.Global.getString(
|
|
+ mContext.getContentResolver(), Settings.Global.PRIVATE_DNS_MODE);
|
|
+ if (!"off".equals(currentPrivateDnsMode) && !"hostname".equals(currentPrivateDnsMode) && !"opportunistic".equals(currentPrivateDnsMode)) {
|
|
+ Log.d(TAG, "Performing migration for private dns presets");
|
|
+ if ("adguard".equals(currentPrivateDnsMode)) {
|
|
+ ConnectivitySettingsManager.setPrivateDnsHostname(mContext, "dns.adguard.com");
|
|
+ ConnectivitySettingsManager.setPrivateDnsMode(mContext,
|
|
+ ConnectivitySettingsManager.PRIVATE_DNS_MODE_PROVIDER_HOSTNAME);
|
|
+ } else if ("appliedprivacy".equals(currentPrivateDnsMode)) {
|
|
+ ConnectivitySettingsManager.setPrivateDnsHostname(mContext, "dot1.applied-privacy.net");
|
|
+ ConnectivitySettingsManager.setPrivateDnsMode(mContext,
|
|
+ ConnectivitySettingsManager.PRIVATE_DNS_MODE_PROVIDER_HOSTNAME);
|
|
+ } else if ("cira".equals(currentPrivateDnsMode)) {
|
|
+ ConnectivitySettingsManager.setPrivateDnsHostname(mContext, "protected.canadianshield.cira.ca");
|
|
+ ConnectivitySettingsManager.setPrivateDnsMode(mContext,
|
|
+ ConnectivitySettingsManager.PRIVATE_DNS_MODE_PROVIDER_HOSTNAME);
|
|
+ } else if ("cleanbrowsing".equals(currentPrivateDnsMode)) {
|
|
+ ConnectivitySettingsManager.setPrivateDnsHostname(mContext, "security-filter-dns.cleanbrowsing.org");
|
|
+ ConnectivitySettingsManager.setPrivateDnsMode(mContext,
|
|
+ ConnectivitySettingsManager.PRIVATE_DNS_MODE_PROVIDER_HOSTNAME);
|
|
+ } else if ("cloudflare".equals(currentPrivateDnsMode)) {
|
|
+ ConnectivitySettingsManager.setPrivateDnsHostname(mContext, "security.cloudflare-dns.com");
|
|
+ ConnectivitySettingsManager.setPrivateDnsMode(mContext,
|
|
+ ConnectivitySettingsManager.PRIVATE_DNS_MODE_PROVIDER_HOSTNAME);
|
|
+ } else if ("cznic".equals(currentPrivateDnsMode)) {
|
|
+ ConnectivitySettingsManager.setPrivateDnsHostname(mContext, "odvr.nic.cz");
|
|
+ ConnectivitySettingsManager.setPrivateDnsMode(mContext,
|
|
+ ConnectivitySettingsManager.PRIVATE_DNS_MODE_PROVIDER_HOSTNAME);
|
|
+ }else if ("google".equals(currentPrivateDnsMode)) {
|
|
+ ConnectivitySettingsManager.setPrivateDnsHostname(mContext, "dns.google");
|
|
+ ConnectivitySettingsManager.setPrivateDnsMode(mContext,
|
|
+ ConnectivitySettingsManager.PRIVATE_DNS_MODE_PROVIDER_HOSTNAME);
|
|
+ } else if ("mullvad".equals(currentPrivateDnsMode)) {
|
|
+ ConnectivitySettingsManager.setPrivateDnsHostname(mContext, "adblock.dns.mullvad.net");
|
|
+ ConnectivitySettingsManager.setPrivateDnsMode(mContext,
|
|
+ ConnectivitySettingsManager.PRIVATE_DNS_MODE_PROVIDER_HOSTNAME);
|
|
+ } else if ("quadnine".equals(currentPrivateDnsMode)) {
|
|
+ ConnectivitySettingsManager.setPrivateDnsHostname(mContext, "dns.quad9.net");
|
|
+ ConnectivitySettingsManager.setPrivateDnsMode(mContext,
|
|
+ ConnectivitySettingsManager.PRIVATE_DNS_MODE_PROVIDER_HOSTNAME);
|
|
+ } else if ("restena".equals(currentPrivateDnsMode)) {
|
|
+ ConnectivitySettingsManager.setPrivateDnsHostname(mContext, "kaitain.restena.lu");
|
|
+ ConnectivitySettingsManager.setPrivateDnsMode(mContext,
|
|
+ ConnectivitySettingsManager.PRIVATE_DNS_MODE_PROVIDER_HOSTNAME);
|
|
+ } else if ("switch".equals(currentPrivateDnsMode)) {
|
|
+ ConnectivitySettingsManager.setPrivateDnsHostname(mContext, "dns.switch.ch");
|
|
+ ConnectivitySettingsManager.setPrivateDnsMode(mContext,
|
|
+ ConnectivitySettingsManager.PRIVATE_DNS_MODE_PROVIDER_HOSTNAME);
|
|
+ } else if ("twnic".equals(currentPrivateDnsMode)) {
|
|
+ ConnectivitySettingsManager.setPrivateDnsHostname(mContext, "101.101.101.101");
|
|
+ ConnectivitySettingsManager.setPrivateDnsMode(mContext,
|
|
+ ConnectivitySettingsManager.PRIVATE_DNS_MODE_PROVIDER_HOSTNAME);
|
|
+ } else if ("uncensoreddns".equals(currentPrivateDnsMode)) {
|
|
+ ConnectivitySettingsManager.setPrivateDnsHostname(mContext, "anycast.censurfridns.dk");
|
|
+ ConnectivitySettingsManager.setPrivateDnsMode(mContext,
|
|
+ ConnectivitySettingsManager.PRIVATE_DNS_MODE_PROVIDER_HOSTNAME);
|
|
+ }
|
|
+ }
|
|
}
|
|
|
|
/**
|