Remove the 'schedule by routine' from the saver scheduler
Fix: 258603978 Test: make RunSettingsRoboTests Change-Id: I6256957dc5a4be6699998c825fb32e03f638af39
This commit is contained in:
@@ -24,6 +24,7 @@ import android.provider.Settings;
|
|||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
import com.android.settings.fuelgauge.batterysaver.BatterySaverScheduleRadioButtonsController;
|
import com.android.settings.fuelgauge.batterysaver.BatterySaverScheduleRadioButtonsController;
|
||||||
|
import com.android.settingslib.fuelgauge.BatterySaverUtils;
|
||||||
|
|
||||||
/** Execute battery settings migration tasks in the device booting stage. */
|
/** Execute battery settings migration tasks in the device booting stage. */
|
||||||
public final class BatterySettingsMigrateChecker extends BroadcastReceiver {
|
public final class BatterySettingsMigrateChecker extends BroadcastReceiver {
|
||||||
@@ -52,5 +53,7 @@ public final class BatterySettingsMigrateChecker extends BroadcastReceiver {
|
|||||||
BatterySaverScheduleRadioButtonsController.TRIGGER_LEVEL_MIN);
|
BatterySaverScheduleRadioButtonsController.TRIGGER_LEVEL_MIN);
|
||||||
Log.w(TAG, "Reset invalid scheduled battery level from: " + threshold);
|
Log.w(TAG, "Reset invalid scheduled battery level from: " + threshold);
|
||||||
}
|
}
|
||||||
|
// Force removing the 'schedule by routine' state.
|
||||||
|
BatterySaverUtils.revertScheduleToNoneIfNeeded(context);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -117,7 +117,9 @@ public class BatterySaverScheduleRadioButtonsController {
|
|||||||
if (mode == PowerManager.POWER_SAVE_MODE_TRIGGER_DYNAMIC || triggerLevel != 0) {
|
if (mode == PowerManager.POWER_SAVE_MODE_TRIGGER_DYNAMIC || triggerLevel != 0) {
|
||||||
BatterySaverUtils.suppressAutoBatterySaver(mContext);
|
BatterySaverUtils.suppressAutoBatterySaver(mContext);
|
||||||
}
|
}
|
||||||
mSeekBarController.updateSeekBar();
|
if (mSeekBarController != null) {
|
||||||
|
mSeekBarController.updateSeekBar();
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -122,24 +122,12 @@ public class BatterySaverScheduleSettings extends RadioButtonPickerFragment {
|
|||||||
protected List<? extends CandidateInfo> getCandidates() {
|
protected List<? extends CandidateInfo> getCandidates() {
|
||||||
Context context = getContext();
|
Context context = getContext();
|
||||||
List<CandidateInfo> candidates = Lists.newArrayList();
|
List<CandidateInfo> candidates = Lists.newArrayList();
|
||||||
String routineProviderApp = getContext().getResources()
|
|
||||||
.getString(com.android.internal.R.string.config_batterySaverScheduleProvider);
|
|
||||||
candidates.add(new BatterySaverScheduleCandidateInfo(
|
candidates.add(new BatterySaverScheduleCandidateInfo(
|
||||||
context.getText(R.string.battery_saver_auto_no_schedule),
|
context.getText(R.string.battery_saver_auto_no_schedule),
|
||||||
/* summary */ null,
|
/* summary */ null,
|
||||||
BatterySaverScheduleRadioButtonsController.KEY_NO_SCHEDULE,
|
BatterySaverScheduleRadioButtonsController.KEY_NO_SCHEDULE,
|
||||||
/* enabled */ true));
|
/* enabled */ true));
|
||||||
// only add routine option if an app has been specified
|
BatterySaverUtils.revertScheduleToNoneIfNeeded(context);
|
||||||
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(
|
candidates.add(new BatterySaverScheduleCandidateInfo(
|
||||||
context.getText(R.string.battery_saver_auto_percentage),
|
context.getText(R.string.battery_saver_auto_percentage),
|
||||||
/* summary */ null,
|
/* summary */ null,
|
||||||
|
Reference in New Issue
Block a user