Add capability for OEMs to supply their own SearchIndexableResources.
This moves SearchIndexableResources to be supplied by FeatureFactory rather than its own singleton, which in effect allows OEMs to supply their own, in the case where they have their own classes they want to be indexed (or, remove certain classes that used to be indexed). Bug: 72179744 Test: All tests pass. Change-Id: Ia06b2026df7eca4c53b44a5a589c4aaa0b69d96c
This commit is contained in:
@@ -26,6 +26,7 @@ import android.support.test.filters.MediumTest;
|
||||
import android.support.test.runner.AndroidJUnit4;
|
||||
import android.util.ArraySet;
|
||||
|
||||
import com.android.settings.overlay.FeatureFactory;
|
||||
import com.android.settings.search.DatabaseIndexingUtils;
|
||||
import com.android.settings.search.Indexable;
|
||||
import com.android.settings.search.SearchIndexableResources;
|
||||
@@ -54,7 +55,10 @@ public class PreferenceControllerContractTest {
|
||||
public void controllersInSearchShouldImplementPreferenceControllerMixin() {
|
||||
final Set<String> errorClasses = new ArraySet<>();
|
||||
|
||||
for (Class clazz : SearchIndexableResources.providerValues()) {
|
||||
final SearchIndexableResources resources =
|
||||
FeatureFactory.getFactory(mContext).getSearchFeatureProvider()
|
||||
.getSearchIndexableResources();
|
||||
for (Class<?> clazz : resources.getProviderValues()) {
|
||||
|
||||
final Indexable.SearchIndexProvider provider =
|
||||
DatabaseIndexingUtils.getSearchIndexProvider(clazz);
|
||||
|
@@ -31,6 +31,7 @@ import android.util.AttributeSet;
|
||||
import android.util.Log;
|
||||
import android.util.Xml;
|
||||
|
||||
import com.android.settings.overlay.FeatureFactory;
|
||||
import com.android.settings.search.DatabaseIndexingUtils;
|
||||
import com.android.settings.search.Indexable;
|
||||
import com.android.settings.search.SearchIndexableRaw;
|
||||
@@ -100,7 +101,10 @@ public class UniquePreferenceTest {
|
||||
final Set<String> uniqueKeys = new HashSet<>();
|
||||
final Set<String> nullKeyClasses = new HashSet<>();
|
||||
final Set<String> duplicatedKeys = new HashSet<>();
|
||||
for (Class<?> clazz : SearchIndexableResources.providerValues()) {
|
||||
final SearchIndexableResources resources =
|
||||
FeatureFactory.getFactory(mContext).getSearchFeatureProvider()
|
||||
.getSearchIndexableResources();
|
||||
for (Class<?> clazz : resources.getProviderValues()) {
|
||||
verifyPreferenceKeys(uniqueKeys, duplicatedKeys, nullKeyClasses, clazz);
|
||||
}
|
||||
|
||||
|
@@ -32,6 +32,7 @@ import android.util.AttributeSet;
|
||||
import android.util.Log;
|
||||
import android.util.Xml;
|
||||
|
||||
import com.android.settings.overlay.FeatureFactory;
|
||||
import com.android.settings.search.DatabaseIndexingUtils;
|
||||
import com.android.settings.search.Indexable;
|
||||
import com.android.settings.search.SearchIndexableResources;
|
||||
@@ -79,7 +80,10 @@ public class UserRestrictionTest {
|
||||
@Test
|
||||
public void userRestrictionAttributeShouldBeValid()
|
||||
throws IOException, XmlPullParserException, Resources.NotFoundException {
|
||||
for (Class<?> clazz : SearchIndexableResources.providerValues()) {
|
||||
final SearchIndexableResources resources =
|
||||
FeatureFactory.getFactory(mContext).getSearchFeatureProvider()
|
||||
.getSearchIndexableResources();
|
||||
for (Class<?> clazz : resources.getProviderValues()) {
|
||||
verifyUserRestriction(clazz);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user