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

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

Wait for opening apps ready before stopping freezing display

When the screen rotation is changing, we will freeze the display
until all the window surfaces are all drawn (this is not including
windows which have no surface). If the opening app's window surface
is created after we stop freezing the display, there would be no
waiting for the app, and the user would see the black screen.

In this change, we would not only wait for the windows which have
surface, but also wait for the windows about to have surface before
stopping freezing display.

https://code.google.com/p/android/issues/detail?id=150921

Change-Id: I7de4db8ca902236f3e9f730b04dbde681cf8c032
parent 5a2f3fd5
Loading
Loading
Loading
Loading
+12 −8
Original line number Diff line number Diff line
@@ -4138,6 +4138,8 @@ public class WindowManagerService extends IWindowManager.Stub
                mAppTransition.prepare();
                mStartingIconInTransition = false;
                mSkipAppTransitionAnimation = false;
            }
            if (mAppTransition.isTransitionSet()) {
                mH.removeMessages(H.APP_TRANSITION_TIMEOUT);
                mH.sendEmptyMessageDelayed(H.APP_TRANSITION_TIMEOUT, 5000);
            }
@@ -7999,8 +8001,12 @@ public class WindowManagerService extends IWindowManager.Stub

                case APP_TRANSITION_TIMEOUT: {
                    synchronized (mWindowMap) {
                        if (mAppTransition.isTransitionSet()) {
                            if (DEBUG_APP_TRANSITIONS) Slog.v(TAG, "*** APP TRANSITION TIMEOUT");
                        if (mAppTransition.isTransitionSet() || !mOpeningApps.isEmpty()
                                    || !mClosingApps.isEmpty()) {
                            if (DEBUG_APP_TRANSITIONS) Slog.v(TAG, "*** APP TRANSITION TIMEOUT."
                                    + " isTransitionSet()=" + mAppTransition.isTransitionSet()
                                    + " mOpeningApps.size()=" + mOpeningApps.size()
                                    + " mClosingApps.size()=" + mClosingApps.size());
                            mAppTransition.setTimeout();
                            performLayoutAndPlaceSurfacesLocked();
                        }
@@ -9151,10 +9157,7 @@ public class WindowManagerService extends IWindowManager.Stub
                "Checking " + NN + " opening apps (frozen="
                + mDisplayFrozen + " timeout="
                + mAppTransition.isTimeout() + ")...");
        if (!mDisplayFrozen && !mAppTransition.isTimeout()) {
            // If the display isn't frozen, wait to do anything until
            // all of the apps are ready.  Otherwise just go because
            // we'll unfreeze the display when everyone is ready.
        if (!mAppTransition.isTimeout()) {
            for (i=0; i<NN && goodToGo; i++) {
                AppWindowToken wtoken = mOpeningApps.valueAt(i);
                if (DEBUG_APP_TRANSITIONS) Slog.v(TAG,
@@ -10797,12 +10800,13 @@ public class WindowManagerService extends IWindowManager.Stub
        }

        if (mWaitingForConfig || mAppsFreezingScreen > 0 || mWindowsFreezingScreen
                || mClientFreezingScreen) {
                || mClientFreezingScreen || !mOpeningApps.isEmpty()) {
            if (DEBUG_ORIENTATION) Slog.d(TAG,
                "stopFreezingDisplayLocked: Returning mWaitingForConfig=" + mWaitingForConfig
                + ", mAppsFreezingScreen=" + mAppsFreezingScreen
                + ", mWindowsFreezingScreen=" + mWindowsFreezingScreen
                + ", mClientFreezingScreen=" + mClientFreezingScreen);
                + ", mClientFreezingScreen=" + mClientFreezingScreen
                + ", mOpeningApps.size()=" + mOpeningApps.size());
            return;
        }