Merge "Update Battery settings main page string (1/2)" into sc-dev

This commit is contained in:
Wesley Wang
2021-03-29 07:59:34 +00:00
committed by Android (Google) Code Review
5 changed files with 16 additions and 30 deletions

View File

@@ -105,7 +105,8 @@ public class BatterySaverControllerTest {
Settings.Global.AUTOMATIC_POWER_SAVE_MODE,
PowerManager.POWER_SAVE_MODE_TRIGGER_DYNAMIC);
assertThat(mBatterySaverController.getSummary()).isEqualTo("Based on your routine");
assertThat(mBatterySaverController.getSummary()).
isEqualTo("Will turn on based on your routine");
}
@Test

View File

@@ -63,31 +63,20 @@ public class BatteryManagerPreferenceControllerTest {
}
@Test
public void updateState_smartBatteryOnWithRestrictApps_showSummary() {
mController.updateSummary(mPreference, true /* smartBatteryOn */, 2);
public void updateState_smartBatteryWithRestrictApps_showSummary() {
mController.updateSummary(mPreference, 2);
assertThat(mPreference.getSummary()).isEqualTo("2 apps restricted");
}
@Test
public void updateState_smartBatteryOnWithoutRestriction_showSummary() {
public void updateState_smartBatteryWithoutRestriction_showSummary() {
when(mFeatureFactory.powerUsageFeatureProvider.isSmartBatterySupported()).thenReturn(true);
Settings.Global.putInt(mContext.getContentResolver(),
Settings.Global.ADAPTIVE_BATTERY_MANAGEMENT_ENABLED, ON);
mController.updateState(mPreference);
assertThat(mPreference.getSummary()).isEqualTo("On / Detecting when apps drain battery");
}
@Test
public void updateState_smartBatteryOff_showSummary() {
when(mFeatureFactory.powerUsageFeatureProvider.isSmartBatterySupported()).thenReturn(true);
Settings.Global.putInt(mContext.getContentResolver(),
Settings.Global.ADAPTIVE_BATTERY_MANAGEMENT_ENABLED, OFF);
mController.updateState(mPreference);
assertThat(mPreference.getSummary()).isEqualTo("Off");
assertThat(mPreference.getSummary()).isEqualTo("Detecting when apps drain battery");
}
}