Remove the 'schedule by routine' from the saver scheduler

Fix: 258603978
Test: make RunSettingsRoboTests
Change-Id: I6256957dc5a4be6699998c825fb32e03f638af39
This commit is contained in:
ykhung
2022-11-14 11:24:17 +08:00
parent d66fd82c35
commit a2f5c5a24e
3 changed files with 7 additions and 14 deletions

View File

@@ -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);
}
}

View File

@@ -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;
}
}

View File

@@ -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,