LeOS-GSI/patches/leos_old/platform_packages_apps_Sett.../0001-AdvancedPrivacy.patch

857 lines
45 KiB
Diff

From 5d86692715535a48160874daa93f2f84487987e3 Mon Sep 17 00:00:00 2001
From: harvey186 <harvey186@hotmail.com>
Date: Fri, 15 Dec 2023 18:10:47 +0100
Subject: [PATCH] AdvancedPrivacy
Change-Id: Ida72ce1fb19f10294a26f43d69e517ed1a75b5a0
---
res/drawable/ic_homepage_advanced_privacy.xml | 41 +++
...een.xml => ic_illustration_fullscreen.xml} | 0
..._switch.xml => ic_illustration_switch.xml} | 0
..._window.xml => ic_illustration_window.xml} | 0
res/drawable/ic_launcher_background.xml | 37 +++
res/values/arrays.xml | 21 ++
res/values/cm_strings.xml | 196 ++++++++++++
res/values/strings.xml | 8 +-
.../advanced_privacy_dashboard_settings.xml | 28 ++
res/xml/bubble_notification_settings.xml | 5 +-
res/xml/top_level_settings.xml | 10 +-
...ConnectivityCheckPreferenceController.java | 295 ++++++++++++++++++
.../network/NetworkDashboardFragment.java | 3 +
.../AdvancedPrivacyDashboardFragment.java | 52 +++
.../android/settings/wifi/WifiStatusTest.java | 4 +-
20 files changed, 692 insertions(+), 477 deletions(-)
create mode 100644 res/drawable/ic_homepage_advanced_privacy.xml
rename res/drawable/{accessibility_magnification_mode_fullscreen.xml => ic_illustration_fullscreen.xml} (100%)
rename res/drawable/{accessibility_magnification_mode_switch.xml => ic_illustration_switch.xml} (100%)
rename res/drawable/{accessibility_magnification_mode_window.xml => ic_illustration_window.xml} (100%)
create mode 100644 res/drawable/ic_launcher_background.xml
create mode 100644 res/values/cm_strings.xml
create mode 100644 res/xml/advanced_privacy_dashboard_settings.xml
create mode 100644 src/com/android/settings/network/ConnectivityCheckPreferenceController.java
create mode 100644 src/com/android/settings/privacy/AdvancedPrivacyDashboardFragment.java
diff --git a/res/drawable/ic_homepage_advanced_privacy.xml b/res/drawable/ic_homepage_advanced_privacy.xml
new file mode 100644
index 0000000000..3786ebb858
--- /dev/null
+++ b/res/drawable/ic_homepage_advanced_privacy.xml
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ ~ Copyright ECORP SAS 2022
+ ~ This program is free software: you can redistribute it and/or modify
+ ~ it under the terms of the GNU General Public License as published by
+ ~ the Free Software Foundation, either version 3 of the License, or
+ ~ (at your option) any later version.
+ ~
+ ~ This program is distributed in the hope that it will be useful,
+ ~ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ ~ GNU General Public License for more details.
+ ~
+ ~ You should have received a copy of the GNU General Public License
+ ~ along with this program. If not, see <https://www.gnu.org/licenses/>.
+ -->
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:width="36dp"
+ android:height="36dp"
+ android:viewportWidth="32"
+ android:viewportHeight="32">
+ <group>
+ <clip-path
+ android:pathData="M0,0h32v32h-32z"/>
+ <path
+ android:pathData="M7,0L25,0A7,7 0,0 1,32 7L32,25A7,7 0,0 1,25 32L7,32A7,7 0,0 1,0 25L0,7A7,7 0,0 1,7 0z"
+ android:fillColor="#2CCF69"/>
+ <path
+ android:pathData="M15.983,6.667V6.667C15.917,6.666 15.85,6.675 15.785,6.693L7.869,10.044C7.815,10.069 7.765,10.111 7.727,10.168C7.689,10.228 7.667,10.301 7.667,10.377L7.667,10.379C7.667,18.181 12.058,23.35 15.862,24.975L15.865,24.977C15.902,24.992 15.94,25 15.978,25C16.016,25 16.054,24.992 16.091,24.977L16.097,24.974L16.097,24.974C19.126,23.687 24.324,19.049 24.333,10.402C24.33,10.323 24.305,10.248 24.263,10.186C24.22,10.122 24.162,10.075 24.099,10.049C24.099,10.049 24.099,10.049 24.099,10.049L16.169,6.691C16.112,6.675 16.053,6.667 15.994,6.667L15.983,6.667ZM16.75,5.127L24.75,8.514C25.114,8.669 25.425,8.927 25.647,9.258C25.869,9.589 25.992,9.979 26,10.379C26,19.777 20.332,24.986 16.749,26.508C16.505,26.613 16.243,26.667 15.978,26.667C15.713,26.667 15.451,26.613 15.207,26.508C10.749,24.603 6,18.803 6,10.379C5.999,9.982 6.114,9.594 6.328,9.262C6.543,8.931 6.849,8.671 7.208,8.514L15.207,5.127C15.463,5.041 15.73,4.998 15.999,5C16.255,5.001 16.508,5.044 16.75,5.127Z"
+ android:fillColor="#ffffff"
+ android:fillType="evenOdd"/>
+ <path
+ android:pathData="M13.672,11.986C13.998,12.312 13.998,12.84 13.672,13.165C13.03,13.808 12.708,14.649 12.708,15.493C12.708,16.336 13.03,17.177 13.672,17.82C14.315,18.463 15.156,18.784 16,18.784C16.844,18.784 17.684,18.463 18.327,17.82C18.97,17.177 19.291,16.336 19.291,15.493C19.291,14.649 18.97,13.808 18.327,13.165C18.002,12.84 18.002,12.312 18.327,11.986C18.653,11.661 19.18,11.661 19.506,11.986C20.474,12.955 20.958,14.225 20.958,15.493C20.958,16.76 20.474,18.03 19.506,18.998C18.538,19.966 17.267,20.451 16,20.451C14.732,20.451 13.462,19.966 12.494,18.998C11.526,18.03 11.042,16.76 11.042,15.493C11.042,14.225 11.526,12.955 12.494,11.986C12.819,11.661 13.347,11.661 13.672,11.986Z"
+ android:fillColor="#ffffff"
+ android:fillType="evenOdd"/>
+ <path
+ android:pathData="M16.085,11C16.545,11 16.918,11.373 16.918,11.833L16.918,15.554C16.918,16.014 16.545,16.387 16.085,16.387C15.624,16.387 15.251,16.014 15.251,15.554L15.251,11.833C15.251,11.373 15.624,11 16.085,11Z"
+ android:fillColor="#ffffff"
+ android:fillType="evenOdd"/>
+ </group>
+</vector>
diff --git a/res/drawable/accessibility_magnification_mode_fullscreen.xml b/res/drawable/ic_illustration_fullscreen.xml
similarity index 100%
rename from res/drawable/accessibility_magnification_mode_fullscreen.xml
rename to res/drawable/ic_illustration_fullscreen.xml
diff --git a/res/drawable/accessibility_magnification_mode_switch.xml b/res/drawable/ic_illustration_switch.xml
similarity index 100%
rename from res/drawable/accessibility_magnification_mode_switch.xml
rename to res/drawable/ic_illustration_switch.xml
diff --git a/res/drawable/accessibility_magnification_mode_window.xml b/res/drawable/ic_illustration_window.xml
similarity index 100%
rename from res/drawable/accessibility_magnification_mode_window.xml
rename to res/drawable/ic_illustration_window.xml
diff --git a/res/drawable/ic_launcher_background.xml b/res/drawable/ic_launcher_background.xml
new file mode 100644
index 0000000000..b91ae32786
--- /dev/null
+++ b/res/drawable/ic_launcher_background.xml
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ ~ Copyright ECORP SAS 2022
+ ~ This program is free software: you can redistribute it and/or modify
+ ~ it under the terms of the GNU General Public License as published by
+ ~ the Free Software Foundation, either version 3 of the License, or
+ ~ (at your option) any later version.
+ ~
+ ~ This program is distributed in the hope that it will be useful,
+ ~ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ ~ GNU General Public License for more details.
+ ~
+ ~ You should have received a copy of the GNU General Public License
+ ~ along with this program. If not, see <https://www.gnu.org/licenses/>.
+ -->
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:aapt="http://schemas.android.com/aapt"
+ android:width="108dp"
+ android:height="108dp"
+ android:viewportWidth="108"
+ android:viewportHeight="108">
+ <path
+ android:pathData="M0,0h108v108h-108z">
+ <aapt:attr name="android:fillColor">
+ <gradient
+ android:startX="54"
+ android:startY="7.15"
+ android:endX="54"
+ android:endY="208.35"
+ android:type="linear">
+ <item android:offset="0" android:color="#FFD8DDDF"/>
+ <item android:offset="1" android:color="#FF949DA1"/>
+ </gradient>
+ </aapt:attr>
+ </path>
+</vector>
diff --git a/res/values/arrays.xml b/res/values/arrays.xml
index 1ab9876720..169a7bfb21 100644
--- a/res/values/arrays.xml
+++ b/res/values/arrays.xml
@@ -82,6 +82,27 @@
<item>10 minutes</item>
<item>30 minutes</item>
</string-array>
+
+ <string-array name="connectivity_check_entries">
+ <item>Disabled</item>
+ <item>DivestOS (US)</item>
+ <item>Kuketz (DE) [default]</item>
+ <item>openSUSE (DE)</item>
+ <item>Ubuntu (UK)</item>
+ <item>Graphene (US)</item>
+ <item>Kuketz (DE)</item>
+ </string-array>
+
+ <string-array name="connectivity_check_values" translatable="false">
+ <item>0</item>
+ <item>1</item>
+ <item>2</item>
+ <item>3</item>
+ <item>4</item>
+ <item>5</item>
+ <item>6</item>
+ </string-array>
+
<!-- Do not translate. -->
<string-array name="lock_after_timeout_values" translatable="false">
diff --git a/res/values/cm_strings.xml b/res/values/cm_strings.xml
new file mode 100644
index 0000000000..4da3fdca8c
--- /dev/null
+++ b/res/values/cm_strings.xml
@@ -0,0 +1,196 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2017-2023 The LineageOS Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+ <!-- Private DNS -->
+ <string name="private_dns_mode_cloudflare" translatable="false">Cloudflare DNS</string>
+ <!-- Alternative: 1dot1dot1dot1.cloudflare-dns.com -->
+ <string name="private_dns_hostname_cloudflare" translatable="false">9.9.9.9</string>
+
+ <!-- Advanced keyboard settings -->
+ <string name="keyboard_extras_title">Extras</string>
+ <string name="advanced_keyboard_settings_title">Advanced settings</string>
+
+ <!-- Android debugging as root -->
+ <string name="adb_enable_root">Rooted debugging</string>
+ <string name="adb_enable_summary_root">Allow running Android debugging as root</string>
+
+ <!-- Backup Transport selection settings menu and activity title -->
+ <string name="backup_transport_setting_label">Change backup provider</string>
+ <string name="backup_transport_title">Select backup provider</string>
+
+ <!-- Black theme for dark mode -->
+ <string name="berry_black_theme_title">Pure black</string>
+ <string name="berry_black_theme_summary">Pure black background for dark theme</string>
+
+ <!-- Device Info screen. LineageOS legal. -->
+ <string name="lineagelicense_title">LineageOS legal</string>
+
+ <!-- String for removal of sensitive info on about, depending on tap -->
+ <string name="device_info_protected_single_press">Tap to show info</string>
+
+ <!-- [CHAR LIMIT=NONE] Device Info screen. Countdown for user taps to enable development settings -->
+ <plurals name="show_dev_countdown_cm">
+ <item quantity="one">You are now <xliff:g id="step_count">%1$d</xliff:g> step away from enabling development settings.</item>
+ <item quantity="other">You are now <xliff:g id="step_count">%1$d</xliff:g> steps away from enabling development settings.</item>
+ </plurals>
+ <!-- [CHAR LIMIT=NONE] Device Info screen. Confirmation that developer settings are enabled -->
+ <string name="show_dev_on_cm">You have enabled development settings!</string>
+ <!-- [CHAR LIMIT=NONE] Device Info screen. Okay we get it, stop pressing, you already have it on -->
+ <string name="show_dev_already_cm">No need, you have already enabled development settings.</string>
+
+ <!-- Display settings screen, peak refresh rate settings summary [CHAR LIMIT=NONE] -->
+ <string name="peak_refresh_rate_summary_custom">Automatically raises the refresh rate from 60 to %1$d Hz for some content. Increases battery usage.</string>
+
+ <!-- Double tap to sleep on status bar or lockscreen -->
+ <string name="status_bar_double_tap_to_sleep_title">Tap to sleep</string>
+ <string name="status_bar_double_tap_to_sleep_summary">Double-tap on the status bar or lockscreen to turn off the display</string>
+
+ <!-- High touch polling rate -->
+ <string name="high_touch_polling_rate_title">High touch polling rate</string>
+ <string name="high_touch_polling_rate_summary">Increase touchscreen polling rate</string>
+
+ <!-- Heads-up -->
+ <string name="heads_up_notifications_enabled_title">Heads-up</string>
+ <string name="heads_up_notifications_enabled_summary">Display priority notifications in a small floating window</string>
+
+ <!-- High touch sensitivity -->
+ <string name="high_touch_sensitivity_title">High touch sensitivity</string>
+ <string name="high_touch_sensitivity_summary">Increase touchscreen sensitivity so it can be used while wearing gloves</string>
+
+ <!-- Hotspot extras -->
+ <string name="tethering_allow_vpn_upstreams_title">Allow clients to use VPNs</string>
+ <string name="tethering_allow_vpn_upstreams_summary">Permit hotspot clients to use this device\u2019s VPN connections for upstream connectivity</string>
+
+ <!-- Increasing ring tone volume -->
+ <string name="increasing_ring_volume_option_title">Increasing ring volume</string>
+ <string name="increasing_ring_min_volume_title">Start volume</string>
+ <string name="increasing_ring_ramp_up_time_title">Ramp-up time</string>
+
+ <!-- Lock screen cover art -->
+ <string name="lockscreen_media_art_title">Display media cover art</string>
+
+ <!-- Lock screen pattern size -->
+ <string name="lock_pattern_size_3" translatable="false">3 \u00d7 3</string>
+ <string name="lock_pattern_size_4" translatable="false">4 \u00d7 4</string>
+ <string name="lock_pattern_size_5" translatable="false">5 \u00d7 5</string>
+ <string name="lock_pattern_size_6" translatable="false">6 \u00d7 6</string>
+ <string name="lock_settings_picker_pattern_size_message">Choose a pattern size</string>
+ <!-- Whether a visible red line will be drawn after the user has drawn the unlock pattern incorrectly -->
+ <string name="lockpattern_settings_enable_error_path_title">Show pattern error</string>
+ <!-- Whether the dots will be drawn when using the lockscreen pattern -->
+ <string name="lockpattern_settings_enable_dots_title">Show pattern dots</string>
+
+ <!-- Max refresh rate -->
+ <string name="max_refresh_rate_title">Peak refresh rate</string>
+
+ <!-- Min refresh rate -->
+ <string name="min_refresh_rate_title">Minimum refresh rate</string>
+
+ <!-- Message shown in fingerprint enrollment dialog to locate the sensor -->
+ <string name="fingerprint_enroll_find_sensor_message_front" product="tablet">Locate the fingerprint sensor on the front of your tablet.</string>
+ <string name="fingerprint_enroll_find_sensor_message_front" product="device">Locate the fingerprint sensor on the front of your device.</string>
+ <string name="fingerprint_enroll_find_sensor_message_front" product="default">Locate the fingerprint sensor on the front of your phone.</string>
+ <string name="fingerprint_enroll_find_sensor_message_rear" product="tablet">Locate the fingerprint sensor on the back of your tablet.</string>
+ <string name="fingerprint_enroll_find_sensor_message_rear" product="device">Locate the fingerprint sensor on the back of your device.</string>
+ <string name="fingerprint_enroll_find_sensor_message_rear" product="default">Locate the fingerprint sensor on the back of your phone.</string>
+ <string name="fingerprint_enroll_find_sensor_message_side" product="tablet">Locate the fingerprint sensor on the side of your tablet.</string>
+ <string name="fingerprint_enroll_find_sensor_message_side" product="device">Locate the fingerprint sensor on the side of your device.</string>
+ <string name="fingerprint_enroll_find_sensor_message_side" product="default">Locate the fingerprint sensor on the side of your phone.</string>
+
+ <!-- Message shown when user touches the icon on the screen, instead of the real fingerprint sensor -->
+ <string name="fingerprint_enroll_touch_dialog_message_front" product="tablet">Touch the sensor on the front of your tablet.</string>
+ <string name="fingerprint_enroll_touch_dialog_message_front" product="device">Touch the sensor on the front of your device.</string>
+ <string name="fingerprint_enroll_touch_dialog_message_front" product="default">Touch the sensor on the front of your phone.</string>
+ <string name="fingerprint_enroll_touch_dialog_message_rear" product="tablet">Touch the sensor on the back of your tablet.</string>
+ <string name="fingerprint_enroll_touch_dialog_message_rear" product="device">Touch the sensor on the back of your device.</string>
+ <string name="fingerprint_enroll_touch_dialog_message_rear" product="default">Touch the sensor on the back of your phone.</string>
+ <string name="fingerprint_enroll_touch_dialog_message_side" product="tablet">Touch the sensor on the side of your tablet.</string>
+ <string name="fingerprint_enroll_touch_dialog_message_side" product="device">Touch the sensor on the side of your device.</string>
+ <string name="fingerprint_enroll_touch_dialog_message_side" product="default">Touch the sensor on the side of your phone.</string>
+
+ <!-- Navigation bar hint -->
+ <string name="show_navbar_hint_title">Navigation hint</string>
+ <string name="show_navbar_hint_summary">Show navigation hint bar at the bottom of the screen</string>
+
+ <!-- Notification sound timeout -->
+ <string name="app_notification_sound_timeout_title">Minimum time between notification sounds</string>
+ <string name="app_notification_sound_timeout_summary_template">Allow sounds or vibration no more than once every <xliff:g id="duration">%1$s</xliff:g></string>
+ <string name="app_notification_sound_timeout_value_none">No restriction</string>
+ <string name="app_notification_sound_timeout_value_10_seconds">10 seconds</string>
+ <string name="app_notification_sound_timeout_value_30_seconds">30 seconds</string>
+ <string name="app_notification_sound_timeout_value_1_minute">1 minute</string>
+ <string name="app_notification_sound_timeout_value_5_minutes">5 minutes</string>
+ <string name="app_notification_sound_timeout_value_15_minutes">10 minutes</string>
+ <string name="app_notification_sound_timeout_value_30_minutes">30 minutes</string>
+
+ <!-- One shot automatic brightness -->
+ <string name="auto_brightness_one_shot_title">One shot auto-brightness</string>
+ <string name="auto_brightness_one_shot_summary">Brightness adjustment will only occur at the moment the screen is turned on</string>
+
+ <!-- Per-app data restrictions -->
+ <string name="data_usage_app_restrict_all">Allow network access</string>
+ <string name="data_usage_app_restrict_all_summary">Enable network usage</string>
+ <string name="data_usage_app_restrict_mobile">Mobile data</string>
+ <string name="data_usage_app_restrict_mobile_summary">Enable usage of mobile data</string>
+ <string name="data_usage_app_restrict_vpn">VPN data</string>
+ <string name="data_usage_app_restrict_vpn_summary">Enable usage of VPN data</string>
+ <string name="data_usage_app_restrict_wifi">Wi\u2011Fi data</string>
+ <string name="data_usage_app_restrict_wifi_summary">Enable usage of Wi\u2011Fi data</string>
+
+ <!-- PIN scramble -->
+ <string name="unlock_scramble_pin_layout_title">Scramble layout</string>
+ <string name="unlock_scramble_pin_layout_summary">Scramble PIN layout when unlocking device</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>
+
+ <!-- Touchscreen gesture settings -->
+ <string name="touchscreen_gesture_settings_title">Touchscreen gestures</string>
+ <string name="touchscreen_gesture_settings_summary">Perform various touchscreen gestures for quick actions</string>
+
+ <!-- Touchscreen hovering -->
+ <string name="touchscreen_hovering_title">Touchscreen hovering</string>
+ <string name="touchscreen_hovering_summary">Allows you to hover the screen like a mouse in web browsers, remote desktops, etc</string>
+
+ <!-- Wake on plug -->
+ <string name="wake_when_plugged_or_unplugged_title">Wake on plug</string>
+ <string name="wake_when_plugged_or_unplugged_summary">Turn the screen on when connecting or disconnecting a power source</string>
+
+ <!-- FastCharge feature -->
+ <string name="fast_charging_title">Fast charging</string>
+ <string name="fast_charging_summary">Disable to reduce the heat produced by the device while charging or to extend the lifespan of the battery</string>
+
+ <!-- Preference and settings suggestion title text for screen off UDFPS (phone) [CHAR LIMIT=60]-->
+ <string name="ambient_display_screen_off_udfps_title" product="default">Long press on fingerprint sensor to unlock phone</string>
+ <!-- Preference and settings suggestion title text for screen off UDFPS (tablet) [CHAR LIMIT=60]-->
+ <string name="ambient_display_screen_off_udfps_title" product="tablet">Long press on fingerprint sensor to unlock tablet</string>
+ <!-- Preference and settings suggestion title text for screen off UDFPS (device) [CHAR LIMIT=60]-->
+ <string name="ambient_display_screen_off_udfps_title" product="device">Long press on fingerprint sensor to unlock device</string>
+ <!-- Summary text for screen off UDFPS [CHAR LIMIT=NONE]-->
+ <string name="ambient_display_screen_off_udfps_summary">To wake up your screen and unlock, long press your under-display fingerprint sensor.</string>
+
+ <!-- Warning message for the sd card setup -->
+ <string name="storage_warning_internal">Warning: This option may not work properly or lead to data loss and is therefore not recommended!</string>
+
+ <!-- Location settings screen, setting summary for Assisted GPS switch -->
+ <string name="assisted_gps_summary">Download satellite assistance data from the internet which can greatly improve the GPS startup performance. For emergency calls, assisted GPS is always allowed.</string>
+
+ <!-- LeOS Advanced Privacy -->
+ <string name="advanced_privacy_dashboard_title" translatable="false">Advanced Privacy</string>
+ <string name="advanced_privacy_dashboard_summary">Manage trackers, fake location, hide IP address</string>
+</resources>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index b5e993fe84..69a03bd4f9 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -639,6 +639,9 @@
<!-- TODO(b/208624929): Update to an UX approved summary and char limit. -->
<!-- Main Settings screen setting summary for the item that takes you to the privacy and security settings. [CHAR LIMIT=60] -->
<string name="safety_center_summary">App security, device lock, permissions</string>
+
+ <!-- Summary for e Security settings, explaining a few important settings under it [CHAR LIMIT=NONE] -->
+ <string name="security_dashboard_summary_e">Screen lock, app security</string>
<!-- Face enrollment and settings --><skip />
<!-- Note: Update FaceEnrollParentalConsent.CONSENT_STRING_RESOURCES when any _consent_ strings are added or removed. -->
@@ -2314,7 +2317,7 @@
<!-- Message of private dns that provides a help link. [CHAR LIMIT=NONE] -->
<string name="private_dns_help_message"><annotation id="url">Learn more</annotation> about Private DNS features</string>
<!-- Message to display when private dns is on. [CHAR LIMIT=10] -->
- <string name="private_dns_mode_on">On</string>
+ <string name="private_dns_mode_on">Off</string>
<!-- Message to display when wifi calling needs activation [CHAR LIMIT=NONE] -->
<string name="wifi_calling_settings_activation_instructions">Activate Wi\u2011Fi Calling</string>
@@ -12314,4 +12317,7 @@
<!-- Warning message when we try to dock an app not supporting multiple instances split into multiple sides [CHAR LIMIT=NONE] -->
<string name="dock_multi_instances_not_supported_text">"This app can only be opened in 1 window"</string>
+ <string name="connectivity_check_title">Internet connectivity check</string>
+ <string name="connectivity_check_summary">HTTP endpoints to use for performing internet connectivity checks.</string>
+
</resources>
diff --git a/res/xml/advanced_privacy_dashboard_settings.xml b/res/xml/advanced_privacy_dashboard_settings.xml
new file mode 100644
index 0000000000..8433a4402a
--- /dev/null
+++ b/res/xml/advanced_privacy_dashboard_settings.xml
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2019-2022 ECORP SAS
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+
+<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:settings="http://schemas.android.com/apk/res-auto"
+ android:key="advanced_privacy"
+ android:title="@string/advanced_privacy_dashboard_title">
+
+ <Preference>
+ <intent android:action="android.intent.action.MAIN"
+ android:targetPackage="foundation.e.advancedprivacy"
+ android:targetClass="foundation.e.privacycentralapp.main.MainActivity" />
+ </Preference>
+</PreferenceScreen>
diff --git a/res/xml/bubble_notification_settings.xml b/res/xml/bubble_notification_settings.xml
index 3e137d7001..82a89a3249 100644
--- a/res/xml/bubble_notification_settings.xml
+++ b/res/xml/bubble_notification_settings.xml
@@ -26,10 +26,7 @@
<com.android.settingslib.widget.IllustrationPreference
android:key="bubbles_illustration"
settings:searchable="false"
- app:lottie_rawRes="@raw/lottie_bubbles"
- app:lottie_cacheComposition="false"
- settings:dynamicColor="true"
- settings:controller="com.android.settings.notification.BubbleNotificationIllustrationPreferenceController"/>
+ app:lottie_rawRes="@raw/lottie_bubbles"/>
<com.android.settingslib.widget.MainSwitchPreference
android:key="global_notification_bubbles"
diff --git a/res/xml/top_level_settings.xml b/res/xml/top_level_settings.xml
index d050a1f274..0c0db84657 100644
--- a/res/xml/top_level_settings.xml
+++ b/res/xml/top_level_settings.xml
@@ -141,7 +141,7 @@
android:key="top_level_security"
android:order="-50"
android:title="@string/security_settings_title"
- android:summary="@string/security_dashboard_summary"
+ android:summary="@string/security_dashboard_summary_e"
settings:highlightableMenuKey="@string/menu_key_security"
settings:controller="com.android.settings.security.TopLevelSecurityEntryPreferenceController"/>
@@ -155,6 +155,14 @@
settings:highlightableMenuKey="@string/menu_key_privacy"
settings:controller="com.android.settings.privacy.TopLevelPrivacyEntryPreferenceController"/>
+ <com.android.settings.widget.HomepagePreference
+ android:key="top_level_advanced_privacy"
+ android:title="@string/advanced_privacy_dashboard_title"
+ android:summary="@string/advanced_privacy_dashboard_summary"
+ android:icon="@drawable/ic_homepage_advanced_privacy"
+ android:order="-35"
+ android:fragment="com.android.settings.privacy.AdvancedPrivacyDashboardFragment"/>
+
<com.android.settings.widget.HomepagePreference
android:fragment="com.android.settings.location.LocationSettings"
android:icon="@drawable/ic_settings_location"
diff --git a/src/com/android/settings/network/ConnectivityCheckPreferenceController.java b/src/com/android/settings/network/ConnectivityCheckPreferenceController.java
new file mode 100644
index 0000000000..04bcbe3b60
--- /dev/null
+++ b/src/com/android/settings/network/ConnectivityCheckPreferenceController.java
@@ -0,0 +1,295 @@
+/*
+ * Copyright (C) 2020 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.settings.network;
+
+import android.content.ContentResolver;
+import android.content.Context;
+import android.content.res.Resources;
+import android.database.ContentObserver;
+import android.net.LinkProperties;
+import android.net.Network;
+import android.os.Handler;
+import android.os.Looper;
+import android.os.UserHandle;
+import android.os.UserManager;
+import android.provider.Settings;
+import androidx.preference.ListPreference;
+import androidx.preference.Preference;
+import androidx.preference.PreferenceScreen;
+import com.android.internal.util.ArrayUtils;
+import com.android.settings.R;
+import com.android.settings.core.BasePreferenceController;
+import com.android.settings.core.PreferenceControllerMixin;
+import com.android.settingslib.RestrictedLockUtils.EnforcedAdmin;
+import com.android.settingslib.RestrictedLockUtilsInternal;
+import com.android.settingslib.core.lifecycle.events.OnResume;
+
+public class ConnectivityCheckPreferenceController
+ extends BasePreferenceController
+ implements PreferenceControllerMixin, Preference.OnPreferenceChangeListener,
+ OnResume {
+
+ // imported defaults from AOSP NetworkStack
+ private static final String STANDARD_HTTPS_URL =
+ "http://captiveportal.kuketz.de/generate_204";
+ private static final String STANDARD_HTTP_URL =
+ "http://captiveportal.kuketz.de/generate_204";
+ private static final String STANDARD_FALLBACK_URL =
+ "http://captiveportal.kuketz.de/gen_204";
+ private static final String STANDARD_OTHER_FALLBACK_URLS =
+ "http://captiveportal.kuketz.de/generate_204";
+
+ // GrapheneOS
+ private static final String GRAPHENEOS_CAPTIVE_PORTAL_HTTPS_URL =
+ "https://connectivitycheck.grapheneos.network/generate_204";
+ private static final String GRAPHENEOS_CAPTIVE_PORTAL_HTTP_URL =
+ "http://connectivitycheck.grapheneos.network/generate_204";
+ private static final String GRAPHENEOS_CAPTIVE_PORTAL_FALLBACK_URL =
+ "http://grapheneos.online/gen_204";
+ private static final String GRAPHENEOS_CAPTIVE_PORTAL_OTHER_FALLBACK_URL =
+ "http://grapheneos.online/generate_204";
+
+ // DivestOS
+ private static final String DIVESTOS_HTTPS_URL =
+ "https://divestos.org/generate_204";
+ private static final String DIVESTOS_HTTP_URL =
+ "http://divestos.org/generate_204";
+
+ // openSUSE
+ private static final String OPENSUSE_HTTPS_URL =
+ "https://conncheck.opensuse.org";
+ private static final String OPENSUSE_HTTP_URL =
+ "http://conncheck.opensuse.org";
+
+ // Ubuntu
+ private static final String UBUNTU_HTTPS_URL =
+ "https://connectivity-check.ubuntu.com";
+ private static final String UBUNTU_HTTP_URL =
+ "http://connectivity-check.ubuntu.com";
+
+ // Kuketz, https://www.kuketz-blog.de/android-captive-portal-check-204-http-antwort-von-captiveportal-kuketz-de/
+ private static final String KUKETZ_HTTPS_URL =
+ "https://captiveportal.kuketz.de";
+ private static final String KUKETZ_HTTP_URL =
+ "http://captiveportal.kuketz.de";
+
+ private static final int DISABLED_CAPTIVE_PORTAL_INTVAL = 0;
+ private static final int DIVESTOS_CAPTIVE_PORTAL_HTTP_URL_INTVAL = 1;
+ private static final int STANDARD_CAPTIVE_PORTAL_HTTP_URL_INTVAL = 2;
+ private static final int OPENSUSE_CAPTIVE_PORTAL_HTTP_URL_INTVAL = 3;
+ private static final int UBUNTU_CAPTIVE_PORTAL_HTTP_URL_INTVAL = 4;
+ private static final int GRAPHENEOS_CAPTIVE_PORTAL_HTTP_URL_INTVAL = 5;
+ private static final int KUKETZ_CAPTIVE_PORTAL_HTTP_URL_INTVAL = 6;
+
+ private static final String KEY_CONNECTIVITY_CHECK_SETTINGS =
+ "connectivity_check_settings";
+
+ private ListPreference mConnectivityPreference;
+
+ public ConnectivityCheckPreferenceController(Context context) {
+ super(context, KEY_CONNECTIVITY_CHECK_SETTINGS);
+ }
+
+ @Override
+ public int getAvailabilityStatus() {
+ if (isDisabledByAdmin()) {
+ return BasePreferenceController.DISABLED_FOR_USER;
+ }
+ return BasePreferenceController.AVAILABLE;
+ }
+
+ @Override
+ public void displayPreference(PreferenceScreen screen) {
+ ListPreference captiveList = new ListPreference(screen.getContext());
+ captiveList.setKey(KEY_CONNECTIVITY_CHECK_SETTINGS);
+ captiveList.setOrder(30);
+ captiveList.setIcon(R.drawable.ic_settings_language);
+ captiveList.setTitle(R.string.connectivity_check_title);
+ captiveList.setSummary(R.string.connectivity_check_summary);
+ captiveList.setEntries(R.array.connectivity_check_entries);
+ captiveList.setEntryValues(R.array.connectivity_check_values);
+
+ if (mConnectivityPreference == null) {
+ screen.addPreference(captiveList);
+ mConnectivityPreference = captiveList;
+ }
+ super.displayPreference(screen);
+ updatePreferenceState();
+ }
+
+ @Override
+ public String getPreferenceKey() {
+ return KEY_CONNECTIVITY_CHECK_SETTINGS;
+ }
+
+ private void updatePreferenceState() {
+ if (Settings.Global.getInt(mContext.getContentResolver(),
+ Settings.Global.CAPTIVE_PORTAL_MODE, Settings.Global.CAPTIVE_PORTAL_MODE_PROMPT)
+ == Settings.Global.CAPTIVE_PORTAL_MODE_IGNORE) {
+ mConnectivityPreference.setValueIndex(DISABLED_CAPTIVE_PORTAL_INTVAL);
+ return;
+ }
+
+ String pref = Settings.Global.getString(
+ mContext.getContentResolver(), Settings.Global.CAPTIVE_PORTAL_HTTP_URL);
+ if (STANDARD_HTTP_URL.equals(pref)) {
+ mConnectivityPreference.setValueIndex(
+ STANDARD_CAPTIVE_PORTAL_HTTP_URL_INTVAL);
+ } else if (GRAPHENEOS_CAPTIVE_PORTAL_HTTP_URL.equals(pref)) {
+ mConnectivityPreference.setValueIndex(
+ GRAPHENEOS_CAPTIVE_PORTAL_HTTP_URL_INTVAL);
+ } else if (DIVESTOS_HTTP_URL.equals(pref)) {
+ mConnectivityPreference.setValueIndex(
+ DIVESTOS_CAPTIVE_PORTAL_HTTP_URL_INTVAL);
+ } else if (OPENSUSE_HTTP_URL.equals(pref)) {
+ mConnectivityPreference.setValueIndex(
+ OPENSUSE_CAPTIVE_PORTAL_HTTP_URL_INTVAL);
+ } else if (UBUNTU_HTTP_URL.equals(pref)) {
+ mConnectivityPreference.setValueIndex(
+ UBUNTU_CAPTIVE_PORTAL_HTTP_URL_INTVAL);
+ } else if (KUKETZ_HTTP_URL.equals(pref)) {
+ mConnectivityPreference.setValueIndex(
+ KUKETZ_CAPTIVE_PORTAL_HTTP_URL_INTVAL);
+ }
+ }
+
+ @Override
+ public void onResume() {
+ updatePreferenceState();
+ if (mConnectivityPreference != null) {
+ setCaptivePortalURLs(
+ mContext.getContentResolver(),
+ Integer.parseInt(mConnectivityPreference.getValue()));
+ }
+ }
+
+ private void setCaptivePortalURLs(ContentResolver cr, int mode) {
+ switch (mode) {
+ case STANDARD_CAPTIVE_PORTAL_HTTP_URL_INTVAL:
+ Settings.Global.putString(cr, Settings.Global.CAPTIVE_PORTAL_HTTP_URL,
+ STANDARD_HTTP_URL);
+ Settings.Global.putString(cr, Settings.Global.CAPTIVE_PORTAL_HTTPS_URL,
+ STANDARD_HTTPS_URL);
+ Settings.Global.putString(cr, Settings.Global.CAPTIVE_PORTAL_FALLBACK_URL,
+ STANDARD_FALLBACK_URL);
+ Settings.Global.putString(
+ cr, Settings.Global.CAPTIVE_PORTAL_OTHER_FALLBACK_URLS,
+ STANDARD_OTHER_FALLBACK_URLS);
+ Settings.Global.putInt(cr, Settings.Global.CAPTIVE_PORTAL_MODE,
+ Settings.Global.CAPTIVE_PORTAL_MODE_PROMPT);
+ break;
+ case GRAPHENEOS_CAPTIVE_PORTAL_HTTP_URL_INTVAL:
+ Settings.Global.putString(cr, Settings.Global.CAPTIVE_PORTAL_HTTP_URL,
+ GRAPHENEOS_CAPTIVE_PORTAL_HTTP_URL);
+ Settings.Global.putString(cr, Settings.Global.CAPTIVE_PORTAL_HTTPS_URL,
+ GRAPHENEOS_CAPTIVE_PORTAL_HTTPS_URL);
+ Settings.Global.putString(cr, Settings.Global.CAPTIVE_PORTAL_FALLBACK_URL,
+ GRAPHENEOS_CAPTIVE_PORTAL_FALLBACK_URL);
+ Settings.Global.putString(
+ cr, Settings.Global.CAPTIVE_PORTAL_OTHER_FALLBACK_URLS,
+ GRAPHENEOS_CAPTIVE_PORTAL_OTHER_FALLBACK_URL);
+ Settings.Global.putInt(cr, Settings.Global.CAPTIVE_PORTAL_MODE,
+ Settings.Global.CAPTIVE_PORTAL_MODE_PROMPT);
+ break;
+ case DIVESTOS_CAPTIVE_PORTAL_HTTP_URL_INTVAL:
+ Settings.Global.putString(cr, Settings.Global.CAPTIVE_PORTAL_HTTP_URL,
+ DIVESTOS_HTTP_URL);
+ Settings.Global.putString(cr, Settings.Global.CAPTIVE_PORTAL_HTTPS_URL,
+ DIVESTOS_HTTPS_URL);
+ Settings.Global.putString(cr, Settings.Global.CAPTIVE_PORTAL_FALLBACK_URL,
+ DIVESTOS_HTTP_URL);
+ Settings.Global.putString(
+ cr, Settings.Global.CAPTIVE_PORTAL_OTHER_FALLBACK_URLS,
+ DIVESTOS_HTTP_URL);
+ Settings.Global.putInt(cr, Settings.Global.CAPTIVE_PORTAL_MODE,
+ Settings.Global.CAPTIVE_PORTAL_MODE_PROMPT);
+ break;
+ case OPENSUSE_CAPTIVE_PORTAL_HTTP_URL_INTVAL:
+ Settings.Global.putString(cr, Settings.Global.CAPTIVE_PORTAL_HTTP_URL,
+ OPENSUSE_HTTP_URL);
+ Settings.Global.putString(cr, Settings.Global.CAPTIVE_PORTAL_HTTPS_URL,
+ OPENSUSE_HTTPS_URL);
+ Settings.Global.putString(cr, Settings.Global.CAPTIVE_PORTAL_FALLBACK_URL,
+ OPENSUSE_HTTP_URL);
+ Settings.Global.putString(
+ cr, Settings.Global.CAPTIVE_PORTAL_OTHER_FALLBACK_URLS,
+ OPENSUSE_HTTP_URL);
+ Settings.Global.putInt(cr, Settings.Global.CAPTIVE_PORTAL_MODE,
+ Settings.Global.CAPTIVE_PORTAL_MODE_PROMPT);
+ break;
+ case UBUNTU_CAPTIVE_PORTAL_HTTP_URL_INTVAL:
+ Settings.Global.putString(cr, Settings.Global.CAPTIVE_PORTAL_HTTP_URL,
+ UBUNTU_HTTP_URL);
+ Settings.Global.putString(cr, Settings.Global.CAPTIVE_PORTAL_HTTPS_URL,
+ UBUNTU_HTTPS_URL);
+ Settings.Global.putString(cr, Settings.Global.CAPTIVE_PORTAL_FALLBACK_URL,
+ UBUNTU_HTTP_URL);
+ Settings.Global.putString(
+ cr, Settings.Global.CAPTIVE_PORTAL_OTHER_FALLBACK_URLS,
+ UBUNTU_HTTP_URL);
+ Settings.Global.putInt(cr, Settings.Global.CAPTIVE_PORTAL_MODE,
+ Settings.Global.CAPTIVE_PORTAL_MODE_PROMPT);
+ break;
+ case KUKETZ_CAPTIVE_PORTAL_HTTP_URL_INTVAL:
+ Settings.Global.putString(cr, Settings.Global.CAPTIVE_PORTAL_HTTP_URL,
+ KUKETZ_HTTP_URL);
+ Settings.Global.putString(cr, Settings.Global.CAPTIVE_PORTAL_HTTPS_URL,
+ KUKETZ_HTTPS_URL);
+ Settings.Global.putString(cr, Settings.Global.CAPTIVE_PORTAL_FALLBACK_URL,
+ KUKETZ_HTTP_URL);
+ Settings.Global.putString(
+ cr, Settings.Global.CAPTIVE_PORTAL_OTHER_FALLBACK_URLS,
+ KUKETZ_HTTP_URL);
+ Settings.Global.putInt(cr, Settings.Global.CAPTIVE_PORTAL_MODE,
+ Settings.Global.CAPTIVE_PORTAL_MODE_PROMPT);
+ break;
+ default:
+ // Default URLs as placeholder
+ Settings.Global.putString(cr, Settings.Global.CAPTIVE_PORTAL_HTTP_URL,
+ STANDARD_HTTP_URL);
+ Settings.Global.putString(cr, Settings.Global.CAPTIVE_PORTAL_HTTPS_URL,
+ STANDARD_HTTPS_URL);
+ Settings.Global.putString(cr, Settings.Global.CAPTIVE_PORTAL_FALLBACK_URL,
+ STANDARD_FALLBACK_URL);
+ Settings.Global.putString(
+ cr, Settings.Global.CAPTIVE_PORTAL_OTHER_FALLBACK_URLS,
+ STANDARD_OTHER_FALLBACK_URLS);
+ Settings.Global.putInt(cr, Settings.Global.CAPTIVE_PORTAL_MODE,
+ Settings.Global.CAPTIVE_PORTAL_MODE_IGNORE);
+ }
+ }
+
+ @Override
+ public boolean onPreferenceChange(Preference preference, Object value) {
+ final String key = preference.getKey();
+ if (KEY_CONNECTIVITY_CHECK_SETTINGS.equals(key)) {
+ setCaptivePortalURLs(mContext.getContentResolver(),
+ Integer.parseInt((String)value));
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+ private EnforcedAdmin getEnforcedAdmin() {
+ return RestrictedLockUtilsInternal.checkIfRestrictionEnforced(
+ mContext, UserManager.DISALLOW_CONFIG_PRIVATE_DNS,
+ UserHandle.myUserId());
+ }
+
+ private boolean isDisabledByAdmin() { return getEnforcedAdmin() != null; }
+}
diff --git a/src/com/android/settings/network/NetworkDashboardFragment.java b/src/com/android/settings/network/NetworkDashboardFragment.java
index 4ea3464569..00daadb8dc 100644
--- a/src/com/android/settings/network/NetworkDashboardFragment.java
+++ b/src/com/android/settings/network/NetworkDashboardFragment.java
@@ -123,6 +123,9 @@ public class NetworkDashboardFragment extends DashboardFragment implements
}
controllers.add(privateDnsPreferenceController);
controllers.add(new NetworkProviderCallsSmsController(context, lifecycle, lifecycleOwner));
+ ConnectivityCheckPreferenceController connectivityCheck =
+ new ConnectivityCheckPreferenceController(context);
+ controllers.add(connectivityCheck);
// Start SettingsDumpService after the MobileNetworkRepository is created.
Intent intent = new Intent(context, SettingsDumpService.class);
diff --git a/src/com/android/settings/privacy/AdvancedPrivacyDashboardFragment.java b/src/com/android/settings/privacy/AdvancedPrivacyDashboardFragment.java
new file mode 100644
index 0000000000..c0564742c3
--- /dev/null
+++ b/src/com/android/settings/privacy/AdvancedPrivacyDashboardFragment.java
@@ -0,0 +1,52 @@
+/*
+ * Copyright (C) 2019-2022 ECORP SAS
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.settings.privacy;
+
+import android.app.Activity;
+import android.content.ComponentName;
+import android.content.Intent;
+import android.os.Bundle;
+
+import androidx.fragment.app.Fragment;
+
+import com.android.settings.R;
+import com.android.settings.search.BaseSearchIndexProvider;
+import com.android.settingslib.search.SearchIndexable;
+
+@SearchIndexable
+public class AdvancedPrivacyDashboardFragment extends Fragment {
+
+ private static final String advancedPrivacyPackageName = "foundation.e.advancedprivacy";
+ private static final String advancedPrivacyActivityName = "foundation.e.advancedprivacy.main.MainActivity";
+
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+
+ Activity activity = getActivity();
+ Intent intent = new Intent().setComponent(new ComponentName(advancedPrivacyPackageName,
+ advancedPrivacyActivityName));
+ startActivity(intent);
+
+ if (activity != null) {
+ activity.finish();
+ }
+ }
+
+ public static final BaseSearchIndexProvider SEARCH_INDEX_DATA_PROVIDER =
+ new BaseSearchIndexProvider(R.xml.advanced_privacy_dashboard_settings);
+}
\ No newline at end of file
--
2.34.1