PowerUsageSummary: move controllers to xml

Also change the following controllers to have standard constructor
1. BatteryHeaderPreferenceController
2. BatteryTipPreferenceController

Change-Id: I2e68082295eb8ef18de9fef9483a10b070c77a47
Fixes: 111131567
Test: robotest
This commit is contained in:
jackqdyulei
2018-07-24 10:49:05 -07:00
parent c879386e5a
commit 076b674764
10 changed files with 104 additions and 95 deletions

View File

@@ -222,21 +222,6 @@ public class PowerUsageSummaryTest {
assertThat(keys).containsAllIn(niks);
}
@Test
public void preferenceControllers_getPreferenceKeys_existInPreferenceScreen() {
final Context context = RuntimeEnvironment.application;
final PowerUsageSummary fragment = new PowerUsageSummary();
final List<String> preferenceScreenKeys =
XmlTestUtils.getKeysFromPreferenceXml(context, fragment.getPreferenceScreenResId());
final List<String> preferenceKeys = new ArrayList<>();
for (AbstractPreferenceController controller : fragment.createPreferenceControllers(context)) {
preferenceKeys.add(controller.getPreferenceKey());
}
assertThat(preferenceScreenKeys).containsAllIn(preferenceKeys);
}
@Test
public void restartBatteryTipLoader() {
//TODO: add policy logic here when BatteryTipPolicy is implemented