Remove duplicates between battery and display settings

Change preference keys of duplicate settings between
display and battery to avoid duplication in search.

Bug: 33701673
Test: make RunSettingsRoboTests
Change-Id: Iaad52f16ce33c478c64bcec656cc8edbe0c97283
Merged-In: I56c82e9e7f163d345065ca478849de9b14c173fe
This commit is contained in:
Matthew Fritze
2017-04-11 13:22:40 -07:00
parent eb62407114
commit 3266e3d712
14 changed files with 279 additions and 22 deletions

View File

@@ -86,6 +86,9 @@ public class PowerUsageSummary extends PowerUsageBase {
private static final String KEY_SCREEN_USAGE = "screen_usage";
private static final String KEY_TIME_SINCE_LAST_FULL_CHARGE = "last_full_charge";
private static final String KEY_AUTO_BRIGHTNESS = "auto_brightness_battery";
private static final String KEY_SCREEN_TIMEOUT = "screen_timeout_battery";
private static final String KEY_BATTERY_SAVER_SUMMARY = "battery_saver_summary";
private static final int MENU_STATS_TYPE = Menu.FIRST;
@VisibleForTesting
@@ -185,8 +188,8 @@ public class PowerUsageSummary extends PowerUsageBase {
@Override
protected List<PreferenceController> getPreferenceControllers(Context context) {
final List<PreferenceController> controllers = new ArrayList<>();
controllers.add(new AutoBrightnessPreferenceController(context));
controllers.add(new TimeoutPreferenceController(context));
controllers.add(new AutoBrightnessPreferenceController(context, KEY_AUTO_BRIGHTNESS));
controllers.add(new TimeoutPreferenceController(context, KEY_SCREEN_TIMEOUT));
controllers.add(new BatterySaverController(context, getLifecycle()));
controllers.add(new BatteryPercentagePreferenceController(context));
return controllers;
@@ -718,6 +721,16 @@ public class PowerUsageSummary extends PowerUsageBase {
sir.xmlResId = R.xml.power_usage_summary;
return Arrays.asList(sir);
}
@Override
public List<String> getNonIndexableKeys(Context context) {
List<String> niks = new ArrayList<>();
// Duplicates in display
niks.add(KEY_AUTO_BRIGHTNESS);
niks.add(KEY_SCREEN_TIMEOUT);
niks.add(KEY_BATTERY_SAVER_SUMMARY);
return niks;
}
};
public static final SummaryLoader.SummaryProviderFactory SUMMARY_PROVIDER_FACTORY