Merge similar BaseSearchIndexProvider code together

Bug: 135053028
Test: robolectric, check search_index.db contains the same items
Change-Id: If3c18a170b0e671690df1fdf26e59a421d2c48cd
This commit is contained in:
Raff Tsai
2019-09-12 10:56:13 +08:00
parent e84a8863d5
commit 1f30b1cd67
75 changed files with 86 additions and 744 deletions

View File

@@ -18,13 +18,11 @@
package com.android.settings.testutils;
import android.content.Context;
import android.provider.SearchIndexableResource;
import com.android.settings.R;
import com.android.settings.search.BaseSearchIndexProvider;
import com.android.settings.search.Indexable;
import java.util.ArrayList;
import java.util.List;
public class FakeIndexProvider implements Indexable {
@@ -32,16 +30,7 @@ public class FakeIndexProvider implements Indexable {
public static final String KEY = "TestKey";
public static final Indexable.SearchIndexProvider SEARCH_INDEX_DATA_PROVIDER =
new BaseSearchIndexProvider() {
@Override
public List<SearchIndexableResource> getXmlResourcesToIndex(Context context,
boolean enabled) {
List<SearchIndexableResource> resources = new ArrayList<>();
SearchIndexableResource res = new SearchIndexableResource(context);
res.xmlResId = R.xml.location_settings;
resources.add(res);
return resources;
}
new BaseSearchIndexProvider(R.xml.location_settings) {
@Override
public List<String> getNonIndexableKeys(Context context) {