[cr147][Android] Changes for advanced protection setting

Chromium changes:
https://chromium.googlesource.com/chromium/src/+/19b12eb71387041c442d1bf1dc9c98366f255ab7

commit 19b12eb71387041c442d1bf1dc9c98366f255ab7
Author: Liz Prucka <lizprucka@google.com>
Date:   Wed Feb 11 08:16:24 2026 -0800

    Upstreaming Clank OsAdditionalSecurityPermissionProviderImpl

    Upstreaming Advanced Protection provider class in Chrome components to
    allow for implementation across Chrome components and use in public apk.

    Separating browser messenger components in
    OsAdditionalSecurityPermissionProviderImpl.java to allow for inclusion
    of only core features in WebView.

    Updated AdvancedProtectionMediatorTest to use application context to
    fix resource loading errors in mock.

    Removed IDS_ADVANCED_PROTECTION_MESSAGE_DISABLE_TITLE as it is no longer
    used.

    Created placeholder translation templates for new safe_browsing [grd
    file](https://chromium.googlesource.com/website/+/HEAD/site/developers/design-documents/ui-localization/index.md#add-a-new-grd_p_file).

    Bug: 477677919
    Change-Id: I4944734152979ee99e2a577b0d36af12b968fc2e
    Bypass-Check-License: Moved OsAdditionalSecurityProvider files
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7486643
    Reviewed-by: Ravjit Uppal <ravjit@chromium.org>
    Reviewed-by: Calder Kitagawa <ckitagawa@chromium.org>
    Commit-Queue: Liz Prucka <lizprucka@google.com>
    Cr-Commit-Position: refs/heads/main@{#1583249}
This commit is contained in:
Artem Samoilenko
2026-03-26 19:25:19 -04:00
committed by Max Karolinskiy
parent 46f796f64a
commit 94cb2017fe
2 changed files with 30 additions and 2 deletions
@@ -42,6 +42,7 @@ import org.chromium.chrome.browser.preferences.website.BraveShieldsContentSettin
import org.chromium.chrome.browser.profiles.Profile;
import org.chromium.chrome.browser.profiles.ProfileManager;
import org.chromium.chrome.browser.safe_browsing.settings.NoGooglePlayServicesDialog;
import org.chromium.chrome.browser.safety_hub.SafetyHubExpandablePreference;
import org.chromium.chrome.browser.settings.BraveDialogPreference;
import org.chromium.chrome.browser.settings.BravePreferenceDialogFragment;
import org.chromium.chrome.browser.settings.BraveWebrtcPolicyPreference;
@@ -92,6 +93,7 @@ public class BravePrivacySettings extends PrivacySettings {
private static final String PREF_PRIVACY_GUIDE = "privacy_guide";
private static final String PREF_JAVASCRIPT_OPTIMIZER = "javascript_optimizer";
private static final String PREF_PASSWORD_LEAK_DETECTION = "password_leak_detection";
private static final String PREF_ADVANCED_PROTECTION_INFO = "advanced_protection_info";
// brave Prefs
private static final String PREF_BRAVE_SHIELDS_GLOBALS_SECTION =
@@ -170,9 +172,9 @@ public class BravePrivacySettings extends PrivacySettings {
PREF_SOCIAL_BLOCKING_TWITTER,
PREF_SOCIAL_BLOCKING_LINKEDIN,
PREF_OTHER_PRIVACY_SETTINGS_SECTION, // other section
PREF_SAFE_BROWSING,
PREF_APP_LINKS,
PREF_WEBRTC_POLICY,
PREF_SAFE_BROWSING,
PREF_INCOGNITO_SCREENSHOT,
PREF_INCOGNITO_LOCK,
PREF_CAN_MAKE_PAYMENT,
@@ -190,8 +192,10 @@ public class BravePrivacySettings extends PrivacySettings {
PREF_SEND_CRASH_REPORTS,
PREF_BRAVE_STATS_USAGE_PING,
PREF_SURVEY_PANELIST,
PREF_SURVEY_PANELIST_LEARN_MORE,
PREF_USAGE_STATS,
PREF_PRIVACY_SANDBOX
PREF_PRIVACY_SANDBOX,
PREF_ADVANCED_PROTECTION_INFO,
};
private static final int STRICT = 0;
@@ -262,6 +266,8 @@ public class BravePrivacySettings extends PrivacySettings {
public void onCreatePreferences(@Nullable Bundle savedInstanceState, @Nullable String rootKey) {
super.onCreatePreferences(savedInstanceState, rootKey);
setupAdvancedProtectionInfoPreference();
mBravePageTitle.set(getString(R.string.brave_shields_and_privacy));
SettingsUtils.addPreferencesFromResource(this, R.xml.brave_privacy_preferences);
@@ -974,6 +980,16 @@ public class BravePrivacySettings extends PrivacySettings {
}
}
private void setupAdvancedProtectionInfoPreference() {
SafetyHubExpandablePreference advancedProtectionInfo =
findPreference(PREF_ADVANCED_PROTECTION_INFO);
if (advancedProtectionInfo == null) return;
// Clear the Google's shield icon and remove reserved icon space.
advancedProtectionInfo.setIcon(null);
advancedProtectionInfo.setSelectable(false);
}
private void updateRequestOtrPref() {
int requestOtrPrefValue =
UserPrefs.get(ProfileManager.getLastUsedRegularProfile())
@@ -0,0 +1,12 @@
diff --git a/chrome/browser/safety_hub/android/java/res/layout/safety_hub_expandable_preference.xml b/chrome/browser/safety_hub/android/java/res/layout/safety_hub_expandable_preference.xml
index 5fbdaf2b7e1d11c59ea29a3fdb73388389e38163..6d344c84136b601932d6914bfc4bb11b5ca88a1f 100644
--- a/chrome/browser/safety_hub/android/java/res/layout/safety_hub_expandable_preference.xml
+++ b/chrome/browser/safety_hub/android/java/res/layout/safety_hub_expandable_preference.xml
@@ -77,6 +77,7 @@ found in the LICENSE file.
android:layout_width="32dp"
android:layout_height="32dp"
android:scaleType="center"
+ android:visibility="gone"
android:layout_alignParentEnd="true"
android:layout_alignParentTop="true"/>
</RelativeLayout>