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

@@ -55,6 +55,10 @@ public class SystemDashboardFragment extends DashboardFragment {
@Override
protected List<PreferenceController> getPreferenceControllers(Context context) {
return buildPreferenceControllers(context);
}
private static List<PreferenceController> buildPreferenceControllers(Context context) {
final List<PreferenceController> controllers = new ArrayList<>();
controllers.add(new SystemUpdatePreferenceController(context, UserManager.get(context)));
controllers.add(new AdditionalSystemUpdatePreferenceController(context));
@@ -79,17 +83,8 @@ public class SystemDashboardFragment extends DashboardFragment {
}
@Override
public List<String> getNonIndexableKeys(Context context) {
if (!FeatureFactory.getFactory(context).getDashboardFeatureProvider(context)
.isEnabled()) {
return null;
}
final List<String> keys = new ArrayList<>();
new SystemUpdatePreferenceController(context, UserManager.get(context))
.updateNonIndexableKeys(keys);
new AdditionalSystemUpdatePreferenceController(context)
.updateNonIndexableKeys(keys);
return keys;
public List<PreferenceController> getPreferenceControllers(Context context) {
return buildPreferenceControllers(context);
}
};
}