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

Commit 5dc21914 authored by Jeff Brown's avatar Jeff Brown
Browse files

Add new Display.STATE_DOZE_SUSPEND power state.

Change-Id: Ia62f4f0d25234281dc600d0b7f08b3c6a312db7a
parent 31380e84
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -32571,7 +32571,8 @@ package android.view {
    field public static final int FLAG_PRIVATE = 4; // 0x4
    field public static final int FLAG_SECURE = 2; // 0x2
    field public static final int FLAG_SUPPORTS_PROTECTED_BUFFERS = 1; // 0x1
    field public static final int STATE_DOZING = 3; // 0x3
    field public static final int STATE_DOZE = 3; // 0x3
    field public static final int STATE_DOZE_SUSPEND = 4; // 0x4
    field public static final int STATE_OFF = 1; // 0x1
    field public static final int STATE_ON = 2; // 0x2
    field public static final int STATE_UNKNOWN = 0; // 0x0
+22 −6
Original line number Diff line number Diff line
@@ -225,13 +225,27 @@ public final class Display {
    public static final int STATE_ON = 2;

    /**
     * Display state: The display is dozing in a low-power state; it may be showing
     * system-provided content while the device is in a non-interactive state.
     * Display state: The display is dozing in a low power state; it is still
     * on but is optimized for showing system-provided content while the
     * device is non-interactive.
     *
     * @see #getState
     * @see android.os.PowerManager#isInteractive
     */
    public static final int STATE_DOZING = 3;
    public static final int STATE_DOZE = 3;

    /**
     * Display state: The display is dozing in a suspended low power state; it is still
     * on but is optimized for showing static system-provided content while the device
     * is non-interactive.  This mode may be used to conserve even more power by allowing
     * the hardware to stop applying frame buffer updates from the graphics subsystem or
     * to take over the display and manage it autonomously to implement low power always-on
     * display functionality.
     *
     * @see #getState
     * @see android.os.PowerManager#isInteractive
     */
    public static final int STATE_DOZE_SUSPEND = 4;

    /**
     * Internal method to create a display.
@@ -697,7 +711,7 @@ public final class Display {
     * Gets the state of the display, such as whether it is on or off.
     *
     * @return The state of the display: one of {@link #STATE_OFF}, {@link #STATE_ON},
     * {@link #STATE_DOZING}, or {@link #STATE_UNKNOWN}.
     * {@link #STATE_DOZE}, {@link #STATE_DOZE_SUSPEND}, or {@link #STATE_UNKNOWN}.
     */
    public int getState() {
        synchronized (this) {
@@ -809,8 +823,10 @@ public final class Display {
                return "OFF";
            case STATE_ON:
                return "ON";
            case STATE_DOZING:
                return "DOZING";
            case STATE_DOZE:
                return "DOZE";
            case STATE_DOZE_SUSPEND:
                return "DOZE_SUSPEND";
            default:
                return Integer.toString(state);
        }
+8 −3
Original line number Diff line number Diff line
@@ -213,22 +213,27 @@ public class SurfaceControl {

    /**
     * Display power mode off: used while blanking the screen.
     * Use only with {@link SurfaceControl#setDisplayPowerMode()}.
     * Use only with {@link SurfaceControl#setDisplayPowerMode}.
     */
    public static final int POWER_MODE_OFF = 0;

    /**
     * Display power mode doze: used while putting the screen into low power mode.
     * Use only with {@link SurfaceControl#setDisplayPowerMode()}.
     * Use only with {@link SurfaceControl#setDisplayPowerMode}.
     */
    public static final int POWER_MODE_DOZE = 1;

    /**
     * Display power mode normal: used while unblanking the screen.
     * Use only with {@link SurfaceControl#setDisplayPowerMode()}.
     * Use only with {@link SurfaceControl#setDisplayPowerMode}.
     */
    public static final int POWER_MODE_NORMAL = 2;

    /**
     * Display power mode doze: used while putting the screen into a suspended
     * low power mode.  Use only with {@link SurfaceControl#setDisplayPowerMode}.
     */
    public static final int POWER_MODE_DOZE_SUSPEND = 3;

    /**
     * Create a surface with a name.
+1 −1
Original line number Diff line number Diff line
@@ -558,7 +558,7 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call

                if (mPowerRequest.screenState == DisplayPowerRequest.SCREEN_STATE_DOZE) {
                    if (!mScreenBrightnessRampAnimator.isAnimating()) {
                        setScreenState(Display.STATE_DOZING);
                        setScreenState(Display.STATE_DOZE);
                    }
                } else {
                    setScreenState(Display.STATE_ON);
+3 −1
Original line number Diff line number Diff line
@@ -115,8 +115,10 @@ final class LocalDisplayAdapter extends DisplayAdapter {
        switch (state) {
            case Display.STATE_OFF:
                return SurfaceControl.POWER_MODE_OFF;
            case Display.STATE_DOZING:
            case Display.STATE_DOZE:
                return SurfaceControl.POWER_MODE_DOZE;
            case Display.STATE_DOZE_SUSPEND:
                return SurfaceControl.POWER_MODE_DOZE_SUSPEND;
            default:
                return SurfaceControl.POWER_MODE_NORMAL;
        }