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

Commit abb95aec authored by Robert Horvath's avatar Robert Horvath
Browse files

Add API to configure LPS maintenance mode behavior

Allow Low Power Standby to be active during doze maintenance modes.

Bug: 190822356
Test: atest LowPowerStandbyControllerTest
Change-Id: I6db6e1a37f48d63d618245f308ea1053c45fb64b
parent e57eb6d0
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -9134,6 +9134,7 @@ package android.os {
    method @RequiresPermission(anyOf={android.Manifest.permission.BATTERY_PREDICTION, android.Manifest.permission.DEVICE_POWER}) public void setBatteryDischargePrediction(@NonNull java.time.Duration, boolean);
    method @RequiresPermission(android.Manifest.permission.POWER_SAVER) public boolean setDynamicPowerSaveHint(boolean, int);
    method @RequiresPermission(anyOf={android.Manifest.permission.DEVICE_POWER, android.Manifest.permission.POWER_SAVER}) public boolean setFullPowerSavePolicy(@NonNull android.os.BatterySaverPolicyConfig);
    method @RequiresPermission(anyOf={android.Manifest.permission.MANAGE_LOW_POWER_STANDBY, android.Manifest.permission.DEVICE_POWER}) public void setLowPowerStandbyActiveDuringMaintenance(boolean);
    method @RequiresPermission(anyOf={android.Manifest.permission.MANAGE_LOW_POWER_STANDBY, android.Manifest.permission.DEVICE_POWER}) public void setLowPowerStandbyEnabled(boolean);
    method @RequiresPermission(anyOf={android.Manifest.permission.DEVICE_POWER, android.Manifest.permission.POWER_SAVER}) public boolean setPowerSaveModeEnabled(boolean);
    method @RequiresPermission(android.Manifest.permission.WRITE_DREAM_STATE) public void suppressAmbientDisplay(@NonNull String, boolean);
+1 −0
Original line number Diff line number Diff line
@@ -68,6 +68,7 @@ interface IPowerManager
    boolean isLowPowerStandbySupported();
    boolean isLowPowerStandbyEnabled();
    void setLowPowerStandbyEnabled(boolean enabled);
    void setLowPowerStandbyActiveDuringMaintenance(boolean activeDuringMaintenance);
    void forceLowPowerStandbyActive(boolean active);

    @UnsupportedAppUsage
+21 −0
Original line number Diff line number Diff line
@@ -2214,6 +2214,27 @@ public final class PowerManager {
        }
    }

    /**
     * Set whether Low Power Standby should be active during doze maintenance mode.
     * Does nothing if Low Power Standby is not supported.
     *
     * @see #isLowPowerStandbySupported()
     * @see #isLowPowerStandbyEnabled()
     * @hide
     */
    @SystemApi
    @RequiresPermission(anyOf = {
            android.Manifest.permission.MANAGE_LOW_POWER_STANDBY,
            android.Manifest.permission.DEVICE_POWER
    })
    public void setLowPowerStandbyActiveDuringMaintenance(boolean activeDuringMaintenance) {
        try {
            mService.setLowPowerStandbyActiveDuringMaintenance(activeDuringMaintenance);
        } catch (RemoteException e) {
            throw e.rethrowFromSystemServer();
        }
    }

    /**
     * Force Low Power Standby restrictions to be active.
     * Does nothing if Low Power Standby is not supported.
+13 −0
Original line number Diff line number Diff line
@@ -16716,6 +16716,19 @@ public final class Settings {
         */
        public static final String LOW_POWER_STANDBY_ENABLED = "low_power_standby_enabled";
        /**
         * Setting indicating whether Low Power Standby is allowed to be active during doze
         * maintenance mode.
         *
         * Values are:
         * 0: Low Power Standby will be disabled during doze maintenance mode
         * 1: Low Power Standby can be active during doze maintenance mode
         *
         * @hide
         */
        public static final String LOW_POWER_STANDBY_ACTIVE_DURING_MAINTENANCE =
                "low_power_standby_active_during_maintenance";
        /**
         * Settings migrated from Wear OS settings provider.
         * @hide
+1 −0
Original line number Diff line number Diff line
@@ -326,6 +326,7 @@ public class SettingsBackupTest {
                    Settings.Global.LOW_POWER_MODE_TRIGGER_LEVEL_MAX,
                    Settings.Global.LOW_POWER_MODE_STICKY,
                    Settings.Global.LOW_POWER_MODE_SUGGESTION_PARAMS,
                    Settings.Global.LOW_POWER_STANDBY_ACTIVE_DURING_MAINTENANCE,
                    Settings.Global.LOW_POWER_STANDBY_ENABLED,
                    Settings.Global.LTE_SERVICE_FORCED,
                    Settings.Global.LID_BEHAVIOR,
Loading