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

Commit de355670 authored by Sijie Chen's avatar Sijie Chen Committed by Android (Google) Code Review
Browse files

Merge "make battery saver configurable" into main

parents 20dd00a3 1404787c
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -2358,6 +2358,7 @@ package android.os {
  public final class PowerManager {
    method public boolean areAutoPowerSaveModesEnabled();
    method @RequiresPermission(anyOf={android.Manifest.permission.MANAGE_LOW_POWER_STANDBY, android.Manifest.permission.DEVICE_POWER}) public void forceLowPowerStandbyActive(boolean);
    method public boolean isBatterySaverSupported();
    field public static final String ACTION_ENHANCED_DISCHARGE_PREDICTION_CHANGED = "android.os.action.ENHANCED_DISCHARGE_PREDICTION_CHANGED";
    field @RequiresPermission(android.Manifest.permission.DEVICE_POWER) public static final int SYSTEM_WAKELOCK = -2147483648; // 0x80000000
  }
+1 −0
Original line number Diff line number Diff line
@@ -60,6 +60,7 @@ interface IPowerManager
    boolean isPowerSaveMode();
    PowerSaveState getPowerSaveState(int serviceType);
    boolean setPowerSaveModeEnabled(boolean mode);
    boolean isBatterySaverSupported();
    BatterySaverPolicyConfig getFullPowerSavePolicy();
    boolean setFullPowerSavePolicy(in BatterySaverPolicyConfig config);
    boolean setDynamicPowerSaveHint(boolean powerSaveHint, int disableThreshold);
+14 −0
Original line number Diff line number Diff line
@@ -1935,6 +1935,20 @@ public final class PowerManager {
        }
    }

    /**
     * Returns true if Battery Saver is supported on this device.
     *
     * @hide
     */
    @TestApi
    public boolean isBatterySaverSupported() {
        try {
            return mService.isBatterySaverSupported();
        } catch (RemoteException e) {
            throw e.rethrowFromSystemServer();
        }
    }

    /**
     * Gets the current policy for full power save mode.
     *
+4 −0
Original line number Diff line number Diff line
@@ -26,6 +26,10 @@
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
    <string translatable="false" name="config_batterySaverDeviceSpecificConfig"></string>

    <!-- Whether or not the device supports battery saver. If false, battery saver will be
     disabled. -->
    <bool name="config_batterySaverSupported">true</bool>

    <!-- Whether or not battery saver should be "sticky" when manually enabled. -->
    <bool name="config_batterySaverStickyBehaviourDisabled">false</bool>

+1 −0
Original line number Diff line number Diff line
@@ -4019,6 +4019,7 @@

  <!-- Battery saver config -->
  <java-symbol type="integer" name="config_lowBatteryAutoTriggerDefaultLevel" />
  <java-symbol type="bool" name="config_batterySaverSupported" />
  <java-symbol type="string" name="config_batterySaverDeviceSpecificConfig" />
  <java-symbol type="bool" name="config_batterySaverStickyBehaviourDisabled" />
  <java-symbol type="integer" name="config_dynamicPowerSavingsDefaultDisableThreshold" />
Loading