Remove search entries from old pages when SC is on.
There was already some code to guard this, but this wasn't overriding
the `isPageSearchEnabled` as well to support dynamic indexing.
Bug: 280596858
Test: manual
Change-Id: If4793d9fa2a7d68eac78258c18d04e9fb7d8fcea
diff --git a/src/com/android/settings/privacy/PrivacyDashboardFragment.java b/src/com/android/settings/privacy/PrivacyDashboardFragment.java
index 19683b8..4d76277 100644
--- a/src/com/android/settings/privacy/PrivacyDashboardFragment.java
+++ b/src/com/android/settings/privacy/PrivacyDashboardFragment.java
@@ -59,8 +59,10 @@
SafetyCenterUtils.getEnterpriseOverrideStringForPrivacyEntries();
for (int i = 0; i < privacyOverrideStrings.size(); i++) {
EnterpriseOverrideString overrideString = privacyOverrideStrings.get(i);
- replaceEnterpriseStringTitle(overrideString.getPreferenceKey(),
- overrideString.getOverrideKey(), overrideString.getResource());
+ replaceEnterpriseStringTitle(
+ overrideString.getPreferenceKey(),
+ overrideString.getOverrideKey(),
+ overrideString.getResource());
}
}
@@ -93,7 +95,9 @@
@Override
public List<SearchIndexableResource> getXmlResourcesToIndex(
Context context, boolean enabled) {
- if (SafetyCenterManagerWrapper.get().isEnabled(context)) {
+ // NOTE: This check likely should be moved to the super method. This is done
+ // here to avoid potentially undesired side effects for existing implementors.
+ if (!isPageSearchEnabled(context)) {
return null;
}
return super.getXmlResourcesToIndex(context, enabled);
@@ -120,5 +124,10 @@
keys.add(KEY_NOTIFICATION_WORK_PROFILE_NOTIFICATIONS);
return keys;
}
+
+ @Override
+ protected boolean isPageSearchEnabled(Context context) {
+ return !SafetyCenterManagerWrapper.get().isEnabled(context);
+ }
};
}