Add even more captive portal servers + sorting

TODO: apply to other branches

Signed-off-by: Tad <tad@spotco.us>
This commit is contained in:
Tad 2023-01-22 18:45:37 -05:00
parent 2529515b33
commit e81cd5586d
No known key found for this signature in database
GPG Key ID: B286E9F57A07424B
9 changed files with 105 additions and 28 deletions

View File

@ -17,30 +17,33 @@ Signed-off-by: empratyush <codelab@pratyush.dev>
[tad@spotco.us]: add multiple other server options [tad@spotco.us]: add multiple other server options
Change-Id: I8a762d0f29ac42fce3dcfc7189e8ff216a8f8d1a Change-Id: I8a762d0f29ac42fce3dcfc7189e8ff216a8f8d1a
--- ---
res/values/arrays.xml | 24 ++ res/values/arrays.xml | 30 ++
res/values/strings.xml | 3 + res/values/strings.xml | 3 +
...ConnectivityCheckPreferenceController.java | 339 ++++++++++++++++++ ...ConnectivityCheckPreferenceController.java | 410 ++++++++++++++++++
.../network/NetworkDashboardFragment.java | 3 + .../network/NetworkDashboardFragment.java | 3 +
4 files changed, 369 insertions(+) 4 files changed, 446 insertions(+)
create mode 100644 src/com/android/settings/network/ConnectivityCheckPreferenceController.java create mode 100644 src/com/android/settings/network/ConnectivityCheckPreferenceController.java
diff --git a/res/values/arrays.xml b/res/values/arrays.xml diff --git a/res/values/arrays.xml b/res/values/arrays.xml
index cfc7671652..ed2b2a6b16 100644 index cfc7671652..43affddf47 100644
--- a/res/values/arrays.xml --- a/res/values/arrays.xml
+++ b/res/values/arrays.xml +++ b/res/values/arrays.xml
@@ -210,6 +210,30 @@ @@ -210,6 +210,36 @@
<item>@string/dark_ui_auto_mode_custom_bedtime</item> <item>@string/dark_ui_auto_mode_custom_bedtime</item>
</string-array> </string-array>
+ <string-array name="connectivity_check_entries"> + <string-array name="connectivity_check_entries">
+ <item>Disabled</item> + <item>Disabled</item>
+ <item>Google (US) [default]</item> + <item>Amazon Fire OS (US)</item>
+ <item>Cloudflare (US)</item>
+ <item>DivestOS (US)</item> + <item>DivestOS (US)</item>
+ <item>Google (US) [default]</item>
+ <item>Huawei (CN)</item>
+ <item>Kuketz (DE)</item>
+ <item>Microsoft Edge (US)</item>
+ <item>openSUSE (DE)</item> + <item>openSUSE (DE)</item>
+ <item>Ubuntu (UK)</item> + <item>Ubuntu (UK)</item>
+ <item>Amazon Fire OS (US)</item> + <item>Xiaomi (CN)</item>
+ <item>Microsoft Edge (US)</item>
+ <item>Kuketz (DE)</item>
+ <!--<item>GrapheneOS (CA)</item>--> + <!--<item>GrapheneOS (CA)</item>-->
+ </string-array> + </string-array>
+ +
@ -53,7 +56,10 @@ index cfc7671652..ed2b2a6b16 100644
+ <item>5</item> + <item>5</item>
+ <item>6</item> + <item>6</item>
+ <item>7</item> + <item>7</item>
+ <!--<item>8</item>--> + <item>8</item>
+ <item>9</item>
+ <item>10</item>
+ <!--<item>11</item>-->
+ </string-array> + </string-array>
+ +
<!-- Security settings. The delay after screen is turned off until device locks. <!-- Security settings. The delay after screen is turned off until device locks.
@ -73,10 +79,10 @@ index fa753aaa8e..858d5a6588 100644
</resources> </resources>
diff --git a/src/com/android/settings/network/ConnectivityCheckPreferenceController.java b/src/com/android/settings/network/ConnectivityCheckPreferenceController.java diff --git a/src/com/android/settings/network/ConnectivityCheckPreferenceController.java b/src/com/android/settings/network/ConnectivityCheckPreferenceController.java
new file mode 100644 new file mode 100644
index 0000000000..6723f27cbe index 0000000000..72d61defc3
--- /dev/null --- /dev/null
+++ b/src/com/android/settings/network/ConnectivityCheckPreferenceController.java +++ b/src/com/android/settings/network/ConnectivityCheckPreferenceController.java
@@ -0,0 +1,339 @@ @@ -0,0 +1,410 @@
+/* +/*
+ * Copyright (C) 2020 The Android Open Source Project + * Copyright (C) 2020 The Android Open Source Project
+ * + *
@ -176,15 +182,37 @@ index 0000000000..6723f27cbe
+ private static final String KUKETZ_HTTP_URL = + private static final String KUKETZ_HTTP_URL =
+ "http://captiveportal.kuketz.de"; + "http://captiveportal.kuketz.de";
+ +
+ // Cloudflare
+ private static final String CLOUDFLARE_HTTPS_URL =
+ "https://cp.cloudflare.com";
+ private static final String CLOUDFLARE_HTTP_URL =
+ "http://cp.cloudflare.com";
+
+ // Huawei
+ private static final String HUAWEI_HTTPS_URL =
+ "https://connectivitycheck.platform.hicloud.com/generate_204";
+ private static final String HUAWEI_HTTP_URL =
+ "http://connectivitycheck.platform.hicloud.com/generate_204";
+
+ // Xiaomi
+ private static final String XIAOMI_HTTPS_URL =
+ "https://connect.rom.miui.com/generate_204";
+ private static final String XIAOMI_HTTP_URL =
+ "http://connect.rom.miui.com/generate_204";
+
+ // Keep this in sync! Commented options must be very last!
+ private static final int DISABLED_CAPTIVE_PORTAL_INTVAL = 0; + private static final int DISABLED_CAPTIVE_PORTAL_INTVAL = 0;
+ private static final int STANDARD_CAPTIVE_PORTAL_HTTP_URL_INTVAL = 1; + private static final int AMAZON_CAPTIVE_PORTAL_HTTP_URL_INTVAL = 1;
+ private static final int DIVESTOS_CAPTIVE_PORTAL_HTTP_URL_INTVAL = 2; + private static final int CLOUDFLARE_CAPTIVE_PORTAL_HTTP_URL_INTVAL = 2;
+ private static final int OPENSUSE_CAPTIVE_PORTAL_HTTP_URL_INTVAL = 3; + private static final int DIVESTOS_CAPTIVE_PORTAL_HTTP_URL_INTVAL = 3;
+ private static final int UBUNTU_CAPTIVE_PORTAL_HTTP_URL_INTVAL = 4; + private static final int STANDARD_CAPTIVE_PORTAL_HTTP_URL_INTVAL = 4;
+ private static final int AMAZON_CAPTIVE_PORTAL_HTTP_URL_INTVAL = 5; + private static final int HUAWEI_CAPTIVE_PORTAL_HTTP_URL_INTVAL = 5;
+ private static final int MICROSOFT_CAPTIVE_PORTAL_HTTP_URL_INTVAL = 6; + private static final int KUKETZ_CAPTIVE_PORTAL_HTTP_URL_INTVAL = 6;
+ private static final int KUKETZ_CAPTIVE_PORTAL_HTTP_URL_INTVAL = 7; + private static final int MICROSOFT_CAPTIVE_PORTAL_HTTP_URL_INTVAL = 7;
+ private static final int GRAPHENEOS_CAPTIVE_PORTAL_HTTP_URL_INTVAL = 8; + private static final int OPENSUSE_CAPTIVE_PORTAL_HTTP_URL_INTVAL = 8;
+ private static final int UBUNTU_CAPTIVE_PORTAL_HTTP_URL_INTVAL = 9;
+ private static final int XIAOMI_CAPTIVE_PORTAL_HTTP_URL_INTVAL = 10;
+ private static final int GRAPHENEOS_CAPTIVE_PORTAL_HTTP_URL_INTVAL = 11;
+ +
+ private static final String KEY_CONNECTIVITY_CHECK_SETTINGS = + private static final String KEY_CONNECTIVITY_CHECK_SETTINGS =
+ "connectivity_check_settings"; + "connectivity_check_settings";
@ -261,7 +289,17 @@ index 0000000000..6723f27cbe
+ } else if (KUKETZ_HTTP_URL.equals(pref)) { + } else if (KUKETZ_HTTP_URL.equals(pref)) {
+ mConnectivityPreference.setValueIndex( + mConnectivityPreference.setValueIndex(
+ KUKETZ_CAPTIVE_PORTAL_HTTP_URL_INTVAL); + KUKETZ_CAPTIVE_PORTAL_HTTP_URL_INTVAL);
+ } else if (CLOUDFLARE_HTTP_URL.equals(pref)) {
+ mConnectivityPreference.setValueIndex(
+ CLOUDFLARE_CAPTIVE_PORTAL_HTTP_URL_INTVAL);
+ } else if (HUAWEI_HTTP_URL.equals(pref)) {
+ mConnectivityPreference.setValueIndex(
+ HUAWEI_CAPTIVE_PORTAL_HTTP_URL_INTVAL);
+ } else if (XIAOMI_HTTP_URL.equals(pref)) {
+ mConnectivityPreference.setValueIndex(
+ XIAOMI_CAPTIVE_PORTAL_HTTP_URL_INTVAL);
+ } + }
+
+ } + }
+ +
+ @Override + @Override
@ -380,6 +418,45 @@ index 0000000000..6723f27cbe
+ Settings.Global.putInt(cr, Settings.Global.CAPTIVE_PORTAL_MODE, + Settings.Global.putInt(cr, Settings.Global.CAPTIVE_PORTAL_MODE,
+ Settings.Global.CAPTIVE_PORTAL_MODE_PROMPT); + Settings.Global.CAPTIVE_PORTAL_MODE_PROMPT);
+ break; + break;
+ case CLOUDFLARE_CAPTIVE_PORTAL_HTTP_URL_INTVAL:
+ Settings.Global.putString(cr, Settings.Global.CAPTIVE_PORTAL_HTTP_URL,
+ CLOUDFLARE_HTTP_URL);
+ Settings.Global.putString(cr, Settings.Global.CAPTIVE_PORTAL_HTTPS_URL,
+ CLOUDFLARE_HTTPS_URL);
+ Settings.Global.putString(cr, Settings.Global.CAPTIVE_PORTAL_FALLBACK_URL,
+ CLOUDFLARE_HTTP_URL);
+ Settings.Global.putString(
+ cr, Settings.Global.CAPTIVE_PORTAL_OTHER_FALLBACK_URLS,
+ CLOUDFLARE_HTTP_URL);
+ Settings.Global.putInt(cr, Settings.Global.CAPTIVE_PORTAL_MODE,
+ Settings.Global.CAPTIVE_PORTAL_MODE_PROMPT);
+ break;
+ case HUAWEI_CAPTIVE_PORTAL_HTTP_URL_INTVAL:
+ Settings.Global.putString(cr, Settings.Global.CAPTIVE_PORTAL_HTTP_URL,
+ HUAWEI_HTTP_URL);
+ Settings.Global.putString(cr, Settings.Global.CAPTIVE_PORTAL_HTTPS_URL,
+ HUAWEI_HTTPS_URL);
+ Settings.Global.putString(cr, Settings.Global.CAPTIVE_PORTAL_FALLBACK_URL,
+ HUAWEI_HTTP_URL);
+ Settings.Global.putString(
+ cr, Settings.Global.CAPTIVE_PORTAL_OTHER_FALLBACK_URLS,
+ HUAWEI_HTTP_URL);
+ Settings.Global.putInt(cr, Settings.Global.CAPTIVE_PORTAL_MODE,
+ Settings.Global.CAPTIVE_PORTAL_MODE_PROMPT);
+ break;
+ case XIAOMI_CAPTIVE_PORTAL_HTTP_URL_INTVAL:
+ Settings.Global.putString(cr, Settings.Global.CAPTIVE_PORTAL_HTTP_URL,
+ XIAOMI_HTTP_URL);
+ Settings.Global.putString(cr, Settings.Global.CAPTIVE_PORTAL_HTTPS_URL,
+ XIAOMI_HTTPS_URL);
+ Settings.Global.putString(cr, Settings.Global.CAPTIVE_PORTAL_FALLBACK_URL,
+ XIAOMI_HTTP_URL);
+ Settings.Global.putString(
+ cr, Settings.Global.CAPTIVE_PORTAL_OTHER_FALLBACK_URLS,
+ XIAOMI_HTTP_URL);
+ Settings.Global.putInt(cr, Settings.Global.CAPTIVE_PORTAL_MODE,
+ Settings.Global.CAPTIVE_PORTAL_MODE_PROMPT);
+ break;
+ default: + default:
+ // Default URLs as placeholder + // Default URLs as placeholder
+ Settings.Global.putString(cr, Settings.Global.CAPTIVE_PORTAL_HTTP_URL, + Settings.Global.putString(cr, Settings.Global.CAPTIVE_PORTAL_HTTP_URL,

View File

@ -138,7 +138,7 @@ declare -a fourDotFour=("${threeDotEighteen[@]}" "android_kernel_essential_msm89
declare -a fourDotNine=("${fourDotFour[@]}" "android_kernel_fairphone_sdm632.sh" "android_kernel_google_msm-4.9.sh" "android_kernel_oneplus_sdm845.sh" "android_kernel_razer_sdm845.sh" "android_kernel_sony_sdm845.sh" "android_kernel_xiaomi_sdm845.sh"); declare -a fourDotNine=("${fourDotFour[@]}" "android_kernel_fairphone_sdm632.sh" "android_kernel_google_msm-4.9.sh" "android_kernel_oneplus_sdm845.sh" "android_kernel_razer_sdm845.sh" "android_kernel_sony_sdm845.sh" "android_kernel_xiaomi_sdm845.sh");
for script in "${fourDotNine[@]}" for script in "${fourDotNine[@]}"
do do
commentPatches $script "CVE-2018-11412/4.14" "CVE-2022-1204/4.14"; #handle 4.14 commentPatches $script "CVE-2018-11412/4.14" "CVE-2020-0067/4.14" "CVE-2022-1204/4.14"; #handle 4.14
done done
echo -e "\e[0;32m[SCRIPT COMPLETE] Fixed CVE patchers\e[0m"; echo -e "\e[0;32m[SCRIPT COMPLETE] Fixed CVE patchers\e[0m";

View File

@ -82,7 +82,7 @@ patchWorkspace() {
source build/envsetup.sh; source build/envsetup.sh;
#repopick -it ten-firewall; #repopick -it ten-firewall;
repopick -it Q_tzdb2022f; repopick -it Q_tzdb2022g;
sh "$DOS_SCRIPTS/Patch.sh"; sh "$DOS_SCRIPTS/Patch.sh";
sh "$DOS_SCRIPTS_COMMON/Enable_Verity.sh"; sh "$DOS_SCRIPTS_COMMON/Enable_Verity.sh";

View File

@ -113,7 +113,7 @@ patchWorkspace() {
#repopick -it eleven-firewall; #repopick -it eleven-firewall;
#repopick -i 314453; #TaskViewTouchController: Null check current animation on drag #repopick -i 314453; #TaskViewTouchController: Null check current animation on drag
#repopick -i 325011; #lineage: Opt-in to shipping full recovery image by default #repopick -i 325011; #lineage: Opt-in to shipping full recovery image by default
repopick -it R_tzdb2022f; repopick -it R_tzdb2022g;
sh "$DOS_SCRIPTS/Patch.sh"; sh "$DOS_SCRIPTS/Patch.sh";
sh "$DOS_SCRIPTS_COMMON/Enable_Verity.sh"; sh "$DOS_SCRIPTS_COMMON/Enable_Verity.sh";

View File

@ -57,7 +57,7 @@ git apply $DOS_PATCHES_LINUX_CVES/CVE-2019-16994/4.9/0004.patch
git apply $DOS_PATCHES_LINUX_CVES/CVE-2019-19051/4.9/0013.patch git apply $DOS_PATCHES_LINUX_CVES/CVE-2019-19051/4.9/0013.patch
git apply $DOS_PATCHES_LINUX_CVES/CVE-2019-19068/4.9/0005.patch git apply $DOS_PATCHES_LINUX_CVES/CVE-2019-19068/4.9/0005.patch
git apply $DOS_PATCHES_LINUX_CVES/CVE-2019-20908/^5.2/0001.patch git apply $DOS_PATCHES_LINUX_CVES/CVE-2019-20908/^5.2/0001.patch
git apply $DOS_PATCHES_LINUX_CVES/CVE-2020-0067/4.14/0002.patch #git apply $DOS_PATCHES_LINUX_CVES/CVE-2020-0067/4.14/0002.patch
git apply $DOS_PATCHES_LINUX_CVES/CVE-2020-3674/ANY/0001.patch git apply $DOS_PATCHES_LINUX_CVES/CVE-2020-3674/ANY/0001.patch
git apply $DOS_PATCHES_LINUX_CVES/CVE-2020-16119/^5.10/0002.patch git apply $DOS_PATCHES_LINUX_CVES/CVE-2020-16119/^5.10/0002.patch
git apply $DOS_PATCHES_LINUX_CVES/CVE-2020-24394/4.14/0002.patch git apply $DOS_PATCHES_LINUX_CVES/CVE-2020-24394/4.14/0002.patch

View File

@ -77,7 +77,7 @@ patchWorkspace() {
source build/envsetup.sh; source build/envsetup.sh;
#repopick -ift twelve-bt-sbc-hd-dualchannel; #repopick -ift twelve-bt-sbc-hd-dualchannel;
#repopick -it twelve-colors; #repopick -it twelve-colors;
repopick -it S_tzdb2022f; repopick -it S_tzdb2022g;
sh "$DOS_SCRIPTS/Patch.sh"; sh "$DOS_SCRIPTS/Patch.sh";
sh "$DOS_SCRIPTS_COMMON/Enable_Verity.sh"; sh "$DOS_SCRIPTS_COMMON/Enable_Verity.sh";

View File

@ -80,7 +80,7 @@ git apply $DOS_PATCHES_LINUX_CVES/CVE-2019-19816/4.9/0007.patch
git apply $DOS_PATCHES_LINUX_CVES/CVE-2019-19947/4.9/0007.patch git apply $DOS_PATCHES_LINUX_CVES/CVE-2019-19947/4.9/0007.patch
git apply $DOS_PATCHES_LINUX_CVES/CVE-2019-20810/4.9/0006.patch git apply $DOS_PATCHES_LINUX_CVES/CVE-2019-20810/4.9/0006.patch
git apply $DOS_PATCHES_LINUX_CVES/CVE-2019-20908/^5.2/0001.patch git apply $DOS_PATCHES_LINUX_CVES/CVE-2019-20908/^5.2/0001.patch
git apply $DOS_PATCHES_LINUX_CVES/CVE-2020-0067/4.14/0002.patch #git apply $DOS_PATCHES_LINUX_CVES/CVE-2020-0067/4.14/0002.patch
git apply $DOS_PATCHES_LINUX_CVES/CVE-2020-0427/4.9/0003.patch git apply $DOS_PATCHES_LINUX_CVES/CVE-2020-0427/4.9/0003.patch
git apply $DOS_PATCHES_LINUX_CVES/CVE-2020-0433/4.9/0007.patch git apply $DOS_PATCHES_LINUX_CVES/CVE-2020-0433/4.9/0007.patch
git apply $DOS_PATCHES_LINUX_CVES/CVE-2020-0465/4.9/0011.patch git apply $DOS_PATCHES_LINUX_CVES/CVE-2020-0465/4.9/0011.patch

View File

@ -53,7 +53,7 @@ git apply $DOS_PATCHES_LINUX_CVES/CVE-2019-16994/4.9/0004.patch
git apply $DOS_PATCHES_LINUX_CVES/CVE-2019-19051/4.9/0013.patch git apply $DOS_PATCHES_LINUX_CVES/CVE-2019-19051/4.9/0013.patch
git apply $DOS_PATCHES_LINUX_CVES/CVE-2019-19068/4.9/0005.patch git apply $DOS_PATCHES_LINUX_CVES/CVE-2019-19068/4.9/0005.patch
git apply $DOS_PATCHES_LINUX_CVES/CVE-2019-20908/^5.2/0001.patch git apply $DOS_PATCHES_LINUX_CVES/CVE-2019-20908/^5.2/0001.patch
git apply $DOS_PATCHES_LINUX_CVES/CVE-2020-0067/4.14/0002.patch #git apply $DOS_PATCHES_LINUX_CVES/CVE-2020-0067/4.14/0002.patch
git apply $DOS_PATCHES_LINUX_CVES/CVE-2020-3674/ANY/0001.patch git apply $DOS_PATCHES_LINUX_CVES/CVE-2020-3674/ANY/0001.patch
git apply $DOS_PATCHES_LINUX_CVES/CVE-2020-16119/^5.10/0002.patch git apply $DOS_PATCHES_LINUX_CVES/CVE-2020-16119/^5.10/0002.patch
git apply $DOS_PATCHES_LINUX_CVES/CVE-2020-24394/4.14/0002.patch git apply $DOS_PATCHES_LINUX_CVES/CVE-2020-24394/4.14/0002.patch

View File

@ -108,7 +108,7 @@ patchWorkspace() {
gpgVerifyGitHead "$DOS_BUILD_BASE/external/chromium-webview"; gpgVerifyGitHead "$DOS_BUILD_BASE/external/chromium-webview";
source build/envsetup.sh; source build/envsetup.sh;
repopick -it T_tzdb2022f; repopick -it T_tzdb2022g;
sh "$DOS_SCRIPTS/Patch.sh"; sh "$DOS_SCRIPTS/Patch.sh";
sh "$DOS_SCRIPTS_COMMON/Enable_Verity.sh"; sh "$DOS_SCRIPTS_COMMON/Enable_Verity.sh";