Merge "Hook up Adaptive Battery to new flag." into pi-dev
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user