Index Data to build Slices in Settings

The indexing is done by taking the indexable fragments from
search, grabbing their XML via SearchIndexableResources, and
then looking for controllers defined in preferences.

For each controller found, we take the combination of the
fragment providing the XML and the Preference info to create
an indexable row.

Buiding a Slice will be handled in a subsquent CL, but a
prototype can be found here: ag/3324435

Test: robotests
Bug: 67996923
Change-Id: I48668618079bcc3da55ab77b7323ee8e467073af
This commit is contained in:
Matthew Fritze
2017-12-12 16:03:22 -08:00
parent ce2b7fe988
commit 13c43f1900
18 changed files with 882 additions and 34 deletions

View File

@@ -0,0 +1,37 @@
package com.android.settings.slices;
import android.content.Context;
import com.android.settingslib.utils.ThreadUtils;
/**
* Manages Slices in Settings.
*/
public class SlicesFeatureProviderImpl implements SlicesFeatureProvider {
private SlicesIndexer mSlicesIndexer;
private SliceDataConverter mSliceDataConverter;
@Override
public SlicesIndexer getSliceIndexer(Context context) {
if (mSlicesIndexer == null) {
mSlicesIndexer = new SlicesIndexer(context.getApplicationContext());
}
return mSlicesIndexer;
}
@Override
public SliceDataConverter getSliceDataConverter(Context context) {
if(mSliceDataConverter == null) {
mSliceDataConverter = new SliceDataConverter(context.getApplicationContext());
}
return mSliceDataConverter;
}
@Override
public void indexSliceData(Context context) {
// TODO (b/67996923) add indexing time log
SlicesIndexer indexer = getSliceIndexer(context);
ThreadUtils.postOnBackgroundThread(indexer);
}
}