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
This commit is contained in:
Elliot Sisteron
2023-05-10 13:41:51 +00:00
parent d865ccc2ed
commit d86c590440
3 changed files with 52 additions and 32 deletions

View File

@@ -59,8 +59,10 @@ public class PrivacyDashboardFragment extends DashboardFragment {
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 @@ public class PrivacyDashboardFragment extends DashboardFragment {
@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 @@ public class PrivacyDashboardFragment extends DashboardFragment {
keys.add(KEY_NOTIFICATION_WORK_PROFILE_NOTIFICATIONS);
return keys;
}
@Override
protected boolean isPageSearchEnabled(Context context) {
return !SafetyCenterManagerWrapper.get().isEnabled(context);
}
};
}