Merge "Hook up Adaptive Battery to new flag." into pi-dev

This commit is contained in:
Lei Yu
2018-04-26 22:07:53 +00:00
committed by Android (Google) Code Review
7 changed files with 19 additions and 14 deletions

View File

@@ -107,10 +107,12 @@ public class SmartBatteryPreferenceControllerTest {
}
private void putSmartBatteryValue(int value) {
Settings.Global.putInt(mContentResolver, Settings.Global.APP_STANDBY_ENABLED, value);
Settings.Global.putInt(mContentResolver,
Settings.Global.ADAPTIVE_BATTERY_MANAGEMENT_ENABLED, value);
}
private int getSmartBatteryValue() {
return Settings.Global.getInt(mContentResolver, Settings.Global.APP_STANDBY_ENABLED, ON);
return Settings.Global.getInt(mContentResolver,
Settings.Global.ADAPTIVE_BATTERY_MANAGEMENT_ENABLED, ON);
}
}

View File

@@ -71,8 +71,8 @@ public class BatteryManagerPreferenceControllerTest {
@Test
public void updateState_smartBatteryOnWithoutRestriction_showSummary() {
when(mFeatureFactory.powerUsageFeatureProvider.isSmartBatterySupported()).thenReturn(true);
Settings.Global.putInt(mContext.getContentResolver(), Settings.Global.APP_STANDBY_ENABLED,
ON);
Settings.Global.putInt(mContext.getContentResolver(),
Settings.Global.ADAPTIVE_BATTERY_MANAGEMENT_ENABLED, ON);
mController.updateState(mPreference);
@@ -82,8 +82,8 @@ public class BatteryManagerPreferenceControllerTest {
@Test
public void updateState_smartBatteryOff_showSummary() {
when(mFeatureFactory.powerUsageFeatureProvider.isSmartBatterySupported()).thenReturn(true);
Settings.Global.putInt(mContext.getContentResolver(), Settings.Global.APP_STANDBY_ENABLED,
OFF);
Settings.Global.putInt(mContext.getContentResolver(),
Settings.Global.ADAPTIVE_BATTERY_MANAGEMENT_ENABLED, OFF);
mController.updateState(mPreference);

View File

@@ -61,14 +61,16 @@ public class SmartBatteryDetectorTest {
@Test
public void testDetect_smartBatteryOff_tipVisible() {
Settings.Global.putInt(mContentResolver, Settings.Global.APP_STANDBY_ENABLED, 0);
Settings.Global.putInt(mContentResolver,
Settings.Global.ADAPTIVE_BATTERY_MANAGEMENT_ENABLED, 0);
assertThat(mSmartBatteryDetector.detect().isVisible()).isTrue();
}
@Test
public void testDetect_smartBatteryOn_tipInvisible() {
Settings.Global.putInt(mContentResolver, Settings.Global.APP_STANDBY_ENABLED, 1);
Settings.Global.putInt(mContentResolver,
Settings.Global.ADAPTIVE_BATTERY_MANAGEMENT_ENABLED, 1);
assertThat(mSmartBatteryDetector.detect().isVisible()).isFalse();
}