Privacy Sandbox Settings: Split Android site settings
Split site settings into a content and a permissions section like on
Desktop.
Screenshot: https://crbug.com/1378703#c105
Bug: 1378703, b/254416343, b/254415965
Change-Id: Iaadf7a1b462ce4133bad25ca88fb296c4a2421e5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4069745
Commit-Queue: Christian Dullweber <dullweber@chromium.org>
Reviewed-by: Nicola Tommasi <tommasin@chromium.org>
Reviewed-by: Rubin Deliallisi <rubindl@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1082377}
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/site_settings/ChromeSiteSettingsDelegate.java b/chrome/android/java/src/org/chromium/chrome/browser/site_settings/ChromeSiteSettingsDelegate.java
index 7f42ca9..1994ef3 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/site_settings/ChromeSiteSettingsDelegate.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/site_settings/ChromeSiteSettingsDelegate.java
@@ -125,11 +125,6 @@
return ContentFeatureList.isEnabled(ContentFeatures.FED_CM);
case SiteSettingsCategory.Type.NFC:
return ContentFeatureList.isEnabled(ContentFeatureList.WEB_NFC);
- case SiteSettingsCategory.Type.COOKIES:
- return !isPrivacySandboxSettings4Enabled();
- case SiteSettingsCategory.Type.SITE_DATA:
- case SiteSettingsCategory.Type.THIRD_PARTY_COOKIES:
- return isPrivacySandboxSettings4Enabled();
default:
return true;
}
diff --git a/components/browser_ui/site_settings/android/BUILD.gn b/components/browser_ui/site_settings/android/BUILD.gn
index 2f6beee..77448e8 100644
--- a/components/browser_ui/site_settings/android/BUILD.gn
+++ b/components/browser_ui/site_settings/android/BUILD.gn
@@ -224,6 +224,7 @@
"java/res/xml/grouped_websites_preferences.xml",
"java/res/xml/single_website_preferences.xml",
"java/res/xml/site_settings_preferences.xml",
+ "java/res/xml/site_settings_preferences_with_categories.xml",
"java/res/xml/website_preferences.xml",
]
diff --git a/components/browser_ui/site_settings/android/java/res/xml/site_settings_preferences.xml b/components/browser_ui/site_settings/android/java/res/xml/site_settings_preferences.xml
index f771368..b2a404b 100644
--- a/components/browser_ui/site_settings/android/java/res/xml/site_settings_preferences.xml
+++ b/components/browser_ui/site_settings/android/java/res/xml/site_settings_preferences.xml
@@ -5,7 +5,11 @@
found in the LICENSE file.
-->
-<!-- The order of the following items is from: http://crbug.com/610358. -->
+<!--
+The order of the following items is from: http://crbug.com/610358.
+Used when PrivacySandboxSettingsV4 is disabled.
+Also add new settings to site_settings_preferences_with_categories.xml!
+-->
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<!-- All sites -->
@@ -15,20 +19,10 @@
android:title="@string/all_sites"
android:icon="@drawable/settings_all_sites"
app:iconTint="@macro/default_icon_color" />
- <!-- Cookies (PrivacySandboxSettings4 disabled) -->
+ <!-- Cookies -->
<org.chromium.components.browser_ui.settings.ChromeBasePreference
android:key="cookies"
android:fragment="org.chromium.components.browser_ui.site_settings.SingleCategorySettings" />
- <!-- Cookies (PrivacySandboxSettings4 enabled) -->
- <org.chromium.components.browser_ui.settings.ChromeBasePreference
- android:key="third_party_cookies"
- android:title="@string/third_party_cookies_page_title"
- android:icon="@drawable/permission_cookie"
- app:iconTint="@macro/default_icon_color"
- android:fragment="org.chromium.components.browser_ui.site_settings.SingleCategorySettings" />
- <org.chromium.components.browser_ui.settings.ChromeBasePreference
- android:key="site_data"
- android:fragment="org.chromium.components.browser_ui.site_settings.SingleCategorySettings" />
<!-- Location -->
<org.chromium.components.browser_ui.settings.ChromeBasePreference
android:fragment="org.chromium.components.browser_ui.site_settings.SingleCategorySettings"
@@ -78,7 +72,8 @@
android:fragment="org.chromium.components.browser_ui.site_settings.SingleCategorySettings"
android:key="sound" />
<!-- Storage -->
- <!-- TODO(finnur): Move this over to the new Usage screen, once it exists. -->
+ <!-- TODO(finnur): Move this over to the new Usage screen, once it exists.
+ Also update site_settings_preferences_with_categories.xml. -->
<org.chromium.components.browser_ui.settings.ChromeBasePreference
android:fragment="org.chromium.components.browser_ui.site_settings.AllSiteSettings"
android:key="use_storage"
@@ -126,7 +121,8 @@
android:fragment="org.chromium.components.browser_ui.site_settings.SingleCategorySettings"
android:key="auto_dark_web_content" />
<!-- Request Desktop Site -->
- <!-- TODO(crbug.com/1243758): Update the location of this setting once approved. -->
+ <!-- TODO(crbug.com/1243758): Update the location of this setting once approved.
+ Also update site_settings_preferences_with_categories.xml. -->
<org.chromium.components.browser_ui.settings.ChromeBasePreference
android:fragment="org.chromium.components.browser_ui.site_settings.SingleCategorySettings"
android:key="request_desktop_site" />
diff --git a/components/browser_ui/site_settings/android/java/res/xml/site_settings_preferences_with_categories.xml b/components/browser_ui/site_settings/android/java/res/xml/site_settings_preferences_with_categories.xml
new file mode 100644
index 0000000..9fa3886
--- /dev/null
+++ b/components/browser_ui/site_settings/android/java/res/xml/site_settings_preferences_with_categories.xml
@@ -0,0 +1,140 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+Copyright 2022 The Chromium Authors
+Use of this source code is governed by a BSD-style license that can be
+found in the LICENSE file.
+-->
+
+<!--
+The order of the following items is from: http://crbug.com/610358.
+Used when PrivacySandboxSettingsV4 is enabled.
+Also add new settings to site_settings_preferences.xml!
+-->
+<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:app="http://schemas.android.com/apk/res-auto">
+ <!-- All sites -->
+ <org.chromium.components.browser_ui.settings.ChromeBasePreference
+ android:fragment="org.chromium.components.browser_ui.site_settings.AllSiteSettings"
+ android:key="all_sites"
+ android:title="@string/all_sites"
+ android:icon="@drawable/settings_all_sites"
+ app:iconTint="@macro/default_icon_color" />
+
+ <PreferenceCategory android:title="@string/site_settings_permission_category"/>
+ <!-- Location -->
+ <org.chromium.components.browser_ui.settings.ChromeBasePreference
+ android:fragment="org.chromium.components.browser_ui.site_settings.SingleCategorySettings"
+ android:key="device_location" />
+ <!-- Camera -->
+ <org.chromium.components.browser_ui.settings.ChromeBasePreference
+ android:fragment="org.chromium.components.browser_ui.site_settings.SingleCategorySettings"
+ android:key="camera" />
+ <!-- Microphone -->
+ <org.chromium.components.browser_ui.settings.ChromeBasePreference
+ android:fragment="org.chromium.components.browser_ui.site_settings.SingleCategorySettings"
+ android:key="microphone" />
+ <!-- Sensors -->
+ <org.chromium.components.browser_ui.settings.ChromeBasePreference
+ android:fragment="org.chromium.components.browser_ui.site_settings.SingleCategorySettings"
+ android:key="sensors" />
+ <!-- Notifications -->
+ <org.chromium.components.browser_ui.settings.ChromeBasePreference
+ android:fragment="org.chromium.components.browser_ui.site_settings.SingleCategorySettings"
+ android:key="notifications" />
+ <!-- NFC -->
+ <org.chromium.components.browser_ui.settings.ChromeBasePreference
+ android:fragment="org.chromium.components.browser_ui.site_settings.SingleCategorySettings"
+ android:key="nfc" />
+ <!-- USB -->
+ <org.chromium.components.browser_ui.settings.ChromeBasePreference
+ android:fragment="org.chromium.components.browser_ui.site_settings.SingleCategorySettings"
+ android:key="usb" />
+ <!-- Clipboard API -->
+ <org.chromium.components.browser_ui.settings.ChromeBasePreference
+ android:fragment="org.chromium.components.browser_ui.site_settings.SingleCategorySettings"
+ android:key="clipboard" />
+ <!-- Bluetooth -->
+ <org.chromium.components.browser_ui.settings.ChromeBasePreference
+ android:fragment="org.chromium.components.browser_ui.site_settings.SingleCategorySettings"
+ android:key="bluetooth" />
+ <!-- Bluetooth Scanning -->
+ <org.chromium.components.browser_ui.settings.ChromeBasePreference
+ android:fragment="org.chromium.components.browser_ui.site_settings.SingleCategorySettings"
+ android:key="bluetooth_scanning" />
+ <!-- VR -->
+ <org.chromium.components.browser_ui.settings.ChromeBasePreference
+ android:fragment="org.chromium.components.browser_ui.site_settings.SingleCategorySettings"
+ android:key="virtual_reality" />
+ <!-- AR -->
+ <org.chromium.components.browser_ui.settings.ChromeBasePreference
+ android:fragment="org.chromium.components.browser_ui.site_settings.SingleCategorySettings"
+ android:key="augmented_reality" />
+ <!-- Idle Detection -->
+ <org.chromium.components.browser_ui.settings.ChromeBasePreference
+ android:fragment="org.chromium.components.browser_ui.site_settings.SingleCategorySettings"
+ android:key="idle_detection" />
+ <!-- Federated Identity API -->
+ <org.chromium.components.browser_ui.settings.ChromeBasePreference
+ android:fragment="org.chromium.components.browser_ui.site_settings.SingleCategorySettings"
+ android:key="federated_identity_api" />
+ <!-- Auto-dark Web Content -->
+ <org.chromium.components.browser_ui.settings.ChromeBasePreference
+ android:fragment="org.chromium.components.browser_ui.site_settings.SingleCategorySettings"
+ android:key="auto_dark_web_content" />
+ <!-- Request Desktop Site -->
+ <!-- TODO(crbug.com/1243758): Update the location of this setting once approved.
+ Also update site_settings_preferences.xml. -->
+ <org.chromium.components.browser_ui.settings.ChromeBasePreference
+ android:fragment="org.chromium.components.browser_ui.site_settings.SingleCategorySettings"
+ android:key="request_desktop_site" />
+
+ <PreferenceCategory android:title="@string/site_settings_content_category"/>
+ <!-- Third party cookies -->
+ <org.chromium.components.browser_ui.settings.ChromeBasePreference
+ android:key="third_party_cookies"
+ android:title="@string/third_party_cookies_page_title"
+ android:icon="@drawable/permission_cookie"
+ app:iconTint="@macro/default_icon_color"
+ android:fragment="org.chromium.components.browser_ui.site_settings.SingleCategorySettings" />
+ <!-- Site data -->
+ <org.chromium.components.browser_ui.settings.ChromeBasePreference
+ android:key="site_data"
+ android:fragment="org.chromium.components.browser_ui.site_settings.SingleCategorySettings" />
+ <!-- JavaScript -->
+ <org.chromium.components.browser_ui.settings.ChromeBasePreference
+ android:fragment="org.chromium.components.browser_ui.site_settings.SingleCategorySettings"
+ android:key="javascript" />
+ <!-- Popups -->
+ <org.chromium.components.browser_ui.settings.ChromeBasePreference
+ android:fragment="org.chromium.components.browser_ui.site_settings.SingleCategorySettings"
+ android:key="popups" />
+ <!-- Ads -->
+ <org.chromium.components.browser_ui.settings.ChromeBasePreference
+ android:fragment="org.chromium.components.browser_ui.site_settings.SingleCategorySettings"
+ android:key="ads" />
+ <!-- Background sync -->
+ <org.chromium.components.browser_ui.settings.ChromeBasePreference
+ android:fragment="org.chromium.components.browser_ui.site_settings.SingleCategorySettings"
+ android:key="background_sync" />
+ <!-- Automatic Downloads -->
+ <org.chromium.components.browser_ui.settings.ChromeBasePreference
+ android:fragment="org.chromium.components.browser_ui.site_settings.SingleCategorySettings"
+ android:key="automatic_downloads" />
+ <!-- Protected content -->
+ <org.chromium.components.browser_ui.settings.ChromeBasePreference
+ android:fragment="org.chromium.components.browser_ui.site_settings.SingleCategorySettings"
+ android:key="protected_content" />
+ <!-- Sound -->
+ <org.chromium.components.browser_ui.settings.ChromeBasePreference
+ android:fragment="org.chromium.components.browser_ui.site_settings.SingleCategorySettings"
+ android:key="sound" />
+ <!-- Storage -->
+ <!-- TODO(finnur): Move this over to the new Usage screen, once it exists.
+ Also update site_settings_preferences.xml. -->
+ <org.chromium.components.browser_ui.settings.ChromeBasePreference
+ android:fragment="org.chromium.components.browser_ui.site_settings.AllSiteSettings"
+ android:key="use_storage"
+ android:title="@string/website_settings_storage"
+ android:icon="@drawable/ic_storage"
+ app:iconTint="@macro/default_icon_color" />
+</PreferenceScreen>
diff --git a/components/browser_ui/site_settings/android/java/src/org/chromium/components/browser_ui/site_settings/SiteSettings.java b/components/browser_ui/site_settings/android/java/src/org/chromium/components/browser_ui/site_settings/SiteSettings.java
index 5a5616e..9db7953 100644
--- a/components/browser_ui/site_settings/android/java/src/org/chromium/components/browser_ui/site_settings/SiteSettings.java
+++ b/components/browser_ui/site_settings/android/java/src/org/chromium/components/browser_ui/site_settings/SiteSettings.java
@@ -30,7 +30,10 @@
@Override
public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {
- SettingsUtils.addPreferencesFromResource(this, R.xml.site_settings_preferences);
+ SettingsUtils.addPreferencesFromResource(this,
+ getSiteSettingsDelegate().isPrivacySandboxSettings4Enabled()
+ ? R.xml.site_settings_preferences_with_categories
+ : R.xml.site_settings_preferences);
getActivity().setTitle(getContext().getString(R.string.prefs_site_settings));
configurePreferences();
diff --git a/components/browser_ui/strings/android/site_settings.grdp b/components/browser_ui/strings/android/site_settings.grdp
index b981f132..cf597187 100644
--- a/components/browser_ui/strings/android/site_settings.grdp
+++ b/components/browser_ui/strings/android/site_settings.grdp
@@ -5,6 +5,13 @@
Site settings
</message>
+ <message name="IDS_SITE_SETTINGS_PERMISSION_CATEGORY" desc="Title permissions section in site settings. [CHAR_LIMIT=32]">
+ Permissions
+ </message>
+ <message name="IDS_SITE_SETTINGS_CONTENT_CATEGORY" desc="Title content settings section in site settings. [CHAR_LIMIT=32]">
+ Content
+ </message>
+
<!-- Site settings categories -->
<message name="IDS_ALL_SITES" desc='Title of the "All sites" settings screen that allows the user to see permissions for all websites. [CHAR_LIMIT=32]'>
All sites
diff --git a/components/browser_ui/strings/android/site_settings_grdp/IDS_SITE_SETTINGS_CONTENT_CATEGORY.png.sha1 b/components/browser_ui/strings/android/site_settings_grdp/IDS_SITE_SETTINGS_CONTENT_CATEGORY.png.sha1
new file mode 100644
index 0000000..25de86af
--- /dev/null
+++ b/components/browser_ui/strings/android/site_settings_grdp/IDS_SITE_SETTINGS_CONTENT_CATEGORY.png.sha1
@@ -0,0 +1 @@
+0502b55f7f7167adaf690dcdd0a681730dc2ddb5
\ No newline at end of file
diff --git a/components/browser_ui/strings/android/site_settings_grdp/IDS_SITE_SETTINGS_PERMISSION_CATEGORY.png.sha1 b/components/browser_ui/strings/android/site_settings_grdp/IDS_SITE_SETTINGS_PERMISSION_CATEGORY.png.sha1
new file mode 100644
index 0000000..38f48a77
--- /dev/null
+++ b/components/browser_ui/strings/android/site_settings_grdp/IDS_SITE_SETTINGS_PERMISSION_CATEGORY.png.sha1
@@ -0,0 +1 @@
+8fdebe5b6a5e148466ee059a047cc9f17371cab3
\ No newline at end of file