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

Commit 998666c4 authored by wilsonshih's avatar wilsonshih
Browse files

Force enable hardware accelerated for starting window

Currently the hardware acclerated was disabled for starting window, we
will need to enable it to fix the reveal animation janky.
With software rendering, each frame would cost 20~30ms on redfin.

Test: atest KeyguardTests KeyguardLockedTests SplashscreenTests
Bug: 182708883
Bug: 173975965
Change-Id: I4df6891e0b24231b7fd3a1d2d630ca2b9eead79f
parent 9d1ce22f
Loading
Loading
Loading
Loading
+1 −8
Original line number Original line Diff line number Diff line
@@ -1373,17 +1373,10 @@ public final class ViewRootImpl implements ViewParent,
            // can be used by code on the system process to escape that and enable
            // can be used by code on the system process to escape that and enable
            // HW accelerated drawing.  (This is basically for the lock screen.)
            // HW accelerated drawing.  (This is basically for the lock screen.)


            final boolean fakeHwAccelerated = (attrs.privateFlags &
                    WindowManager.LayoutParams.PRIVATE_FLAG_FAKE_HARDWARE_ACCELERATED) != 0;
            final boolean forceHwAccelerated = (attrs.privateFlags &
            final boolean forceHwAccelerated = (attrs.privateFlags &
                    WindowManager.LayoutParams.PRIVATE_FLAG_FORCE_HARDWARE_ACCELERATED) != 0;
                    WindowManager.LayoutParams.PRIVATE_FLAG_FORCE_HARDWARE_ACCELERATED) != 0;


            if (fakeHwAccelerated) {
            if (ThreadedRenderer.sRendererEnabled || forceHwAccelerated) {
                // This is exclusively for the preview windows the window manager
                // shows for launching applications, so they will look more like
                // the app being launched.
                mAttachInfo.mHardwareAccelerationRequested = true;
            } else if (ThreadedRenderer.sRendererEnabled || forceHwAccelerated) {
                if (mAttachInfo.mThreadedRenderer != null) {
                if (mAttachInfo.mThreadedRenderer != null) {
                    mAttachInfo.mThreadedRenderer.destroy();
                    mAttachInfo.mThreadedRenderer.destroy();
                }
                }
+0 −25
Original line number Original line Diff line number Diff line
@@ -2217,26 +2217,6 @@ public interface WindowManager extends ViewManager {
        @Flags
        @Flags
        public int flags;
        public int flags;


        /**
         * If the window has requested hardware acceleration, but this is not
         * allowed in the process it is in, then still render it as if it is
         * hardware accelerated.  This is used for the starting preview windows
         * in the system process, which don't need to have the overhead of
         * hardware acceleration (they are just a static rendering), but should
         * be rendered as such to match the actual window of the app even if it
         * is hardware accelerated.
         * Even if the window isn't hardware accelerated, still do its rendering
         * as if it was.
         * 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 PRIVATE_FLAG_FAKE_HARDWARE_ACCELERATED = 0x00000001;

        /**
        /**
         * In the system process, we globally do not use hardware acceleration
         * In the system process, we globally do not use hardware acceleration
         * because there are many threads doing UI there and they conflict.
         * because there are many threads doing UI there and they conflict.
@@ -2463,7 +2443,6 @@ public interface WindowManager extends ViewManager {
         * @hide
         * @hide
         */
         */
        @IntDef(flag = true, prefix="PRIVATE_FLAG_", value = {
        @IntDef(flag = true, prefix="PRIVATE_FLAG_", value = {
                PRIVATE_FLAG_FAKE_HARDWARE_ACCELERATED,
                PRIVATE_FLAG_FORCE_HARDWARE_ACCELERATED,
                PRIVATE_FLAG_FORCE_HARDWARE_ACCELERATED,
                PRIVATE_FLAG_WANTS_OFFSET_NOTIFICATIONS,
                PRIVATE_FLAG_WANTS_OFFSET_NOTIFICATIONS,
                SYSTEM_FLAG_SHOW_FOR_ALL_USERS,
                SYSTEM_FLAG_SHOW_FOR_ALL_USERS,
@@ -2498,10 +2477,6 @@ public interface WindowManager extends ViewManager {
         */
         */
        @UnsupportedAppUsage
        @UnsupportedAppUsage
        @ViewDebug.ExportedProperty(flagMapping = {
        @ViewDebug.ExportedProperty(flagMapping = {
                @ViewDebug.FlagToString(
                        mask = PRIVATE_FLAG_FAKE_HARDWARE_ACCELERATED,
                        equals = PRIVATE_FLAG_FAKE_HARDWARE_ACCELERATED,
                        name = "FAKE_HARDWARE_ACCELERATED"),
                @ViewDebug.FlagToString(
                @ViewDebug.FlagToString(
                        mask = PRIVATE_FLAG_FORCE_HARDWARE_ACCELERATED,
                        mask = PRIVATE_FLAG_FORCE_HARDWARE_ACCELERATED,
                        equals = PRIVATE_FLAG_FORCE_HARDWARE_ACCELERATED,
                        equals = PRIVATE_FLAG_FORCE_HARDWARE_ACCELERATED,
+1 −7
Original line number Original line Diff line number Diff line
@@ -181,11 +181,7 @@ public class StartingSurfaceDrawer {
        }
        }


        int windowFlags = 0;
        int windowFlags = 0;
        final boolean enableHardAccelerated =
                (activityInfo.flags & ActivityInfo.FLAG_HARDWARE_ACCELERATED) != 0;
        if (enableHardAccelerated) {
        windowFlags |= WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED;
        windowFlags |= WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED;
        }


        final boolean[] showWallpaper = new boolean[1];
        final boolean[] showWallpaper = new boolean[1];
        final int[] splashscreenContentResId = new int[1];
        final int[] splashscreenContentResId = new int[1];
@@ -246,8 +242,6 @@ public class StartingSurfaceDrawer {
        params.packageName = activityInfo.packageName;
        params.packageName = activityInfo.packageName;
        params.windowAnimations = win.getWindowStyle().getResourceId(
        params.windowAnimations = win.getWindowStyle().getResourceId(
                com.android.internal.R.styleable.Window_windowAnimationStyle, 0);
                com.android.internal.R.styleable.Window_windowAnimationStyle, 0);
        params.privateFlags |=
                WindowManager.LayoutParams.PRIVATE_FLAG_FAKE_HARDWARE_ACCELERATED;
        params.privateFlags |= WindowManager.LayoutParams.SYSTEM_FLAG_SHOW_FOR_ALL_USERS;
        params.privateFlags |= WindowManager.LayoutParams.SYSTEM_FLAG_SHOW_FOR_ALL_USERS;
        // Setting as trusted overlay to let touches pass through. This is safe because this
        // Setting as trusted overlay to let touches pass through. This is safe because this
        // window is controlled by the system.
        // window is controlled by the system.
+0 −2
Original line number Original line Diff line number Diff line
@@ -2341,8 +2341,6 @@ public class PhoneWindowManager implements WindowManagerPolicy {
            params.packageName = packageName;
            params.packageName = packageName;
            params.windowAnimations = win.getWindowStyle().getResourceId(
            params.windowAnimations = win.getWindowStyle().getResourceId(
                    com.android.internal.R.styleable.Window_windowAnimationStyle, 0);
                    com.android.internal.R.styleable.Window_windowAnimationStyle, 0);
            params.privateFlags |=
                    WindowManager.LayoutParams.PRIVATE_FLAG_FAKE_HARDWARE_ACCELERATED;
            params.privateFlags |= WindowManager.LayoutParams.SYSTEM_FLAG_SHOW_FOR_ALL_USERS;
            params.privateFlags |= WindowManager.LayoutParams.SYSTEM_FLAG_SHOW_FOR_ALL_USERS;
            // Setting as trusted overlay to let touches pass through. This is safe because this
            // Setting as trusted overlay to let touches pass through. This is safe because this
            // window is controlled by the system.
            // window is controlled by the system.