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

Commit 2d281dfe authored by Oleg Kibirev's avatar Oleg Kibirev Committed by Android (Google) Code Review
Browse files

Merge "Add a PowerManager @SystemApi to start a dream"

parents 2dd69394 2385b5ef
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -4109,6 +4109,7 @@ package android.os {
  }

  public final class PowerManager {
    method public void dream(long);
    method public int getPowerSaveMode();
    method public boolean setDynamicPowerSavings(boolean, int);
    method public boolean setPowerSaveMode(boolean);
+24 −0
Original line number Diff line number Diff line
@@ -24,6 +24,7 @@ import android.annotation.SystemApi;
import android.annotation.SystemService;
import android.annotation.TestApi;
import android.content.Context;
import android.service.dreams.Sandman;
import android.util.Log;
import android.util.proto.ProtoOutputStream;

@@ -1000,6 +1001,29 @@ public final class PowerManager {
        }
    }

    /**
     * Requests the device to start dreaming.
     * <p>
     * If dream can not be started, for example if another {@link PowerManager} transition is in
     * progress, does nothing. Unlike {@link #nap(long)}, this does not put device to sleep when
     * dream ends.
     * </p><p>
     * Requires the {@link android.Manifest.permission#WRITE_DREAM_STATE} permission.
     * </p>
     *
     * @param time The time when the request to nap was issued, in the
     * {@link SystemClock#uptimeMillis()} time base.  This timestamp may be used to correctly
     * order the dream request with other power management functions.  It should be set
     * to the timestamp of the input event that caused the request to dream.
     *
     * @hide
     */
    @SystemApi
    @RequiresPermission(android.Manifest.permission.WRITE_DREAM_STATE)
    public void dream(long time) {
        Sandman.startDreamByUserRequest(mContext);
    }

    /**
     * Boosts the brightness of the screen to maximum for a predetermined
     * period of time.  This is used to make the screen more readable in bright