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

Commit 43e38de2 authored by Ruchi Kandoi's avatar Ruchi Kandoi
Browse files

window: Adds a Sustained Performance Mode window flag.



Adds setSustainedPerformanceMode(boolean) API for applications to set
the mode for a given window. The mode will be disabled automatically when the
window is no longer in focus.

Bug: 28150358
Change-Id: Ibe8bc564eeaaccbcaad5c4f792cda16da931dffd
Signed-off-by: default avatarRuchi Kandoi <kandoiruchi@google.com>
parent 8dd32a56
Loading
Loading
Loading
Loading
+1 −0
Original line number Original line Diff line number Diff line
@@ -43627,6 +43627,7 @@ package android.view {
    method public void setSharedElementsUseOverlay(boolean);
    method public void setSharedElementsUseOverlay(boolean);
    method public void setSoftInputMode(int);
    method public void setSoftInputMode(int);
    method public abstract void setStatusBarColor(int);
    method public abstract void setStatusBarColor(int);
    method public void setSustainedPerformanceMode(boolean);
    method public abstract void setTitle(java.lang.CharSequence);
    method public abstract void setTitle(java.lang.CharSequence);
    method public abstract deprecated void setTitleColor(int);
    method public abstract deprecated void setTitleColor(int);
    method public void setTransitionBackgroundFadeDuration(long);
    method public void setTransitionBackgroundFadeDuration(long);
+1 −0
Original line number Original line Diff line number Diff line
@@ -46573,6 +46573,7 @@ package android.view {
    method public void setSharedElementsUseOverlay(boolean);
    method public void setSharedElementsUseOverlay(boolean);
    method public void setSoftInputMode(int);
    method public void setSoftInputMode(int);
    method public abstract void setStatusBarColor(int);
    method public abstract void setStatusBarColor(int);
    method public void setSustainedPerformanceMode(boolean);
    method public abstract void setTitle(java.lang.CharSequence);
    method public abstract void setTitle(java.lang.CharSequence);
    method public abstract deprecated void setTitleColor(int);
    method public abstract deprecated void setTitleColor(int);
    method public void setTransitionBackgroundFadeDuration(long);
    method public void setTransitionBackgroundFadeDuration(long);
+1 −0
Original line number Original line Diff line number Diff line
@@ -43704,6 +43704,7 @@ package android.view {
    method public void setSharedElementsUseOverlay(boolean);
    method public void setSharedElementsUseOverlay(boolean);
    method public void setSoftInputMode(int);
    method public void setSoftInputMode(int);
    method public abstract void setStatusBarColor(int);
    method public abstract void setStatusBarColor(int);
    method public void setSustainedPerformanceMode(boolean);
    method public abstract void setTitle(java.lang.CharSequence);
    method public abstract void setTitle(java.lang.CharSequence);
    method public abstract deprecated void setTitleColor(int);
    method public abstract deprecated void setTitleColor(int);
    method public void setTransitionBackgroundFadeDuration(long);
    method public void setTransitionBackgroundFadeDuration(long);
+6 −2
Original line number Original line Diff line number Diff line
@@ -55,12 +55,16 @@ public abstract class PowerManagerInternal {




    /**
    /**
     * Power hint: The user is interacting with the device. The corresponding data field must be
     * Power hint:
     * Interaction: The user is interacting with the device. The corresponding data field must be
     * the expected duration of the fling, or 0 if unknown.
     * the expected duration of the fling, or 0 if unknown.
     *
     *
     * This must be kept in sync with the values in hardware/libhardware/include/hardware/power.h
     * Sustained Performance Mode: Enable/Disables Sustained Performance Mode.
     *
     * These must be kept in sync with the values in hardware/libhardware/include/hardware/power.h
     */
     */
    public static final int POWER_HINT_INTERACTION = 2;
    public static final int POWER_HINT_INTERACTION = 2;
    public static final int POWER_HINT_SUSTAINED_PERFORMANCE_MODE = 6;


    public static String wakefulnessToString(int wakefulness) {
    public static String wakefulnessToString(int wakefulness) {
        switch (wakefulness) {
        switch (wakefulness) {
+9 −0
Original line number Original line Diff line number Diff line
@@ -1177,6 +1177,15 @@ public abstract class Window {
        return false;
        return false;
    }
    }


    /* Sets the Sustained Performance requirement for the calling window.
     * @param enable disables or enables the mode.
     */
    public void setSustainedPerformanceMode(boolean enable) {
        setPrivateFlags(enable
                ? WindowManager.LayoutParams.PRIVATE_FLAG_SUSTAINED_PERFORMANCE_MODE : 0,
                WindowManager.LayoutParams.PRIVATE_FLAG_SUSTAINED_PERFORMANCE_MODE);
    }

    private boolean isOutOfBounds(Context context, MotionEvent event) {
    private boolean isOutOfBounds(Context context, MotionEvent event) {
        final int x = (int) event.getX();
        final int x = (int) event.getX();
        final int y = (int) event.getY();
        final int y = (int) event.getY();
Loading