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

Commit a89ab17a authored by tiger_huang's avatar tiger_huang Committed by Steve Kondik
Browse files

Re-use orientation from windows if screen is freezing by apps

This patch prevents the app window being re-created repeatedly. With
the original logic, if an app which is show-when-locked, which has a
different orientation from the keyguard's, and which doesn't handle
config changes, is launched when the screen is off, then it would be
re-created repeatedly.

The original logic prevents this issue when the display is frozen.
However, if the screen is off, the display won't be frozen. So this
change uses additional variables to detect if there are any apps re-
creating their windows.

Change-Id: I73d2e384c4ceeeb38d04d04f0665f83cc6fba7ae
parent 03f1d083
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -3831,7 +3831,7 @@ public class WindowManagerService extends IWindowManager.Stub
    }
    public int getOrientationLocked() {
        if (mDisplayFrozen) {
        if (mDisplayFrozen || mAppsFreezingScreen > 0) {
            if (mLastWindowForcedOrientation != ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED) {
                if (DEBUG_ORIENTATION) Slog.v(TAG, "Display is frozen, return "
                        + mLastWindowForcedOrientation);
@@ -3887,7 +3887,7 @@ public class WindowManagerService extends IWindowManager.Stub
                }
                if (DEBUG_ORIENTATION) Slog.v(TAG,
                        "No one is requesting an orientation when the screen is locked");
                return mLastKeyguardForcedOrientation;
                return mLastWindowForcedOrientation = mLastKeyguardForcedOrientation;
            }
        }