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

Commit c48b5eff authored by Makoto Onuki's avatar Makoto Onuki Committed by Android (Google) Code Review
Browse files

Merge "Update the comment on LOW_POWER_MODE_TRIGGER_LEVEL in PowerUI"

parents 1eb7d64a 45a772e4
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -10750,14 +10750,14 @@ public final class Settings {
        public static final String LOW_POWER_MODE = "low_power";

        /**
         * Battery level [1-99] at which low power mode automatically turns on.
         * Battery level [1-100] at which low power mode automatically turns on.
         * If 0, it will not automatically turn on.
         * @hide
         */
        public static final String LOW_POWER_MODE_TRIGGER_LEVEL = "low_power_trigger_level";

        private static final Validator LOW_POWER_MODE_TRIGGER_LEVEL_VALIDATOR =
                new SettingsValidators.InclusiveIntegerRangeValidator(0, 99);
                new SettingsValidators.InclusiveIntegerRangeValidator(0, 100);

         /**
         * If not 0, the activity manager will aggressively finish activities and
+6 −2
Original line number Diff line number Diff line
@@ -142,8 +142,12 @@ public class PowerUI extends SystemUI {
        final int lowPowerModeTriggerLevel = Settings.Global.getInt(resolver,
                Settings.Global.LOW_POWER_MODE_TRIGGER_LEVEL, defWarnLevel);

        // NOTE: Keep the logic in sync with BatteryService.
        // TODO: Propagate this value from BatteryService to system UI, really.
        // Note LOW_POWER_MODE_TRIGGER_LEVEL can take any value between 0 and 100, but
        // for the UI purposes, let's cap it at 15% -- i.e. even if the trigger level is higher
        // like 50%, let's not show the "low battery" notification until it hits
        // config_lowBatteryWarningLevel, which is 15% by default.
        // LOW_POWER_MODE_TRIGGER_LEVEL is still used in other places as-is. For example, if it's
        // 50, then battery saver kicks in when the battery level hits 50%.
        int warnLevel =  Math.min(defWarnLevel, lowPowerModeTriggerLevel);

        if (warnLevel == 0) {