Let fragment and indexProvider share prefControllers

Bug: 35812240
Test: make RunSettingsRoboTests
Change-Id: Ifd96f935836a52e0a56f170f3cdf9b9ddf7c499a
This commit is contained in:
Fan Zhang
2017-02-28 10:52:46 -08:00
parent 6c146f2ab5
commit b00811da64
17 changed files with 265 additions and 255 deletions

View File

@@ -18,8 +18,10 @@ package com.android.settings.search;
import android.content.Context;
import android.provider.SearchIndexableResource;
import com.android.settings.core.PreferenceController;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
@@ -28,7 +30,7 @@ import java.util.List;
*/
public class BaseSearchIndexProvider implements Indexable.SearchIndexProvider {
private static final List<String> EMPTY_LIST = Collections.<String>emptyList();
private static final List<String> EMPTY_LIST = Collections.emptyList();
public BaseSearchIndexProvider() {
}
@@ -45,7 +47,16 @@ public class BaseSearchIndexProvider implements Indexable.SearchIndexProvider {
@Override
public List<String> getNonIndexableKeys(Context context) {
return EMPTY_LIST;
final List<PreferenceController> controllers = getPreferenceControllers(context);
if (controllers != null && !controllers.isEmpty()) {
final List<String> nonIndexableKeys = new ArrayList<>();
for (PreferenceController controller : controllers) {
controller.updateNonIndexableKeys(nonIndexableKeys);
}
return nonIndexableKeys;
} else {
return EMPTY_LIST;
}
}
@Override