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

Commit e0b7712c authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Wait for remote animation to stop freezing display" into rvc-dev am:...

Merge "Wait for remote animation to stop freezing display" into rvc-dev am: 0207dba4 am: a0ba1c6f

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/12034123

Change-Id: I1b924b5b21f7f205c03f00756a54d68c869423dc
parents 1cd46453 a0ba1c6f
Loading
Loading
Loading
Loading
+6 −12
Original line number Diff line number Diff line
@@ -1663,12 +1663,6 @@
      "group": "WM_SHOW_SURFACE_ALLOC",
      "at": "com\/android\/server\/wm\/ScreenRotationAnimation.java"
    },
    "1108406230": {
      "message": "stopFreezingDisplayLocked: Returning mWaitingForConfig=%b, mAppsFreezingScreen=%d, mWindowsFreezingScreen=%d, mClientFreezingScreen=%b, mOpeningApps.size()=%d",
      "level": "DEBUG",
      "group": "WM_DEBUG_ORIENTATION",
      "at": "com\/android\/server\/wm\/WindowManagerService.java"
    },
    "1112047265": {
      "message": "finishDrawingWindow: %s mDrawState=%s",
      "level": "DEBUG",
@@ -1729,6 +1723,12 @@
      "group": "WM_DEBUG_BOOT",
      "at": "com\/android\/server\/wm\/WindowManagerService.java"
    },
    "1246035185": {
      "message": "stopFreezingDisplayLocked: Returning waitingForConfig=%b, waitingForRemoteRotation=%b, mAppsFreezingScreen=%d, mWindowsFreezingScreen=%d, mClientFreezingScreen=%b, mOpeningApps.size()=%d",
      "level": "DEBUG",
      "group": "WM_DEBUG_ORIENTATION",
      "at": "com\/android\/server\/wm\/WindowManagerService.java"
    },
    "1254403969": {
      "message": "Surface returned was null: %s",
      "level": "VERBOSE",
@@ -1951,12 +1951,6 @@
      "group": "WM_DEBUG_APP_TRANSITIONS_ANIM",
      "at": "com\/android\/server\/wm\/AppTransition.java"
    },
    "1591969812": {
      "message": "updateImeControlTarget %s",
      "level": "INFO",
      "group": "WM_DEBUG_IME",
      "at": "com\/android\/server\/wm\/DisplayContent.java"
    },
    "1628345525": {
      "message": "Now opening app %s",
      "level": "VERBOSE",
+20 −10
Original line number Diff line number Diff line
@@ -5606,16 +5606,27 @@ public class WindowManagerService extends IWindowManager.Stub
        }

        final DisplayContent displayContent = mRoot.getDisplayContent(mFrozenDisplayId);
        final boolean waitingForConfig = displayContent != null && displayContent.mWaitingForConfig;
        final int numOpeningApps = displayContent != null ? displayContent.mOpeningApps.size() : 0;
        if (waitingForConfig || mAppsFreezingScreen > 0
        final int numOpeningApps;
        final boolean waitingForConfig;
        final boolean waitingForRemoteRotation;
        if (displayContent != null) {
            numOpeningApps = displayContent.mOpeningApps.size();
            waitingForConfig = displayContent.mWaitingForConfig;
            waitingForRemoteRotation =
                    displayContent.getDisplayRotation().isWaitingForRemoteRotation();
        } else {
            waitingForConfig = waitingForRemoteRotation = false;
            numOpeningApps = 0;
        }
        if (waitingForConfig || waitingForRemoteRotation || mAppsFreezingScreen > 0
                || mWindowsFreezingScreen == WINDOWS_FREEZING_SCREENS_ACTIVE
                || mClientFreezingScreen || numOpeningApps > 0) {
            ProtoLog.d(WM_DEBUG_ORIENTATION,
                                "stopFreezingDisplayLocked: Returning mWaitingForConfig=%b, "
            ProtoLog.d(WM_DEBUG_ORIENTATION, "stopFreezingDisplayLocked: Returning "
                    + "waitingForConfig=%b, waitingForRemoteRotation=%b, "
                    + "mAppsFreezingScreen=%d, mWindowsFreezingScreen=%d, "
                    + "mClientFreezingScreen=%b, mOpeningApps.size()=%d",
                                waitingForConfig, mAppsFreezingScreen, mWindowsFreezingScreen,
                    waitingForConfig, waitingForRemoteRotation,
                    mAppsFreezingScreen, mWindowsFreezingScreen,
                    mClientFreezingScreen, numOpeningApps);
            return;
        }
@@ -5627,7 +5638,6 @@ public class WindowManagerService extends IWindowManager.Stub
        // We must make a local copy of the displayId as it can be potentially overwritten later on
        // in this method. For example, {@link startFreezingDisplayLocked} may be called as a result
        // of update rotation, but we reference the frozen display after that call in this method.
        final int displayId = mFrozenDisplayId;
        mFrozenDisplayId = INVALID_DISPLAY;
        mDisplayFrozen = false;
        mInputManagerCallback.thawInputDispatchingLw();
+10 −2
Original line number Diff line number Diff line
@@ -1328,9 +1328,10 @@ public class DisplayContentTests extends WindowTestsBase {

        final DisplayRotation dr = dc.getDisplayRotation();
        doCallRealMethod().when(dr).updateRotationUnchecked(anyBoolean());
        Mockito.doReturn(ROTATION_90).when(dr).rotationForOrientation(anyInt(), anyInt());
        // Rotate 180 degree so the display doesn't have configuration change. This condition is
        // used for the later verification of stop-freezing (without setting mWaitingForConfig).
        doReturn((dr.getRotation() + 2) % 4).when(dr).rotationForOrientation(anyInt(), anyInt());
        final boolean[] continued = new boolean[1];
        // TODO(display-merge): Remove cast
        doAnswer(
                invocation -> {
                    continued[0] = true;
@@ -1356,9 +1357,16 @@ public class DisplayContentTests extends WindowTestsBase {
        dc.setRotationAnimation(null);

        mWm.updateRotation(true /* alwaysSendConfiguration */, false /* forceRelayout */);
        // If remote rotation is not finished, the display should not be able to unfreeze.
        mWm.stopFreezingDisplayLocked();
        assertTrue(mWm.mDisplayFrozen);

        assertTrue(called[0]);
        waitUntilHandlersIdle();
        assertTrue(continued[0]);

        mWm.stopFreezingDisplayLocked();
        assertFalse(mWm.mDisplayFrozen);
    }

    @Test