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

Commit 3230d5b8 authored by Riddle Hsu's avatar Riddle Hsu
Browse files

Avoid clearing rotation transform too early

This reduces flickering of display cutout when switching apps with
different orientations consecutively.

For example, when the display is updating to new rotation seamlessly
after returning from a landscape app to portrait home, immediately
launch the landscape app again. Some non activity windows may have
not drawn in new rotation, so their surfaces have unrotated transform
to preserve original appearance. If clearFixedRotationLaunchingApp is
called before the next transition completes, it may invoke
AsyncRotationController#completeAll to clear the transform, which
causes the windows to show old rotation appearance.

So skip the force finish for the collecting case and let the existing
AsyncRotationController handle the transform.

Bug: 403394916
Flag: EXEMPT bugfix
Test: TransitionTests#testFinishRotationControllerWithFixedRotation
Change-Id: Ib1418b9ee4e478f3f2f3e7fbae4f93c96a2ac3fc
parent 7a79cec7
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -2856,7 +2856,9 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp
        // If the transition finished callback cannot match the token for some reason, make sure the
        // rotated state is cleared if it is already invisible.
        if (mFixedRotationLaunchingApp != null && !mFixedRotationLaunchingApp.isVisibleRequested()
                && !mFixedRotationLaunchingApp.isVisible()) {
                && !mFixedRotationLaunchingApp.isVisible()
                // In case the next transition still needs the existing transform.
                && !mTransitionController.isCollecting()) {
            clearFixedRotationLaunchingApp();
        }
        // If there won't be a transition to notify the launch is done, then it should be ready to
+10 −0
Original line number Diff line number Diff line
@@ -1320,6 +1320,7 @@ public class TransitionTests extends WindowTestsBase {
        mDisplayContent.setLastHasContent();
        mDisplayContent.requestChangeTransition(1 /* changes */, null /* displayChange */,
                ActionChain.test());
        assertTrue(mDisplayContent.mTransitionController.isCollecting());
        assertNotNull(mDisplayContent.getAsyncRotationController());
        mDisplayContent.setFixedRotationLaunchingAppUnchecked(null);
        assertNull("Clear rotation controller if rotation is not changed",
@@ -1332,6 +1333,15 @@ public class TransitionTests extends WindowTestsBase {
        mDisplayContent.setFixedRotationLaunchingAppUnchecked(null);
        assertNotNull("Keep rotation controller if rotation will be changed",
                mDisplayContent.getAsyncRotationController());

        mDisplayContent.getDisplayRotation().setRotation(
                mDisplayContent.getWindowConfiguration().getRotation());
        app.setVisibleRequested(false);
        app.setVisible(false);
        mDisplayContent.setFixedRotationLaunchingAppUnchecked(app);
        mDisplayContent.onTransitionFinished();
        assertNotNull("Keep rotation controller if a transition is collecting",
                mDisplayContent.getAsyncRotationController());
    }

    @Test