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
38 lines
1.1 KiB
Java
38 lines
1.1 KiB
Java
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);
|
|
}
|
|
}
|