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

Commit 10a4a64b authored by Chris Phoenix's avatar Chris Phoenix
Browse files

SidekickService (base)

Test: builds; Sidekick watch face animates in Ambient
Change-Id: I5946dbf7194653ac4707b6c186b0a9197d125d5f
parent 599ef469
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -44520,6 +44520,7 @@ package android.view {
    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_ON_SUSPEND = 6; // 0x6
    field public static final int STATE_UNKNOWN = 0; // 0x0
    field public static final int STATE_VR = 5; // 0x5
  }
+1 −0
Original line number Diff line number Diff line
@@ -48253,6 +48253,7 @@ package android.view {
    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_ON_SUSPEND = 6; // 0x6
    field public static final int STATE_UNKNOWN = 0; // 0x0
    field public static final int STATE_VR = 5; // 0x5
  }
+1 −0
Original line number Diff line number Diff line
@@ -45095,6 +45095,7 @@ package android.view {
    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_ON_SUSPEND = 6; // 0x6
    field public static final int STATE_UNKNOWN = 0; // 0x0
    field public static final int STATE_VR = 5; // 0x5
  }
+16 −10
Original line number Diff line number Diff line
@@ -680,8 +680,8 @@ public class DreamService extends Service implements Window.Callback {
     *
     * @return The screen state to use while dozing, such as {@link Display#STATE_ON},
     * {@link Display#STATE_DOZE}, {@link Display#STATE_DOZE_SUSPEND},
     * or {@link Display#STATE_OFF}, or {@link Display#STATE_UNKNOWN} for the default
     * behavior.
     * {@link Display#STATE_ON_SUSPEND}, {@link Display#STATE_OFF}, or {@link Display#STATE_UNKNOWN}
     * for the default behavior.
     *
     * @see #setDozeScreenState
     * @hide For use by system UI components only.
@@ -700,12 +700,18 @@ public class DreamService extends Service implements Window.Callback {
     * perform transitions between states while dozing to conserve power and
     * achieve various effects.
     * </p><p>
     * It is recommended that the state be set to {@link Display#STATE_DOZE_SUSPEND}
     * once the dream has completely finished drawing and before it releases its wakelock
     * to allow the display hardware to be fully suspended.  While suspended, the
     * display will preserve its on-screen contents or hand off control to dedicated
     * doze hardware if the devices supports it.  If the doze suspend state is
     * used, the dream must make sure to set the mode back
     * Some devices will have dedicated hardware ("Sidekick") to animate
     * the display content while the CPU sleeps. If the dream and the hardware support
     * this, {@link Display#STATE_ON_SUSPEND} or {@link Display#STATE_DOZE_SUSPEND}
     * will switch control to the Sidekick.
     * </p><p>
     * If not using Sidekick, it is recommended that the state be set to
     * {@link Display#STATE_DOZE_SUSPEND} once the dream has completely
     * finished drawing and before it releases its wakelock
     * to allow the display hardware to be fully suspended.  While suspended,
     * the display will preserve its on-screen contents.
     * </p><p>
     * If the doze suspend state is used, the dream must make sure to set the mode back
     * to {@link Display#STATE_DOZE} or {@link Display#STATE_ON} before drawing again
     * since the display updates may be ignored and not seen by the user otherwise.
     * </p><p>
@@ -716,8 +722,8 @@ public class DreamService extends Service implements Window.Callback {
     *
     * @param state The screen state to use while dozing, such as {@link Display#STATE_ON},
     * {@link Display#STATE_DOZE}, {@link Display#STATE_DOZE_SUSPEND},
     * or {@link Display#STATE_OFF}, or {@link Display#STATE_UNKNOWN} for the default
     * behavior.
     * {@link Display#STATE_ON_SUSPEND}, {@link Display#STATE_OFF}, or {@link Display#STATE_UNKNOWN}
     * for the default behavior.
     *
     * @hide For use by system UI components only.
     */
+21 −8
Original line number Diff line number Diff line
@@ -294,11 +294,10 @@ public final class Display {

    /**
     * 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.
     * on but the CPU is not updating it. This may be used in one of two ways: to show
     * static system-provided content while the device is non-interactive, or to allow
     * a "Sidekick" compute resource to update the display. For this reason, the
     * CPU must not control the display in this mode.
     *
     * @see #getState
     * @see android.os.PowerManager#isInteractive
@@ -313,6 +312,18 @@ public final class Display {
     */
    public static final int STATE_VR = 5;

    /**
     * Display state: The display is in a suspended full power state; it is still
     * on but the CPU is not updating it. This may be used in one of two ways: to show
     * static system-provided content while the device is non-interactive, or to allow
     * a "Sidekick" compute resource to update the display. For this reason, the
     * CPU must not control the display in this mode.
     *
     * @see #getState
     * @see android.os.PowerManager#isInteractive
     */
    public static final int STATE_ON_SUSPEND = 6;

    /* The color mode constants defined below must be kept in sync with the ones in
     * system/core/include/system/graphics-base.h */

@@ -994,7 +1005,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_DOZE}, {@link #STATE_DOZE_SUSPEND}, or
     * {@link #STATE_DOZE}, {@link #STATE_DOZE_SUSPEND}, {@link #STATE_ON_SUSPEND}, or
     * {@link #STATE_UNKNOWN}.
     */
    public int getState() {
@@ -1113,6 +1124,8 @@ public final class Display {
                return "DOZE_SUSPEND";
            case STATE_VR:
                return "VR";
            case STATE_ON_SUSPEND:
                return "ON_SUSPEND";
            default:
                return Integer.toString(state);
        }
@@ -1120,11 +1133,11 @@ public final class Display {

    /**
     * Returns true if display updates may be suspended while in the specified
     * display power state.
     * display power state. In SUSPEND states, updates are absolutely forbidden.
     * @hide
     */
    public static boolean isSuspendedState(int state) {
        return state == STATE_OFF || state == STATE_DOZE_SUSPEND;
        return state == STATE_OFF || state == STATE_DOZE_SUSPEND || state == STATE_ON_SUSPEND;
    }

    /**
Loading