Android settings search indexes (#34576)
Added support for search indexes for Brave preferences fragments
This commit is contained in:
@@ -53,7 +53,7 @@
|
||||
android:order="2"
|
||||
android:title="@string/prefs_section_features"/>
|
||||
<org.chromium.components.browser_ui.settings.ChromeBasePreference
|
||||
android:fragment="org.chromium.chrome.browser.privacy.BravePrivacySettings"
|
||||
android:fragment="org.chromium.chrome.browser.privacy.settings.BravePrivacySettings"
|
||||
android:key="brave_shields_and_privacy"
|
||||
android:icon="@drawable/ic_shield_done"
|
||||
android:order="1"
|
||||
|
||||
+59
@@ -45,16 +45,22 @@ import org.chromium.chrome.browser.preferences.Pref;
|
||||
import org.chromium.chrome.browser.profiles.Profile;
|
||||
import org.chromium.chrome.browser.settings.ChromeBaseSettingsFragment;
|
||||
import org.chromium.chrome.browser.settings.ChromeManagedPreferenceDelegate;
|
||||
import org.chromium.chrome.browser.settings.MainSettings;
|
||||
import org.chromium.chrome.browser.settings.search.ChromeBaseSearchIndexProvider;
|
||||
import org.chromium.components.browser_ui.settings.ChromeSwitchPreference;
|
||||
import org.chromium.components.browser_ui.settings.SearchUtils;
|
||||
import org.chromium.components.browser_ui.settings.SearchViewProvider;
|
||||
import org.chromium.components.browser_ui.settings.SettingsFragment.AnimationType;
|
||||
import org.chromium.components.browser_ui.settings.SettingsUtils;
|
||||
import org.chromium.components.browser_ui.settings.TextMessagePreference;
|
||||
import org.chromium.components.browser_ui.settings.search.PreferenceParser;
|
||||
import org.chromium.components.browser_ui.settings.search.SearchIndexProvider;
|
||||
import org.chromium.components.browser_ui.settings.search.SettingsIndexData;
|
||||
import org.chromium.components.prefs.PrefService;
|
||||
import org.chromium.components.user_prefs.UserPrefs;
|
||||
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* The "Passwords" screen in Settings, which allows the user to enable or disable password saving,
|
||||
@@ -98,6 +104,8 @@ public class PasswordSettings extends ChromeBaseSettingsFragment
|
||||
// Unique request code for the password importing activity.
|
||||
private static final int PASSWORD_IMPORT_INTENT_REQUEST_CODE = 3485765;
|
||||
|
||||
private static final String PREF_PASSWORDS = "passwords";
|
||||
|
||||
private boolean mNoPasswords;
|
||||
private boolean mNoPasswordExceptions;
|
||||
|
||||
@@ -728,4 +736,55 @@ public class PasswordSettings extends ChromeBaseSettingsFragment
|
||||
public @AnimationType int getAnimationType() {
|
||||
return AnimationType.PROPERTY;
|
||||
}
|
||||
|
||||
public static final ChromeBaseSearchIndexProvider SEARCH_INDEX_DATA_PROVIDER =
|
||||
new ChromeBaseSearchIndexProvider(
|
||||
PasswordSettings.class.getName(), R.xml.brave_password_settings_preferences) {
|
||||
|
||||
@Override
|
||||
public Bundle getExtras() {
|
||||
Bundle extras = new Bundle();
|
||||
extras.putInt(
|
||||
BravePasswordManagerHelper.MANAGE_PASSWORDS_REFERRER,
|
||||
ManagePasswordsReferrer.CHROME_SETTINGS);
|
||||
return extras;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initPreferenceXml(
|
||||
Context context,
|
||||
Profile profile,
|
||||
SettingsIndexData indexData,
|
||||
Map<String, SearchIndexProvider> providerMap) {
|
||||
super.initPreferenceXml(context, profile, indexData, providerMap);
|
||||
// The "passwords" entry in main_preferences.xml uses BravePasswordsPreference
|
||||
// (a custom class) with no android:fragment attribute, so the normal
|
||||
// child-parent link is never established via XML parsing. Register it manually
|
||||
// so resolveIndex() does not treat PasswordSettings entries as orphans.
|
||||
String parentId =
|
||||
PreferenceParser.createUniqueId(
|
||||
MainSettings.class.getName(), PREF_PASSWORDS);
|
||||
indexData.addChildParentLink(PasswordSettings.class.getName(), parentId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateDynamicPreferences(
|
||||
Context context, SettingsIndexData indexData, Profile profile) {
|
||||
String frag = PasswordSettings.class.getName();
|
||||
if (DeviceInfo.isAutomotive()) {
|
||||
indexData.removeEntryForKey(frag, PREF_AUTOSIGNIN_SWITCH);
|
||||
}
|
||||
if (!ExportFlow.providesPasswordExport()) {
|
||||
indexData.removeEntryForKey(frag, PREF_EXPORT_PASSWORDS);
|
||||
}
|
||||
if (indexData.getEntryForKey(frag, PREF_SAVE_PASSWORDS_SWITCH) != null) {
|
||||
boolean saveEnabled =
|
||||
UserPrefs.get(profile).getBoolean(Pref.CREDENTIALS_ENABLE_SERVICE);
|
||||
indexData.updateEntrySummaryForKey(
|
||||
frag,
|
||||
PREF_SAVE_PASSWORDS_SWITCH,
|
||||
saveEnabled ? R.string.text_on : R.string.text_off);
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
+45
@@ -5,6 +5,7 @@
|
||||
|
||||
package org.chromium.chrome.browser.playlist.settings;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
|
||||
import androidx.preference.Preference;
|
||||
@@ -12,6 +13,7 @@ import androidx.preference.Preference;
|
||||
import com.brave.playlist.local_database.PlaylistRepository;
|
||||
import com.brave.playlist.util.PlaylistPreferenceUtils;
|
||||
|
||||
import org.chromium.base.BraveFeatureList;
|
||||
import org.chromium.base.BravePreferenceKeys;
|
||||
import org.chromium.base.supplier.MonotonicObservableSupplier;
|
||||
import org.chromium.base.supplier.ObservableSuppliers;
|
||||
@@ -20,11 +22,15 @@ import org.chromium.base.task.PostTask;
|
||||
import org.chromium.base.task.TaskTraits;
|
||||
import org.chromium.chrome.R;
|
||||
import org.chromium.chrome.browser.BraveRelaunchUtils;
|
||||
import org.chromium.chrome.browser.flags.ChromeFeatureList;
|
||||
import org.chromium.chrome.browser.playlist.PlaylistServiceFactoryAndroid;
|
||||
import org.chromium.chrome.browser.preferences.ChromeSharedPreferences;
|
||||
import org.chromium.chrome.browser.settings.BravePreferenceFragment;
|
||||
import org.chromium.chrome.browser.settings.MainSettings;
|
||||
import org.chromium.components.browser_ui.settings.ChromeSwitchPreference;
|
||||
import org.chromium.components.browser_ui.settings.SettingsUtils;
|
||||
import org.chromium.components.browser_ui.settings.search.BaseSearchIndexProvider;
|
||||
import org.chromium.components.browser_ui.settings.search.SettingsIndexData;
|
||||
import org.chromium.mojo.bindings.ConnectionErrorHandler;
|
||||
import org.chromium.mojo.system.MojoException;
|
||||
import org.chromium.playlist.mojom.PlaylistService;
|
||||
@@ -40,6 +46,8 @@ public class BravePlaylistPreferences extends BravePreferenceFragment
|
||||
|
||||
private PlaylistService mPlaylistService;
|
||||
|
||||
private static final String PREF_BRAVE_PLAYLIST = "brave_playlist";
|
||||
|
||||
private final SettableMonotonicObservableSupplier<String> mPageTitle =
|
||||
ObservableSuppliers.createMonotonic();
|
||||
|
||||
@@ -148,6 +156,43 @@ public class BravePlaylistPreferences extends BravePreferenceFragment
|
||||
return true;
|
||||
}
|
||||
|
||||
public static final BaseSearchIndexProvider SEARCH_INDEX_DATA_PROVIDER =
|
||||
new BaseSearchIndexProvider(
|
||||
BravePlaylistPreferences.class.getName(), R.xml.brave_playlist_preferences) {
|
||||
|
||||
@Override
|
||||
public void updateDynamicPreferences(Context context, SettingsIndexData indexData) {
|
||||
String frag = BravePlaylistPreferences.class.getName();
|
||||
if (!ChromeFeatureList.isEnabled(BraveFeatureList.BRAVE_PLAYLIST)) {
|
||||
indexData.removeEntryForKey(
|
||||
MainSettings.class.getName(), PREF_BRAVE_PLAYLIST);
|
||||
indexData.removeEntryForKey(frag, BravePreferenceKeys.PREF_ENABLE_PLAYLIST);
|
||||
indexData.removeEntryForKey(
|
||||
frag, BravePreferenceKeys.PREF_ADD_TO_PLAYLIST_BUTTON);
|
||||
indexData.removeEntryForKey(
|
||||
frag, BravePreferenceKeys.PREF_REMEMBER_FILE_PLAYBACK_POSITION);
|
||||
indexData.removeEntryForKey(
|
||||
frag, BravePreferenceKeys.PREF_REMEMBER_LIST_PLAYBACK_POSITION);
|
||||
indexData.removeEntryForKey(
|
||||
frag, BravePreferenceKeys.PREF_CONTINUOUS_LISTENING);
|
||||
indexData.removeEntryForKey(frag, BravePreferenceKeys.PREF_RESET_PLAYLIST);
|
||||
return;
|
||||
}
|
||||
if (!ChromeSharedPreferences.getInstance()
|
||||
.readBoolean(BravePreferenceKeys.PREF_ENABLE_PLAYLIST, true)) {
|
||||
indexData.removeEntryForKey(
|
||||
frag, BravePreferenceKeys.PREF_ADD_TO_PLAYLIST_BUTTON);
|
||||
indexData.removeEntryForKey(
|
||||
frag, BravePreferenceKeys.PREF_REMEMBER_FILE_PLAYBACK_POSITION);
|
||||
indexData.removeEntryForKey(
|
||||
frag, BravePreferenceKeys.PREF_REMEMBER_LIST_PLAYBACK_POSITION);
|
||||
indexData.removeEntryForKey(
|
||||
frag, BravePreferenceKeys.PREF_CONTINUOUS_LISTENING);
|
||||
indexData.removeEntryForKey(frag, BravePreferenceKeys.PREF_RESET_PLAYLIST);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
private void updatePlaylistSettingsState(boolean isPlaylistEnabled) {
|
||||
if (isPlaylistEnabled) {
|
||||
if (mAddToPlaylistButtonSwitch != null) {
|
||||
|
||||
@@ -7,6 +7,7 @@ package org.chromium.chrome.browser.privacy.settings;
|
||||
|
||||
import static org.chromium.build.NullUtil.assumeNonNull;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.text.SpannableString;
|
||||
import android.text.style.ForegroundColorSpan;
|
||||
@@ -38,11 +39,13 @@ import org.chromium.chrome.browser.preferences.BravePrefServiceBridge;
|
||||
import org.chromium.chrome.browser.preferences.ChromeSharedPreferences;
|
||||
import org.chromium.chrome.browser.preferences.Pref;
|
||||
import org.chromium.chrome.browser.preferences.website.BraveShieldsContentSettings;
|
||||
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.settings.BraveDialogPreference;
|
||||
import org.chromium.chrome.browser.settings.BravePreferenceDialogFragment;
|
||||
import org.chromium.chrome.browser.settings.BraveWebrtcPolicyPreference;
|
||||
import org.chromium.chrome.browser.settings.search.ChromeBaseSearchIndexProvider;
|
||||
import org.chromium.chrome.browser.shields.FilterListServiceFactory;
|
||||
import org.chromium.chrome.browser.util.TabUtils;
|
||||
import org.chromium.chrome.browser.webcompat_reporter.WebcompatReporterServiceFactory;
|
||||
@@ -51,6 +54,7 @@ import org.chromium.components.browser_ui.settings.ChromeSwitchPreference;
|
||||
import org.chromium.components.browser_ui.settings.ClickableSpansTextMessagePreference;
|
||||
import org.chromium.components.browser_ui.settings.SettingsUtils;
|
||||
import org.chromium.components.browser_ui.settings.TextMessagePreference;
|
||||
import org.chromium.components.browser_ui.settings.search.SettingsIndexData;
|
||||
import org.chromium.components.user_prefs.UserPrefs;
|
||||
import org.chromium.gms.ChromiumPlayServicesAvailability;
|
||||
import org.chromium.ui.text.ChromeClickableSpan;
|
||||
@@ -1015,6 +1019,179 @@ public class BravePrivacySettings extends PrivacySettings {
|
||||
return "";
|
||||
}
|
||||
|
||||
public static final ChromeBaseSearchIndexProvider SEARCH_INDEX_DATA_PROVIDER =
|
||||
new ChromeBaseSearchIndexProvider(
|
||||
BravePrivacySettings.class.getName(), R.xml.brave_privacy_preferences) {
|
||||
|
||||
@Override
|
||||
public void updateDynamicPreferences(
|
||||
Context context, SettingsIndexData indexData, Profile profile) {
|
||||
String frag = BravePrivacySettings.class.getName();
|
||||
|
||||
// Feature-gated removals
|
||||
if (!ChromeFeatureList.isEnabled(BraveFeatureList.DEBOUNCE)) {
|
||||
indexData.removeEntryForKey(frag, PREF_DEBOUNCE);
|
||||
}
|
||||
if (!ChromeFeatureList.isEnabled(
|
||||
BraveFeatureList.BRAVE_FORGET_FIRST_PARTY_STORAGE)
|
||||
|| ChromeFeatureList.isEnabled(BraveFeatureList.BRAVE_SHRED)) {
|
||||
indexData.removeEntryForKey(frag, PREF_FORGET_FIRST_PARTY_STORAGE);
|
||||
}
|
||||
if (!ChromeFeatureList.isEnabled(BraveFeatureList.BRAVE_SHRED)) {
|
||||
indexData.removeEntryForKey(frag, PREF_AUTO_SHRED_STORAGE);
|
||||
}
|
||||
if (!ChromeFeatureList.isEnabled(
|
||||
BraveFeatureList.BRAVE_SHIELDS_ELEMENT_PICKER)) {
|
||||
indexData.removeEntryForKey(
|
||||
frag, PREF_ALLOW_ELEMENTS_BLOCKING_ON_PRIVATE_TABS);
|
||||
}
|
||||
if (!ChromeFeatureList.isEnabled(
|
||||
BraveFeatureList.BRAVE_NTP_BRANDED_WALLPAPER_SURVEY_PANELIST)) {
|
||||
indexData.removeEntryForKey(frag, PREF_SURVEY_PANELIST);
|
||||
}
|
||||
if (ChromeFeatureList.isEnabled(
|
||||
BraveFeatureList.BRAVE_GOOGLE_SIGN_IN_PERMISSION)) {
|
||||
indexData.removeEntryForKey(frag, PREF_SOCIAL_BLOCKING_GOOGLE);
|
||||
}
|
||||
if (!ChromeFeatureList.isEnabled(BraveFeatureList.BRAVE_REQUEST_OTR_TAB)) {
|
||||
indexData.removeEntryForKey(frag, PREF_REQUEST_OTR);
|
||||
}
|
||||
|
||||
boolean showStrictFingerprinting =
|
||||
ChromeFeatureList.isEnabled(
|
||||
BraveFeatureList.BRAVE_SHOW_STRICT_FINGERPRINTING_MODE);
|
||||
if (!showStrictFingerprinting) {
|
||||
indexData.removeEntryForKey(frag, PREF_FINGERPRINTING_PROTECTION);
|
||||
} else {
|
||||
indexData.removeEntryForKey(frag, PREF_FINGERPRINTING_PROTECTION2);
|
||||
}
|
||||
|
||||
boolean httpsByDefault =
|
||||
ChromeFeatureList.isEnabled(BraveFeatureList.HTTPS_BY_DEFAULT);
|
||||
if (!httpsByDefault) {
|
||||
indexData.removeEntryForKey(frag, PREF_HTTPS_UPGRADE);
|
||||
}
|
||||
|
||||
// Policy-based removals
|
||||
if (BraveWalletPolicy.isDisabledByPolicy(profile)) {
|
||||
indexData.removeEntryForKey(frag, PREF_UNSTOPPABLE_DOMAINS);
|
||||
indexData.removeEntryForKey(frag, PREF_ENS);
|
||||
indexData.removeEntryForKey(frag, PREF_SNS);
|
||||
}
|
||||
if (BraveLocalState.get().isManagedPreference(BravePref.P3A_ENABLED)) {
|
||||
indexData.removeEntryForKey(frag, PREF_SEND_P3A);
|
||||
}
|
||||
if (!PrivacyPreferencesManagerImpl.getInstance()
|
||||
.isUsageAndCrashReportingPermittedByPolicy()) {
|
||||
indexData.removeEntryForKey(frag, PREF_SEND_CRASH_REPORTS);
|
||||
}
|
||||
if (BraveLocalState.get()
|
||||
.isManagedPreference(BravePref.STATS_REPORTING_ENABLED)) {
|
||||
indexData.removeEntryForKey(frag, PREF_BRAVE_STATS_USAGE_PING);
|
||||
}
|
||||
|
||||
// Dynamic summaries for dialog prefs
|
||||
String trackersPref = BraveShieldsContentSettings.getTrackersPref();
|
||||
int trackersSummaryId = R.string.block_trackers_ads_option_2;
|
||||
if (trackersPref.equals(BraveShieldsContentSettings.BLOCK_RESOURCE)) {
|
||||
trackersSummaryId = R.string.block_trackers_ads_option_1;
|
||||
} else if (trackersPref.equals(BraveShieldsContentSettings.ALLOW_RESOURCE)) {
|
||||
trackersSummaryId = R.string.block_trackers_ads_option_3;
|
||||
}
|
||||
indexData.updateEntrySummaryForKey(
|
||||
frag, PREF_BLOCK_TRACKERS_ADS, trackersSummaryId);
|
||||
|
||||
int cookiesPref =
|
||||
ChromeSharedPreferences.getInstance()
|
||||
.readInt(PREF_BLOCK_CROSS_SITE_COOKIES, STANDARD);
|
||||
int cookiesSummaryId = R.string.block_cookies_option_2;
|
||||
if (cookiesPref == STRICT) {
|
||||
cookiesSummaryId = R.string.block_cookies_option_1;
|
||||
} else if (cookiesPref == ALLOW) {
|
||||
cookiesSummaryId = R.string.block_cookies_option_3;
|
||||
}
|
||||
indexData.updateEntrySummaryForKey(
|
||||
frag, PREF_BLOCK_CROSS_SITE_COOKIES, cookiesSummaryId);
|
||||
|
||||
if (showStrictFingerprinting) {
|
||||
String fpPref = BraveShieldsContentSettings.getFingerprintingPref();
|
||||
int fpSummaryId = R.string.block_fingerprinting_option_2;
|
||||
if (fpPref.equals(BraveShieldsContentSettings.BLOCK_RESOURCE)) {
|
||||
fpSummaryId = R.string.block_fingerprinting_option_1;
|
||||
} else if (fpPref.equals(BraveShieldsContentSettings.ALLOW_RESOURCE)) {
|
||||
fpSummaryId = R.string.block_fingerprinting_option_3;
|
||||
}
|
||||
indexData.updateEntrySummaryForKey(
|
||||
frag, PREF_FINGERPRINTING_PROTECTION, fpSummaryId);
|
||||
}
|
||||
|
||||
if (httpsByDefault) {
|
||||
String httpsUpgradePref = BraveShieldsContentSettings.getHttpsUpgradePref();
|
||||
int httpsSummaryId = R.string.https_upgrade_option_2;
|
||||
if (httpsUpgradePref.equals(BraveShieldsContentSettings.BLOCK_RESOURCE)) {
|
||||
httpsSummaryId = R.string.https_upgrade_option_1;
|
||||
} else if (httpsUpgradePref.equals(
|
||||
BraveShieldsContentSettings.ALLOW_RESOURCE)) {
|
||||
httpsSummaryId = R.string.https_upgrade_option_3;
|
||||
}
|
||||
indexData.updateEntrySummaryForKey(
|
||||
frag, PREF_HTTPS_UPGRADE, httpsSummaryId);
|
||||
}
|
||||
|
||||
if (ChromeFeatureList.isEnabled(BraveFeatureList.BRAVE_SHRED)) {
|
||||
String autoShredPref = BraveShieldsContentSettings.getAutoShredPref();
|
||||
int autoShredSummaryId = R.string.brave_shields_auto_shred_never_mode_text;
|
||||
if (autoShredPref.equals(
|
||||
BraveShieldsContentSettings.AUTO_SHRED_MODE_LAST_TAB_CLOSED)) {
|
||||
autoShredSummaryId =
|
||||
R.string.brave_shields_auto_shred_site_tab_closed_mode_text;
|
||||
} else if (autoShredPref.equals(
|
||||
BraveShieldsContentSettings.AUTO_SHRED_MODE_APP_EXIT)) {
|
||||
autoShredSummaryId =
|
||||
R.string.brave_shields_auto_shred_app_close_mode_text;
|
||||
}
|
||||
indexData.updateEntrySummaryForKey(
|
||||
frag, PREF_AUTO_SHRED_STORAGE, autoShredSummaryId);
|
||||
}
|
||||
|
||||
if (ChromeFeatureList.isEnabled(BraveFeatureList.BRAVE_REQUEST_OTR_TAB)) {
|
||||
int requestOtrPref =
|
||||
UserPrefs.get(profile)
|
||||
.getInteger(BravePref.REQUEST_OTR_ACTION_OPTION);
|
||||
int requestOtrSummaryId = R.string.request_otr_option_2;
|
||||
if (requestOtrPref == BraveShieldsContentSettings.ALWAYS) {
|
||||
requestOtrSummaryId = R.string.request_otr_option_1;
|
||||
} else if (requestOtrPref == BraveShieldsContentSettings.NEVER) {
|
||||
requestOtrSummaryId = R.string.request_otr_option_3;
|
||||
}
|
||||
indexData.updateEntrySummaryForKey(
|
||||
frag, PREF_REQUEST_OTR, requestOtrSummaryId);
|
||||
}
|
||||
|
||||
int webrtcPolicy = BravePrefServiceBridge.getInstance().getWebrtcPolicy();
|
||||
int webrtcSummaryId;
|
||||
switch (webrtcPolicy) {
|
||||
case BraveWebrtcPolicyPreference.WebrtcPolicy
|
||||
.DEFAULT_PUBLIC_AND_PRIVATE_INTERFACES:
|
||||
webrtcSummaryId =
|
||||
R.string
|
||||
.settings_webrtc_policy_default_public_and_private_interfaces; // presubmit: ignore-long-line
|
||||
break;
|
||||
case BraveWebrtcPolicyPreference.WebrtcPolicy.DEFAULT_PUBLIC_INTERFACE_ONLY:
|
||||
webrtcSummaryId =
|
||||
R.string.settings_webrtc_policy_default_public_interface_only;
|
||||
break;
|
||||
case BraveWebrtcPolicyPreference.WebrtcPolicy.DISABLE_NON_PROXIED_UDP:
|
||||
webrtcSummaryId =
|
||||
R.string.settings_webrtc_policy_disable_non_proxied_udp;
|
||||
break;
|
||||
default:
|
||||
webrtcSummaryId = R.string.settings_webrtc_policy_default;
|
||||
}
|
||||
indexData.updateEntrySummaryForKey(frag, PREF_WEBRTC_POLICY, webrtcSummaryId);
|
||||
}
|
||||
};
|
||||
|
||||
@Override
|
||||
public MonotonicObservableSupplier<String> getPageTitle() {
|
||||
return mBravePageTitle;
|
||||
|
||||
@@ -16,6 +16,7 @@ import org.chromium.base.supplier.SettableMonotonicObservableSupplier;
|
||||
import org.chromium.chrome.R;
|
||||
import org.chromium.chrome.browser.brave_leo.BraveLeoMojomHelper;
|
||||
import org.chromium.components.browser_ui.settings.SettingsUtils;
|
||||
import org.chromium.components.browser_ui.settings.search.BaseSearchIndexProvider;
|
||||
|
||||
public class BraveLeoDefaultModelPreferences extends BravePreferenceFragment
|
||||
implements BraveLeoRadioButtonGroupDefaultModelPreference.RadioButtonsDelegate {
|
||||
@@ -60,4 +61,11 @@ public class BraveLeoDefaultModelPreferences extends BravePreferenceFragment
|
||||
public void setDefaultModel(String key) {
|
||||
BraveLeoMojomHelper.getInstance(getProfile()).setDefaultModelKey(key);
|
||||
}
|
||||
|
||||
// The sub-screen only contains a dynamically-populated radio button group (model choices are
|
||||
// runtime data, not static settings), so there is nothing to index.
|
||||
public static final BaseSearchIndexProvider SEARCH_INDEX_DATA_PROVIDER =
|
||||
new BaseSearchIndexProvider(
|
||||
BraveLeoDefaultModelPreferences.class.getName(),
|
||||
BaseSearchIndexProvider.INDEX_OPT_OUT);
|
||||
}
|
||||
|
||||
@@ -36,6 +36,8 @@ import org.chromium.chrome.browser.util.TabUtils;
|
||||
import org.chromium.components.browser_ui.settings.ChromeBasePreference;
|
||||
import org.chromium.components.browser_ui.settings.ChromeSwitchPreference;
|
||||
import org.chromium.components.browser_ui.settings.SettingsUtils;
|
||||
import org.chromium.components.browser_ui.settings.search.BaseSearchIndexProvider;
|
||||
import org.chromium.components.browser_ui.settings.search.SettingsIndexData;
|
||||
|
||||
public class BraveLeoPreferences extends BravePreferenceFragment
|
||||
implements Preference.OnPreferenceChangeListener {
|
||||
@@ -219,4 +221,22 @@ public class BraveLeoPreferences extends BravePreferenceFragment
|
||||
setModel();
|
||||
checkLinkPurchase();
|
||||
}
|
||||
|
||||
public static final BaseSearchIndexProvider SEARCH_INDEX_DATA_PROVIDER =
|
||||
new BaseSearchIndexProvider(
|
||||
BraveLeoPreferences.class.getName(), R.xml.brave_leo_preferences) {
|
||||
|
||||
@Override
|
||||
public void updateDynamicPreferences(Context context, SettingsIndexData indexData) {
|
||||
String frag = BraveLeoPreferences.class.getName();
|
||||
// Subscription prefs are hidden by default and shown only at runtime based
|
||||
// on subscription state; exclude them from the search index.
|
||||
indexData.removeEntryForKey(frag, PREF_LINK_SUBSCRIPTION);
|
||||
indexData.removeEntryForKey(frag, PREF_MANAGE_SUBSCRIPTION);
|
||||
indexData.removeEntryForKey(frag, PREF_GO_PREMIUM);
|
||||
if (!ChromeFeatureList.isEnabled(BraveFeatureList.AI_CHAT_HISTORY)) {
|
||||
indexData.removeEntryForKey(frag, PREF_HISTORY);
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@@ -14,6 +14,7 @@ import org.chromium.base.supplier.SettableMonotonicObservableSupplier;
|
||||
import org.chromium.chrome.R;
|
||||
import org.chromium.chrome.browser.BraveRewardsHelper;
|
||||
import org.chromium.components.browser_ui.settings.SettingsUtils;
|
||||
import org.chromium.components.browser_ui.settings.search.BaseSearchIndexProvider;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
@@ -61,4 +62,10 @@ public class BraveLicensePreferences extends BravePreferenceFragment {
|
||||
public MonotonicObservableSupplier<String> getPageTitle() {
|
||||
return mPageTitle;
|
||||
}
|
||||
|
||||
// The screen only displays a dynamically-loaded HTML license text; there are no static
|
||||
// settings to index.
|
||||
public static final BaseSearchIndexProvider SEARCH_INDEX_DATA_PROVIDER =
|
||||
new BaseSearchIndexProvider(
|
||||
BraveLicensePreferences.class.getName(), BaseSearchIndexProvider.INDEX_OPT_OUT);
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ package org.chromium.chrome.browser.settings;
|
||||
|
||||
import static org.chromium.build.NullUtil.assumeNonNull;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
@@ -38,22 +39,29 @@ import org.chromium.chrome.browser.onboarding.OnboardingPrefManager;
|
||||
import org.chromium.chrome.browser.partnercustomizations.CloseBraveManager;
|
||||
import org.chromium.chrome.browser.preferences.BravePref;
|
||||
import org.chromium.chrome.browser.privacy.settings.BravePrivacySettings;
|
||||
import org.chromium.chrome.browser.profiles.Profile;
|
||||
import org.chromium.chrome.browser.profiles.ProfileManager;
|
||||
import org.chromium.chrome.browser.rate.BraveRateDialogFragment;
|
||||
import org.chromium.chrome.browser.search_engines.TemplateUrlServiceFactory;
|
||||
import org.chromium.chrome.browser.settings.search.ChromeBaseSearchIndexProvider;
|
||||
import org.chromium.chrome.browser.toolbar.bottom.BottomToolbarConfiguration;
|
||||
import org.chromium.chrome.browser.vpn.BraveVpnPolicy;
|
||||
import org.chromium.chrome.browser.vpn.settings.VpnCalloutPreference;
|
||||
import org.chromium.chrome.browser.vpn.utils.BraveVpnPrefUtils;
|
||||
import org.chromium.chrome.browser.vpn.utils.BraveVpnUtils;
|
||||
import org.chromium.chrome.browser.widget.quickactionsearchandbookmark.utils.BraveSearchWidgetUtils;
|
||||
import org.chromium.components.brave_account.BraveAccountFeatures;
|
||||
import org.chromium.components.browser_ui.settings.ChromeBasePreference;
|
||||
import org.chromium.components.browser_ui.settings.ChromeSwitchPreference;
|
||||
import org.chromium.components.browser_ui.settings.SettingsUtils;
|
||||
import org.chromium.components.browser_ui.settings.search.PreferenceParser;
|
||||
import org.chromium.components.browser_ui.settings.search.SearchIndexProvider;
|
||||
import org.chromium.components.browser_ui.settings.search.SettingsIndexData;
|
||||
import org.chromium.components.user_prefs.UserPrefs;
|
||||
import org.chromium.ui.base.DeviceFormFactor;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
// This excludes some settings in main settings screen.
|
||||
@NullMarked
|
||||
@@ -639,4 +647,66 @@ public abstract class BraveMainPreferencesBase extends BravePreferenceFragment
|
||||
removePreferenceIfPresent(PREF_BRAVE_WALLET);
|
||||
}
|
||||
}
|
||||
|
||||
// Wraps MainSettings.SEARCH_INDEX_DATA_PROVIDER and additionally removes upstream preferences
|
||||
// that BraveMainPreferencesBase hides from the Brave main settings UI.
|
||||
public static final ChromeBaseSearchIndexProvider SEARCH_INDEX_DATA_PROVIDER =
|
||||
new ChromeBaseSearchIndexProvider(MainSettings.class.getName(), 0) {
|
||||
|
||||
@Override
|
||||
public void initPreferenceXml(
|
||||
Context context,
|
||||
Profile profile,
|
||||
SettingsIndexData indexData,
|
||||
Map<String, SearchIndexProvider> providerMap) {
|
||||
MainSettings.SEARCH_INDEX_DATA_PROVIDER.initPreferenceXml(
|
||||
context, profile, indexData, providerMap);
|
||||
// Also index preferences from brave_main_preferences.xml, which is loaded
|
||||
// alongside main_preferences.xml at runtime.
|
||||
PreferenceParser.parseAndPopulate(
|
||||
context,
|
||||
R.xml.brave_main_preferences,
|
||||
indexData,
|
||||
MainSettings.class.getName(),
|
||||
new Bundle(),
|
||||
providerMap);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateDynamicPreferences(
|
||||
Context context, SettingsIndexData indexData, Profile profile) {
|
||||
MainSettings.SEARCH_INDEX_DATA_PROVIDER.updateDynamicPreferences(
|
||||
context, indexData, profile);
|
||||
// Remove upstream preferences hidden from the main settings UI
|
||||
// ("languages" is intentionally excluded — removing it crashes
|
||||
// LanguageSettings).
|
||||
indexData.removeEntry(getUniqueId(MainSettings.PREF_SIGN_IN));
|
||||
indexData.removeEntry(getUniqueId(MainSettings.PREF_SEARCH_ENGINE));
|
||||
indexData.removeEntry(getUniqueId(MainSettings.PREF_DOWNLOADS));
|
||||
indexData.removeEntry(getUniqueId(MainSettings.PREF_SAFETY_HUB));
|
||||
indexData.removeEntry(
|
||||
getUniqueId(MainSettings.PREF_ACCOUNT_AND_GOOGLE_SERVICES_SECTION));
|
||||
indexData.removeEntry(getUniqueId(MainSettings.PREF_GOOGLE_SERVICES));
|
||||
indexData.removeEntry(getUniqueId(MainSettings.PREF_PRIVACY));
|
||||
indexData.removeEntry(getUniqueId(MainSettings.PREF_APPEARANCE));
|
||||
indexData.removeEntry(getUniqueId(MainSettings.PREF_ADDRESS_BAR));
|
||||
indexData.removeEntry(getUniqueId(MainSettings.PREF_TOOLBAR_SHORTCUT));
|
||||
// Account section is only shown when Brave Account is enabled.
|
||||
if (!BraveAccountFeatures.isBraveAccountEnabled()) {
|
||||
for (String key : BraveAccountSectionController.ALL_PREFERENCE_KEYS) {
|
||||
indexData.removeEntry(getUniqueId(key));
|
||||
}
|
||||
}
|
||||
// Brave leaf switches/actions in main settings have no sub-screen to
|
||||
// navigate to from search results, so exclude them from the index.
|
||||
indexData.removeEntry(getUniqueId(PREF_CLOSING_ALL_TABS_CLOSES_BRAVE));
|
||||
indexData.removeEntry(getUniqueId(PREF_RATE_BRAVE));
|
||||
indexData.removeEntry(getUniqueId(PREF_AUTOFILL_PRIVATE_WINDOW));
|
||||
indexData.removeEntry(getUniqueId(PREF_USE_CUSTOM_TABS));
|
||||
// Leaf prefs from brave_main_preferences.xml that are conditionally hidden.
|
||||
if (!BraveSearchWidgetUtils.isRequestPinAppWidgetSupported()) {
|
||||
indexData.removeEntry(getUniqueId(PREF_HOME_SCREEN_WIDGET));
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
|
||||
package org.chromium.chrome.browser.settings;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
@@ -36,6 +37,12 @@ import org.chromium.chrome.browser.profiles.Profile;
|
||||
import org.chromium.chrome.browser.util.TabUtils;
|
||||
import org.chromium.components.browser_ui.settings.ChromeSwitchPreference;
|
||||
import org.chromium.components.browser_ui.settings.SettingsUtils;
|
||||
import org.chromium.components.browser_ui.settings.search.BaseSearchIndexProvider;
|
||||
import org.chromium.components.browser_ui.settings.search.PreferenceParser;
|
||||
import org.chromium.components.browser_ui.settings.search.SearchIndexProvider;
|
||||
import org.chromium.components.browser_ui.settings.search.SettingsIndexData;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/** Fragment for Brave Origin purchase preferences. */
|
||||
@NullMarked
|
||||
@@ -56,6 +63,7 @@ public class BraveOriginPreferences extends BravePreferenceFragment
|
||||
private static final String PREF_WEB_DISCOVERY_PROJECT_SWITCH = "web_discovery_project_switch";
|
||||
private static final String PREF_RESET_TO_DEFAULTS = "reset_to_defaults";
|
||||
private static final String PREF_LINK_PURCHASE = "link_purchase";
|
||||
private static final String PREF_BRAVE_ORIGIN = "brave_origin";
|
||||
|
||||
private final SettableMonotonicObservableSupplier<String> mPageTitle =
|
||||
ObservableSuppliers.createMonotonic();
|
||||
@@ -346,6 +354,38 @@ public class BraveOriginPreferences extends BravePreferenceFragment
|
||||
}
|
||||
}
|
||||
|
||||
public static final BaseSearchIndexProvider SEARCH_INDEX_DATA_PROVIDER =
|
||||
new BaseSearchIndexProvider(
|
||||
BraveOriginPreferences.class.getName(), R.xml.brave_origin_preferences) {
|
||||
|
||||
@Override
|
||||
public void initPreferenceXml(
|
||||
Context context,
|
||||
SettingsIndexData indexData,
|
||||
Map<String, SearchIndexProvider> providerMap) {
|
||||
super.initPreferenceXml(context, indexData, providerMap);
|
||||
indexData.addChildParentLink(
|
||||
BraveOriginPreferences.class.getName(),
|
||||
PreferenceParser.createUniqueId(
|
||||
MainSettings.class.getName(), PREF_BRAVE_ORIGIN));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateDynamicPreferences(Context context, SettingsIndexData indexData) {
|
||||
String frag = BraveOriginPreferences.class.getName();
|
||||
if (!ChromeFeatureList.isEnabled(BraveFeatureList.BRAVE_ORIGIN)) {
|
||||
indexData.removeEntryForKey(
|
||||
MainSettings.class.getName(), PREF_BRAVE_ORIGIN);
|
||||
return;
|
||||
}
|
||||
// origin_description is an informational widget with no title; exclude it.
|
||||
indexData.removeEntryForKey(frag, "origin_description");
|
||||
if (!ChromeFeatureList.isEnabled(BraveFeatureList.EMAIL_ALIASES)) {
|
||||
indexData.removeEntryForKey(frag, PREF_EMAIL_ALIASES_SWITCH);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
dismissRestartSnackbar();
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
package org.chromium.chrome.browser.settings;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
|
||||
import androidx.preference.Preference;
|
||||
@@ -22,6 +23,8 @@ import org.chromium.chrome.browser.preferences.BravePref;
|
||||
import org.chromium.chrome.browser.preferences.Pref;
|
||||
import org.chromium.components.browser_ui.settings.ChromeSwitchPreference;
|
||||
import org.chromium.components.browser_ui.settings.SettingsUtils;
|
||||
import org.chromium.components.browser_ui.settings.search.BaseSearchIndexProvider;
|
||||
import org.chromium.components.browser_ui.settings.search.SettingsIndexData;
|
||||
import org.chromium.components.user_prefs.UserPrefs;
|
||||
import org.chromium.components.web_discovery.WebDiscoveryPrefs;
|
||||
|
||||
@@ -167,6 +170,21 @@ public class BraveSearchEnginesPreferences extends BravePreferenceFragment
|
||||
}
|
||||
}
|
||||
|
||||
public static final BaseSearchIndexProvider SEARCH_INDEX_DATA_PROVIDER =
|
||||
new BaseSearchIndexProvider(
|
||||
BraveSearchEnginesPreferences.class.getName(),
|
||||
R.xml.brave_search_engines_preferences) {
|
||||
|
||||
@Override
|
||||
public void updateDynamicPreferences(Context context, SettingsIndexData indexData) {
|
||||
if (!BraveConfig.WEB_DISCOVERY_ENABLED) {
|
||||
indexData.removeEntryForKey(
|
||||
BraveSearchEnginesPreferences.class.getName(),
|
||||
PREF_SEND_WEB_DISCOVERY);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@Override
|
||||
public boolean onPreferenceChange(Preference preference, Object newValue) {
|
||||
String key = preference.getKey();
|
||||
|
||||
@@ -65,6 +65,7 @@ import org.chromium.chrome.browser.sync.BraveSyncDevices;
|
||||
import org.chromium.chrome.browser.sync.SyncServiceFactory;
|
||||
import org.chromium.chrome.browser.sync.settings.BraveManageSyncSettings;
|
||||
import org.chromium.components.browser_ui.settings.SettingsNavigation;
|
||||
import org.chromium.components.browser_ui.settings.search.BaseSearchIndexProvider;
|
||||
import org.chromium.components.sync.SyncService;
|
||||
import org.chromium.ui.base.BraveClipboardHelper;
|
||||
import org.chromium.ui.base.DeviceFormFactor;
|
||||
@@ -1503,4 +1504,11 @@ public class BraveSyncScreensPreference extends BravePreferenceFragment
|
||||
|
||||
@Override
|
||||
public void onCreatePreferences(Bundle bundle, String s) {} /**/
|
||||
|
||||
// This fragment uses a fully custom view layout (brave_sync_layout); there are no static
|
||||
// preferences to index.
|
||||
public static final BaseSearchIndexProvider SEARCH_INDEX_DATA_PROVIDER =
|
||||
new BaseSearchIndexProvider(
|
||||
BraveSyncScreensPreference.class.getName(),
|
||||
BaseSearchIndexProvider.INDEX_OPT_OUT);
|
||||
}
|
||||
|
||||
+8
@@ -29,6 +29,7 @@ import org.chromium.chrome.R;
|
||||
import org.chromium.components.browser_ui.settings.FragmentSettingsNavigation;
|
||||
import org.chromium.components.browser_ui.settings.SettingsNavigation;
|
||||
import org.chromium.components.browser_ui.settings.SettingsUtils;
|
||||
import org.chromium.components.browser_ui.settings.search.BaseSearchIndexProvider;
|
||||
|
||||
public class BraveWalletNetworksPreferenceFragment extends BravePreferenceFragment
|
||||
implements FragmentSettingsNavigation, BraveWalletAddNetworksFragment.Listener {
|
||||
@@ -131,6 +132,13 @@ public class BraveWalletNetworksPreferenceFragment extends BravePreferenceFragme
|
||||
launchIntent(chainId, activeNetwork);
|
||||
}
|
||||
|
||||
// This fragment displays a dynamic network list widget; there are no static preferences to
|
||||
// index.
|
||||
public static final BaseSearchIndexProvider SEARCH_INDEX_DATA_PROVIDER =
|
||||
new BaseSearchIndexProvider(
|
||||
BraveWalletNetworksPreferenceFragment.class.getName(),
|
||||
BaseSearchIndexProvider.INDEX_OPT_OUT);
|
||||
|
||||
private void launchIntent(@Nullable final String chainId, boolean activeNetwork) {
|
||||
final Bundle fragmentArgs;
|
||||
if (chainId != null) {
|
||||
|
||||
@@ -33,6 +33,7 @@ import org.chromium.chrome.browser.util.TabUtils;
|
||||
import org.chromium.components.browser_ui.settings.ChromeSwitchPreference;
|
||||
import org.chromium.components.browser_ui.settings.SettingsUtils;
|
||||
import org.chromium.components.browser_ui.settings.TextMessagePreference;
|
||||
import org.chromium.components.browser_ui.settings.search.BaseSearchIndexProvider;
|
||||
import org.chromium.mojo.bindings.ConnectionErrorHandler;
|
||||
import org.chromium.mojo.system.MojoException;
|
||||
import org.chromium.ui.text.ChromeClickableSpan;
|
||||
@@ -291,4 +292,8 @@ public class BraveWalletPreferences extends BravePreferenceFragment
|
||||
return DefaultWallet.NONE;
|
||||
}
|
||||
}
|
||||
|
||||
public static final BaseSearchIndexProvider SEARCH_INDEX_DATA_PROVIDER =
|
||||
new BaseSearchIndexProvider(
|
||||
BraveWalletPreferences.class.getName(), R.xml.brave_wallet_preferences);
|
||||
}
|
||||
|
||||
+7
@@ -16,6 +16,7 @@ import org.chromium.base.supplier.SettableMonotonicObservableSupplier;
|
||||
import org.chromium.chrome.R;
|
||||
import org.chromium.chrome.browser.preferences.BravePrefServiceBridge;
|
||||
import org.chromium.components.browser_ui.settings.SettingsUtils;
|
||||
import org.chromium.components.browser_ui.settings.search.BaseSearchIndexProvider;
|
||||
import org.chromium.ui.UiUtils;
|
||||
|
||||
/** Fragment to manage webrtc policy settings. */
|
||||
@@ -44,6 +45,12 @@ public class BraveWebrtcPolicyPreferencesFragment extends BravePreferenceFragmen
|
||||
return mPageTitle;
|
||||
}
|
||||
|
||||
// This fragment displays a custom radio-button widget with no static titled preferences.
|
||||
public static final BaseSearchIndexProvider SEARCH_INDEX_DATA_PROVIDER =
|
||||
new BaseSearchIndexProvider(
|
||||
BraveWebrtcPolicyPreferencesFragment.class.getName(),
|
||||
BaseSearchIndexProvider.INDEX_OPT_OUT);
|
||||
|
||||
@Override
|
||||
public void onActivityCreated(Bundle savedInstanceState) {
|
||||
super.onActivityCreated(savedInstanceState);
|
||||
|
||||
@@ -44,6 +44,7 @@ import org.chromium.chrome.browser.settings.BravePreferenceFragment;
|
||||
import org.chromium.chrome.browser.util.BraveDbUtil;
|
||||
import org.chromium.components.browser_ui.settings.ChromeSwitchPreference;
|
||||
import org.chromium.components.browser_ui.settings.SettingsUtils;
|
||||
import org.chromium.components.browser_ui.settings.search.BaseSearchIndexProvider;
|
||||
import org.chromium.components.user_prefs.UserPrefs;
|
||||
|
||||
import java.io.File;
|
||||
@@ -440,4 +441,9 @@ public class BraveQAPreferences extends BravePreferenceFragment
|
||||
dialog.setCanceledOnTouchOutside(false);
|
||||
dialog.show();
|
||||
}
|
||||
|
||||
// QA-only screen protected by a password; exclude entirely from settings search.
|
||||
public static final BaseSearchIndexProvider SEARCH_INDEX_DATA_PROVIDER =
|
||||
new BaseSearchIndexProvider(
|
||||
BraveQAPreferences.class.getName(), BaseSearchIndexProvider.INDEX_OPT_OUT);
|
||||
}
|
||||
|
||||
+10
-2
@@ -15,9 +15,10 @@ import org.chromium.base.supplier.SettableMonotonicObservableSupplier;
|
||||
import org.chromium.chrome.R;
|
||||
import org.chromium.chrome.browser.settings.BravePreferenceFragment;
|
||||
import org.chromium.components.browser_ui.settings.SettingsUtils;
|
||||
import org.chromium.components.browser_ui.settings.search.BaseSearchIndexProvider;
|
||||
|
||||
public class BraveWalletEthereumConnectedSites
|
||||
extends BravePreferenceFragment implements Preference.OnPreferenceChangeListener {
|
||||
public class BraveWalletEthereumConnectedSites extends BravePreferenceFragment
|
||||
implements Preference.OnPreferenceChangeListener {
|
||||
private static final String PREF_BRAVE_WALLET_ETHEREUM_CONNECTED_SITES =
|
||||
"pref_brave_wallet_ethereum_connected_sites";
|
||||
private final SettableMonotonicObservableSupplier<String> mPageTitle =
|
||||
@@ -39,6 +40,13 @@ public class BraveWalletEthereumConnectedSites
|
||||
return true;
|
||||
}
|
||||
|
||||
// This fragment displays a dynamic connected-sites widget; there are no static preferences
|
||||
// to index.
|
||||
public static final BaseSearchIndexProvider SEARCH_INDEX_DATA_PROVIDER =
|
||||
new BaseSearchIndexProvider(
|
||||
BraveWalletEthereumConnectedSites.class.getName(),
|
||||
BaseSearchIndexProvider.INDEX_OPT_OUT);
|
||||
|
||||
@Override
|
||||
public void onDestroyView() {
|
||||
super.onDestroyView();
|
||||
|
||||
+10
-2
@@ -15,9 +15,10 @@ import org.chromium.base.supplier.SettableMonotonicObservableSupplier;
|
||||
import org.chromium.chrome.R;
|
||||
import org.chromium.chrome.browser.settings.BravePreferenceFragment;
|
||||
import org.chromium.components.browser_ui.settings.SettingsUtils;
|
||||
import org.chromium.components.browser_ui.settings.search.BaseSearchIndexProvider;
|
||||
|
||||
public class BraveWalletSolanaConnectedSites
|
||||
extends BravePreferenceFragment implements Preference.OnPreferenceChangeListener {
|
||||
public class BraveWalletSolanaConnectedSites extends BravePreferenceFragment
|
||||
implements Preference.OnPreferenceChangeListener {
|
||||
private static final String PREF_BRAVE_WALLET_SOLANA_CONNECTED_SITES =
|
||||
"pref_brave_wallet_solana_connected_sites";
|
||||
private final SettableMonotonicObservableSupplier<String> mPageTitle =
|
||||
@@ -39,6 +40,13 @@ public class BraveWalletSolanaConnectedSites
|
||||
return true;
|
||||
}
|
||||
|
||||
// This fragment displays a dynamic connected-sites widget; there are no static preferences
|
||||
// to index.
|
||||
public static final BaseSearchIndexProvider SEARCH_INDEX_DATA_PROVIDER =
|
||||
new BaseSearchIndexProvider(
|
||||
BraveWalletSolanaConnectedSites.class.getName(),
|
||||
BaseSearchIndexProvider.INDEX_OPT_OUT);
|
||||
|
||||
@Override
|
||||
public void onDestroyView() {
|
||||
super.onDestroyView();
|
||||
|
||||
@@ -54,6 +54,8 @@ import org.chromium.chrome.browser.vpn.wireguard.WireguardConfigUtils;
|
||||
import org.chromium.components.browser_ui.settings.ChromeBasePreference;
|
||||
import org.chromium.components.browser_ui.settings.ChromeSwitchPreference;
|
||||
import org.chromium.components.browser_ui.settings.SettingsUtils;
|
||||
import org.chromium.components.browser_ui.settings.search.BaseSearchIndexProvider;
|
||||
import org.chromium.components.browser_ui.settings.search.SettingsIndexData;
|
||||
import org.chromium.ui.widget.Toast;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
@@ -561,4 +563,16 @@ public class BraveVpnPreferences extends BravePreferenceFragment implements Brav
|
||||
BraveVpnUtils.dismissProgressDialog();
|
||||
super.onDestroy();
|
||||
}
|
||||
|
||||
public static final BaseSearchIndexProvider SEARCH_INDEX_DATA_PROVIDER =
|
||||
new BaseSearchIndexProvider(
|
||||
BraveVpnPreferences.class.getName(), R.xml.brave_vpn_preferences) {
|
||||
|
||||
@Override
|
||||
public void updateDynamicPreferences(Context context, SettingsIndexData indexData) {
|
||||
// server_change_location uses a custom layout with no title.
|
||||
indexData.removeEntryForKey(
|
||||
BraveVpnPreferences.class.getName(), PREF_SERVER_CHANGE_LOCATION);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user