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

Commit 1b365921 authored by Jim Miller's avatar Jim Miller
Browse files

Fix 3201849: Enable hardware acceleration in LockScreen WaveView [DO NOT MERGE]

Change-Id: I07bbed7843857158cd2c1ffd9b184bde7fd5860d
parent 2fc79763
Loading
Loading
Loading
Loading
+11 −5
Original line number Diff line number Diff line
@@ -498,14 +498,20 @@ public final class ViewRoot extends Handler implements ViewParent,
        mAttachInfo.mHardwareAccelerationRequested = false;

        // Try to enable hardware acceleration if requested
        if (attrs != null &&
                (attrs.flags & WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED) != 0) {
        final boolean hardwareAccelerated = 
                (attrs.flags & WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED) != 0;

        if (attrs != null && hardwareAccelerated) {
            // Only enable hardware acceleration if we are not in the system process
            // The window manager creates ViewRoots to display animated preview windows
            // of launching apps and we don't want those to be hardware accelerated
            if (!HardwareRenderer.sRendererDisabled) {

            final boolean systemHwAccelerated =
                (attrs.flags & WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED_SYSTEM) != 0;

            if (!HardwareRenderer.sRendererDisabled || systemHwAccelerated) {
                // Don't enable hardware acceleration when we're not on the main thread
                if (Looper.getMainLooper() != Looper.myLooper()) {
                if (!systemHwAccelerated && Looper.getMainLooper() != Looper.myLooper()) {
                    Log.w(HardwareRenderer.LOG_TAG, "Attempting to initialize hardware "
                            + "acceleration outside of the main thread, aborting");
                    return;
+11 −0
Original line number Diff line number Diff line
@@ -666,6 +666,17 @@ public interface WindowManager extends ViewManager {
         */
        public static final int FLAG_HARDWARE_ACCELERATED = 0x01000000;
        
        /**
         * Like {@link #FLAG_HARDWARE_ACCELERATED} except for trusted system windows
         * that need hardware acceleration (e.g. LockScreen), where hardware acceleration
         * is generally disabled. This flag must be specified in addition to 
         * {@link #FLAG_HARDWARE_ACCELERATED} to enable hardware acceleration for system
         * windows.
         * 
         * @hide
         */
        public static final int FLAG_HARDWARE_ACCELERATED_SYSTEM = 0x02000000;

        // ----- HIDDEN FLAGS.
        // These start at the high bit and go down.
        
+1 −1
Original line number Diff line number Diff line
@@ -40,7 +40,7 @@ import com.android.internal.R;
public class WaveView extends View implements ValueAnimator.AnimatorUpdateListener {
    private static final String TAG = "WaveView";
    private static final boolean DBG = false;
    private static final int WAVE_COUNT = 5; // default wave count
    private static final int WAVE_COUNT = 20; // default wave count
    private static final long VIBRATE_SHORT = 20;  // msec
    private static final long VIBRATE_LONG = 20;  // msec

+3 −1
Original line number Diff line number Diff line
@@ -103,6 +103,8 @@ public class KeyguardViewManager implements KeyguardWindowController {
            int flags = WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN
                    | WindowManager.LayoutParams.FLAG_SHOW_WALLPAPER
                    | WindowManager.LayoutParams.FLAG_KEEP_SURFACE_WHILE_ANIMATING
                    | WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED
                    | WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED_SYSTEM
                    /*| WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN
                    | WindowManager.LayoutParams.FLAG_LAYOUT_INSET_DECOR*/ ;
            if (!mNeedsInput) {
@@ -142,7 +144,7 @@ public class KeyguardViewManager implements KeyguardWindowController {
                mKeyguardView.onScreenTurnedOn();
            }
        }

        mViewManager.updateViewLayout(mKeyguardHost, mWindowLayoutParams);
        mKeyguardHost.setVisibility(View.VISIBLE);
        mKeyguardView.requestFocus();
    }
+2 −0
Original line number Diff line number Diff line
@@ -232,6 +232,8 @@ class LockScreen extends LinearLayout implements KeyguardScreen,

        /** {@inheritDoc} */
        public void onGrabbedStateChange(View v, int grabbedState) {
            if (DBG) Log.v(TAG, "*** LockScreen accel is " 
                    + (mEnergyWave.isHardwareAccelerated() ? "on":"off"));
            // Don't poke the wake lock when returning to a state where the handle is
            // not grabbed since that can happen when the system (instead of the user)
            // cancels the grab.