Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit cbd35ab0 authored by Salvador Martinez's avatar Salvador Martinez
Browse files

Fix sticky battery saver toggle

It was persisting to settings secure instead of settings global.

Test: robotests pass
Bug: 128929858
Change-Id: I8c5bcc875d71096e70f1a70ec84e85d46c3abe43
parent e7668660
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -19,7 +19,7 @@ public class BatterySaverStickyPreferenceController extends BasePreferenceContro

    @Override
    public void updateState(Preference preference) {
        int setting = Settings.System.getInt(mContext.getContentResolver(),
        int setting = Settings.Global.getInt(mContext.getContentResolver(),
                LOW_POWER_STICKY_AUTO_DISABLE_ENABLED, 1);

        ((SwitchPreference) preference).setChecked(setting == 0);
@@ -28,7 +28,7 @@ public class BatterySaverStickyPreferenceController extends BasePreferenceContro
    @Override
    public boolean onPreferenceChange(Preference preference, Object newValue) {
        boolean keepActive = (Boolean) newValue;
        Settings.System.putInt(mContext.getContentResolver(),
        Settings.Global.putInt(mContext.getContentResolver(),
                LOW_POWER_STICKY_AUTO_DISABLE_ENABLED,
                keepActive ? 0 : 1);
        return true;
+1 −1
Original line number Diff line number Diff line
@@ -42,7 +42,7 @@ public class BatterySaverStickyPreferenceControllerTest {
    }

    private int getAutoDisableSetting() {
        return Settings.System.getInt(mContext.getContentResolver(),
        return Settings.Global.getInt(mContext.getContentResolver(),
                LOW_POWER_STICKY_AUTO_DISABLE_ENABLED,
                1);
    }