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

Commit cbdd749a authored by Steve Kondik's avatar Steve Kondik Committed by Brint E. Kriebel
Browse files

perf: Send a boost hint when a key on the navbar is pressed

 * A lot of stuff happens, especially when invoking recents.
 * Get ahead of the storm by sending a boost hint before
   kicking off the animations.

Change-Id: I0cecd0c58f8bc8479ea44f63af796500d7b9d7d2
parent 505f89bc
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -26,6 +26,7 @@ import android.graphics.Canvas;
import android.graphics.RectF;
import android.graphics.drawable.Drawable;
import android.hardware.input.InputManager;
import android.os.PowerManager;
import android.os.SystemClock;
import android.util.AttributeSet;
import android.util.Log;
@@ -70,6 +71,8 @@ public class KeyButtonView extends ImageView {
    AnimatorSet mPressedAnim;
    Animator mAnimateToQuiescent = new ObjectAnimator();

    private PowerManager mPm;

    Runnable mCheckLongPress = new Runnable() {
        public void run() {
            if (isPressed()) {
@@ -110,6 +113,7 @@ public class KeyButtonView extends ImageView {

        setClickable(true);
        mTouchSlop = ViewConfiguration.get(context).getScaledTouchSlop();
        mPm = (PowerManager) context.getSystemService(Context.POWER_SERVICE);
    }

    public void updateResources() {
@@ -216,6 +220,10 @@ public class KeyButtonView extends ImageView {
    public void setPressed(boolean pressed) {
        if (mGlowBG != null) {
            if (pressed != isPressed()) {

                // A lot of stuff is about to happen. Lets get ready.
                mPm.cpuBoost(750000);

                if (mPressedAnim != null && mPressedAnim.isRunning()) {
                    mPressedAnim.cancel();
                }