Skip to content

Commit 74e402e

Browse files
hyperb1isscodex-corp
authored andcommitted
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
1 parent e326127 commit 74e402e

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyButtonView.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
import android.graphics.drawable.BitmapDrawable;
2727
import android.graphics.drawable.Drawable;
2828
import android.net.Uri;
29+
import android.os.PowerManager;
2930
import android.os.SystemClock;
3031
import android.util.AttributeSet;
3132
import android.util.Log;
@@ -71,6 +72,7 @@ public class KeyButtonView extends ImageView {
7172
Animator mAnimateToQuiescent = new ObjectAnimator();
7273

7374
AwesomeButtonInfo mActions;
75+
private PowerManager mPm;
7476

7577
boolean mHasSingleAction = true, mHasDoubleAction, mHasLongAction;
7678

@@ -110,6 +112,7 @@ public KeyButtonView(Context context, AttributeSet attrs, int defStyle) {
110112
mGlowBgId = a.getResourceId(R.styleable.KeyButtonView_glowBackground, 0);
111113
setClickable(true);
112114
mTouchSlop = ViewConfiguration.get(context).getScaledTouchSlop();
115+
mPm = (PowerManager) context.getSystemService(Context.POWER_SERVICE);
113116
mSinglePressTimeout = 200;
114117
mDoubleTapTimeout = 200;
115118
mLongPressTimeout = ViewConfiguration.getLongPressTimeout();
@@ -248,6 +251,10 @@ public void setGlowScale(float x) {
248251
public void setPressed(boolean pressed) {
249252
if (mGlowBG != null) {
250253
if (pressed != isPressed()) {
254+
255+
// A lot of stuff is about to happen. Lets get ready.
256+
mPm.cpuBoost(750000);
257+
251258
if (mPressedAnim != null && mPressedAnim.isRunning()) {
252259
mPressedAnim.cancel();
253260
}

0 commit comments

Comments
 (0)