mirror of
https://github.com/Divested-Mobile/DivestOS-Build.git
synced 2024-12-14 02:14:34 -05:00
58923f2ef9
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 ac19ea8d..32e3b608 100644
|
|
--- a/packages/LineageSettingsProvider/src/org/lineageos/lineagesettings/LineageDatabaseHelper.java
|
|
+++ b/packages/LineageSettingsProvider/src/org/lineageos/lineagesettings/LineageDatabaseHelper.java
|
|
@@ -109,6 +109,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, "base.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);
|
|
+ }
|
|
+ }
|
|
}
|
|
|
|
/**
|