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

am: 59ba07c2da

Change-Id: I875f0264133f8358b4f85ccba18b672c0a05015f
This commit is contained in:
Lei Yu
2018-04-26 15:39:01 -07:00
committed by android-build-merger
7 changed files with 19 additions and 14 deletions

View File

@@ -52,15 +52,15 @@ public class SmartBatteryPreferenceController extends BasePreferenceController i
public void updateState(Preference preference) {
super.updateState(preference);
final boolean smartBatteryOn = Settings.Global.getInt(mContext.getContentResolver(),
Settings.Global.APP_STANDBY_ENABLED, ON) == ON;
Settings.Global.ADAPTIVE_BATTERY_MANAGEMENT_ENABLED, ON) == ON;
((SwitchPreference) preference).setChecked(smartBatteryOn);
}
@Override
public boolean onPreferenceChange(Preference preference, Object newValue) {
final boolean smartBatteryOn = (Boolean) newValue;
Settings.Global.putInt(mContext.getContentResolver(), Settings.Global.APP_STANDBY_ENABLED,
smartBatteryOn ? ON : OFF);
Settings.Global.putInt(mContext.getContentResolver(),
Settings.Global.ADAPTIVE_BATTERY_MANAGEMENT_ENABLED, smartBatteryOn ? ON : OFF);
return true;
}
}