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

Commit a2f5c5a2 authored by ykhung's avatar ykhung
Browse files

Remove the 'schedule by routine' from the saver scheduler

Fix: 258603978
Test: make RunSettingsRoboTests
Change-Id: I6256957dc5a4be6699998c825fb32e03f638af39
parent d66fd82c
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -24,6 +24,7 @@ import android.provider.Settings;
import android.util.Log;

import com.android.settings.fuelgauge.batterysaver.BatterySaverScheduleRadioButtonsController;
import com.android.settingslib.fuelgauge.BatterySaverUtils;

/** Execute battery settings migration tasks in the device booting stage. */
public final class BatterySettingsMigrateChecker extends BroadcastReceiver {
@@ -52,5 +53,7 @@ public final class BatterySettingsMigrateChecker extends BroadcastReceiver {
                    BatterySaverScheduleRadioButtonsController.TRIGGER_LEVEL_MIN);
            Log.w(TAG, "Reset invalid scheduled battery level from: " + threshold);
        }
        // Force removing the 'schedule by routine' state.
        BatterySaverUtils.revertScheduleToNoneIfNeeded(context);
    }
}
+3 −1
Original line number Diff line number Diff line
@@ -117,7 +117,9 @@ public class BatterySaverScheduleRadioButtonsController {
        if (mode == PowerManager.POWER_SAVE_MODE_TRIGGER_DYNAMIC || triggerLevel != 0) {
            BatterySaverUtils.suppressAutoBatterySaver(mContext);
        }
        if (mSeekBarController != null) {
            mSeekBarController.updateSeekBar();
        }
        return true;
    }
}
+1 −13
Original line number Diff line number Diff line
@@ -122,24 +122,12 @@ public class BatterySaverScheduleSettings extends RadioButtonPickerFragment {
    protected List<? extends CandidateInfo> getCandidates() {
        Context context = getContext();
        List<CandidateInfo> candidates = Lists.newArrayList();
        String routineProviderApp = getContext().getResources()
                .getString(com.android.internal.R.string.config_batterySaverScheduleProvider);
        candidates.add(new BatterySaverScheduleCandidateInfo(
                context.getText(R.string.battery_saver_auto_no_schedule),
                /* summary */ null,
                BatterySaverScheduleRadioButtonsController.KEY_NO_SCHEDULE,
                /* enabled */ true));
        // only add routine option if an app has been specified
        if (!TextUtils.isEmpty(routineProviderApp)) {
            candidates.add(new BatterySaverScheduleCandidateInfo(
                    context.getText(R.string.battery_saver_auto_routine),
                    context.getText(R.string.battery_saver_auto_routine_summary),
                    BatterySaverScheduleRadioButtonsController.KEY_ROUTINE,
                    /* enabled */ true));
        } else {
            // Make sure routine is not selected if no provider app is configured
        BatterySaverUtils.revertScheduleToNoneIfNeeded(context);
        }
        candidates.add(new BatterySaverScheduleCandidateInfo(
                context.getText(R.string.battery_saver_auto_percentage),
                /* summary */ null,