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

Commit 6dcbee66 authored by Tiger Huang's avatar Tiger Huang
Browse files

Not to show intermediate screen to the user when dismissing split screen

During dismissing split screen mode, the logic may perform some surface
operations. e.g., setWindowCrop and hide. If we clear the crop of an app
stack first and then hide the app a few milliseconds later, the user may
see the screen flash.

This CL uses inSurfaceTransaction to ensure that there won't be any
intermediate transactions while setting windowing mode.

Fix: 79686616
Test: atest WindowManagerSmokeTest
Change-Id: Ie35c3422dd0c49b5145a6b80f0b78f23e27a11a1
parent 01794b57
Loading
Loading
Loading
Loading
+9 −1
Original line number Diff line number Diff line
@@ -701,6 +701,14 @@ class ActivityStack extends ConfigurationContainer {
     */
    void setWindowingMode(int preferredWindowingMode, boolean animate, boolean showRecents,
            boolean enteringSplitScreenMode, boolean deferEnsuringVisibility, boolean creating) {
        mWindowManager.inSurfaceTransaction(() -> setWindowingModeInSurfaceTransaction(
                preferredWindowingMode, animate, showRecents, enteringSplitScreenMode,
                deferEnsuringVisibility, creating));
    }

    private void setWindowingModeInSurfaceTransaction(int preferredWindowingMode, boolean animate,
            boolean showRecents, boolean enteringSplitScreenMode, boolean deferEnsuringVisibility,
            boolean creating) {
        final int currentMode = getWindowingMode();
        final int currentOverrideMode = getRequestedOverrideWindowingMode();
        final ActivityDisplay display = getDisplay();
@@ -744,7 +752,7 @@ class ActivityStack extends ConfigurationContainer {
                // warning toast about it.
                mService.getTaskChangeNotificationController().notifyActivityDismissingDockedStack();
                final ActivityStack primarySplitStack = display.getSplitScreenPrimaryStack();
                primarySplitStack.setWindowingMode(WINDOWING_MODE_UNDEFINED,
                primarySplitStack.setWindowingModeInSurfaceTransaction(WINDOWING_MODE_UNDEFINED,
                        false /* animate */, false /* showRecents */,
                        false /* enteringSplitScreenMode */, true /* deferEnsuringVisibility */,
                        primarySplitStack == this ? creating : false);