Skip to content

Commit 07800a5

Browse files
dsandlerAndroid (Google) Code Review
authored andcommitted
Merge "Put the status bar and navigation bar in HW when advisable."
2 parents f9f0461 + c638c1e commit 07800a5

File tree

3 files changed

+19
-2
lines changed

3 files changed

+19
-2
lines changed

packages/SystemUI/src/com/android/systemui/statusbar/StatusBar.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
package com.android.systemui.statusbar;
1818

19+
import android.app.ActivityManager;
1920
import android.app.Service;
2021
import android.content.Context;
2122
import android.content.Intent;
@@ -26,6 +27,7 @@
2627
import android.os.ServiceManager;
2728
import android.util.Slog;
2829
import android.util.Log;
30+
import android.view.Display;
2931
import android.view.Gravity;
3032
import android.view.View;
3133
import android.view.ViewGroup;
@@ -117,6 +119,15 @@ public void start() {
117119
| WindowManager.LayoutParams.FLAG_TOUCHABLE_WHEN_WAKING
118120
| WindowManager.LayoutParams.FLAG_SPLIT_TOUCH,
119121
PixelFormat.RGBX_8888);
122+
123+
// the status bar should be in an overlay if possible
124+
final Display defaultDisplay
125+
= ((WindowManager)mContext.getSystemService(Context.WINDOW_SERVICE))
126+
.getDefaultDisplay();
127+
if (ActivityManager.isHighEndGfx(defaultDisplay)) {
128+
lp.flags |= WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED;
129+
}
130+
120131
lp.gravity = getStatusBarGravity();
121132
lp.setTitle("StatusBar");
122133
lp.packageName = mContext.getPackageName();

packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -475,6 +475,10 @@ private WindowManager.LayoutParams getNavigationBarLayoutParams() {
475475
| WindowManager.LayoutParams.FLAG_SPLIT_TOUCH
476476
| WindowManager.LayoutParams.FLAG_SLIPPERY,
477477
PixelFormat.OPAQUE);
478+
// this will allow the navbar to run in an overlay on devices that support this
479+
if (ActivityManager.isHighEndGfx(mDisplay)) {
480+
lp.flags |= WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED;
481+
}
478482

479483
lp.setTitle("NavigationBar");
480484
switch (rotation) {

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ public class KeyButtonView extends ImageView {
6060
Drawable mGlowBG;
6161
float mGlowAlpha = 0f, mGlowScale = 1f, mDrawingAlpha = 1f;
6262
boolean mSupportsLongpress = true;
63+
RectF mRect = new RectF(0f,0f,0f,0f);
6364

6465
Runnable mCheckLongPress = new Runnable() {
6566
public void run() {
@@ -120,8 +121,9 @@ protected void onDraw(Canvas canvas) {
120121
mGlowBG.setAlpha((int)(mGlowAlpha * 255));
121122
mGlowBG.draw(canvas);
122123
canvas.restore();
123-
124-
canvas.saveLayerAlpha(null, (int)(mDrawingAlpha * 255), Canvas.ALL_SAVE_FLAG);
124+
mRect.right = w;
125+
mRect.bottom = h;
126+
canvas.saveLayerAlpha(mRect, (int)(mDrawingAlpha * 255), Canvas.ALL_SAVE_FLAG);
125127
}
126128
super.onDraw(canvas);
127129
if (mGlowBG != null) {

0 commit comments

Comments
 (0)