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

Commit 9ae68e4a authored by Daniel Sandler's avatar Daniel Sandler Committed by The Android Automerger
Browse files

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

This allows the hardware to place these windows into
overlays if possible.

Change-Id: I43717fcd2c7e8f38340975eb93088d1c2c96f09b
parent df22718f
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -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();
+4 −0
Original line number Diff line number Diff line
@@ -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) {
+4 −2
Original line number Diff line number Diff line
@@ -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) {