Suppress rawData settings from indexing when page is disabled for search

Test: robotest, manual
Fix: 324424783
Change-Id: Ie8423d16df387f13cf35c03005640cfd08a5b492
This commit is contained in:
Jason Chiu
2024-05-28 17:26:18 +08:00
parent a05fab6dc5
commit d1b0ad25fa
2 changed files with 21 additions and 2 deletions

View File

@@ -166,6 +166,16 @@ public class BaseSearchIndexProviderTest {
return Collections.singletonList(sir);
}
@Override
public List<SearchIndexableRaw> getRawDataToIndex(Context context, boolean enabled) {
List<SearchIndexableRaw> rawData = super.getRawDataToIndex(context, enabled);
SearchIndexableRaw raw = new SearchIndexableRaw(context);
raw.key = TEST_PREF_KEY;
raw.title = "title";
rawData.add(raw);
return rawData;
}
@Override
protected boolean isPageSearchEnabled(Context context) {
return false;
@@ -176,6 +186,7 @@ public class BaseSearchIndexProviderTest {
provider.getNonIndexableKeys(RuntimeEnvironment.application);
assertThat(nonIndexableKeys).contains("status_header");
assertThat(nonIndexableKeys).contains(TEST_PREF_KEY);
}
@Test