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:
Ben Lin
2018-01-17 17:53:20 -08:00
parent 182a0fc91b
commit 4d163fcc93
16 changed files with 312 additions and 231 deletions

View File

@@ -27,9 +27,9 @@ import android.util.Log;
import android.util.Xml;
import com.android.settings.dashboard.DashboardFragment;
import com.android.settings.overlay.FeatureFactory;
import com.android.settings.search.DatabaseIndexingUtils;
import com.android.settings.search.Indexable.SearchIndexProvider;
import com.android.settings.search.SearchIndexableResources;
import com.android.settings.search.XmlParserUtils;
import org.xmlpull.v1.XmlPullParser;
@@ -62,7 +62,8 @@ class SliceDataConverter {
* @return a list of {@link SliceData} to be indexed and later referenced as a Slice.
*
* The collection works as follows:
* - Collects a list of Fragments from {@link SearchIndexableResources}.
* - Collects a list of Fragments from
* {@link FeatureFactory#getSearchFeatureProvider()}.
* - From each fragment, grab a {@link SearchIndexProvider}.
* - For each provider, collect XML resource layout and a list of
* {@link com.android.settings.core.BasePreferenceController}.
@@ -72,7 +73,8 @@ class SliceDataConverter {
return mSliceData;
}
final Collection<Class> indexableClasses = SearchIndexableResources.providerValues();
final Collection<Class> indexableClasses = FeatureFactory.getFactory(mContext)
.getSearchFeatureProvider().getSearchIndexableResources().getProviderValues();
for (Class clazz : indexableClasses) {
final String fragmentName = clazz.getName();