Merge "Put the status bar and navigation bar in HW when advisable."

This commit is contained in:
Daniel Sandler
2011-08-25 07:56:26 -07:00
committed by Android (Google) Code Review
3 changed files with 19 additions and 2 deletions

View File

@@ -16,6 +16,7 @@
package com.android.systemui.statusbar;
import android.app.ActivityManager;
import android.app.Service;
import android.content.Context;
import android.content.Intent;
@@ -26,6 +27,7 @@ import android.os.RemoteException;
import android.os.ServiceManager;
import android.util.Slog;
import android.util.Log;
import android.view.Display;
import android.view.Gravity;
import android.view.View;
import android.view.ViewGroup;
@@ -117,6 +119,15 @@ public abstract class StatusBar extends SystemUI implements CommandQueue.Callbac
| WindowManager.LayoutParams.FLAG_TOUCHABLE_WHEN_WAKING
| WindowManager.LayoutParams.FLAG_SPLIT_TOUCH,
PixelFormat.RGBX_8888);
// the status bar should be in an overlay if possible
final Display defaultDisplay
= ((WindowManager)mContext.getSystemService(Context.WINDOW_SERVICE))
.getDefaultDisplay();
if (ActivityManager.isHighEndGfx(defaultDisplay)) {
lp.flags |= WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED;
}
lp.gravity = getStatusBarGravity();
lp.setTitle("StatusBar");
lp.packageName = mContext.getPackageName();

View File

@@ -475,6 +475,10 @@ public class PhoneStatusBar extends StatusBar {
| WindowManager.LayoutParams.FLAG_SPLIT_TOUCH
| WindowManager.LayoutParams.FLAG_SLIPPERY,
PixelFormat.OPAQUE);
// this will allow the navbar to run in an overlay on devices that support this
if (ActivityManager.isHighEndGfx(mDisplay)) {
lp.flags |= WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED;
}
lp.setTitle("NavigationBar");
switch (rotation) {

View File

@@ -60,6 +60,7 @@ public class KeyButtonView extends ImageView {
Drawable mGlowBG;
float mGlowAlpha = 0f, mGlowScale = 1f, mDrawingAlpha = 1f;
boolean mSupportsLongpress = true;
RectF mRect = new RectF(0f,0f,0f,0f);
Runnable mCheckLongPress = new Runnable() {
public void run() {
@@ -120,8 +121,9 @@ public class KeyButtonView extends ImageView {
mGlowBG.setAlpha((int)(mGlowAlpha * 255));
mGlowBG.draw(canvas);
canvas.restore();
canvas.saveLayerAlpha(null, (int)(mDrawingAlpha * 255), Canvas.ALL_SAVE_FLAG);
mRect.right = w;
mRect.bottom = h;
canvas.saveLayerAlpha(mRect, (int)(mDrawingAlpha * 255), Canvas.ALL_SAVE_FLAG);
}
super.onDraw(canvas);
if (mGlowBG != null) {