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

Commit 78466073 authored by Evan Rosky's avatar Evan Rosky Committed by android-build-merger
Browse files

Merge "Fix display-level windowingMode change" into qt-dev

am: 35940c61

Change-Id: I8e687af7a1e5aecb43b3348abb363f6989e5d3d8
parents f6f0a483 35940c61
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -2322,7 +2322,9 @@ final class ActivityRecord extends ConfigurationContainer {
                return;
            }

            if (configChanges == 0 && mAppWindowToken.okToDisplay()) {
            // Window configuration changes only effect windows, so don't require a screen freeze.
            int freezableConfigChanges = configChanges & ~(CONFIG_WINDOW_CONFIGURATION);
            if (freezableConfigChanges == 0 && mAppWindowToken.okToDisplay()) {
                if (DEBUG_ORIENTATION) Slog.v(TAG_WM, "Skipping set freeze of " + appToken);
                return;
            }
+6 −2
Original line number Diff line number Diff line
@@ -509,6 +509,10 @@ class AppWindowToken extends WindowToken implements WindowManagerService.AppFree
        final DisplayContent displayContent = getDisplayContent();
        displayContent.mOpeningApps.remove(this);
        displayContent.mClosingApps.remove(this);
        if (isInChangeTransition()) {
            clearChangeLeash(getPendingTransaction(), true /* cancel */);
        }
        displayContent.mChangingApps.remove(this);
        waitingToShow = false;
        hiddenRequested = !visible;
        mDeferHidingClient = deferHidingClient;
@@ -1310,7 +1314,7 @@ class AppWindowToken extends WindowToken implements WindowManagerService.AppFree
    void onDisplayChanged(DisplayContent dc) {
        DisplayContent prevDc = mDisplayContent;
        super.onDisplayChanged(dc);
        if (prevDc == null) {
        if (prevDc == null || prevDc == mDisplayContent) {
            return;
        }
        if (prevDc.mChangingApps.contains(this)) {
@@ -1333,7 +1337,7 @@ class AppWindowToken extends WindowToken implements WindowManagerService.AppFree
            }
        }

        if (prevDc != mDisplayContent && mLetterbox != null) {
        if (mLetterbox != null) {
            mLetterbox.onMovedToDisplay(mDisplayContent.getDisplayId());
        }
    }
+17 −0
Original line number Diff line number Diff line
@@ -6828,9 +6828,26 @@ public class WindowManagerService extends IWindowManager.Stub
                return;
            }

            int lastWindowingMode = displayContent.getWindowingMode();
            mDisplayWindowSettings.setWindowingModeLocked(displayContent, mode);

            reconfigureDisplayLocked(displayContent);

            if (lastWindowingMode != displayContent.getWindowingMode()) {
                // reconfigure won't detect this change in isolation because the windowing mode is
                // already set on the display, so fire off a new config now.
                mH.removeMessages(H.SEND_NEW_CONFIGURATION);

                final long origId = Binder.clearCallingIdentity();
                try {
                    // direct call since lock is shared.
                    sendNewConfiguration(displayId);
                } finally {
                    Binder.restoreCallingIdentity(origId);
                }
                // Now that all configurations are updated, execute pending transitions
                displayContent.executeAppTransition();
            }
        }
    }

+18 −0
Original line number Diff line number Diff line
@@ -158,4 +158,22 @@ public class AppChangeTransitionTests extends WindowTestsBase {
        waitUntilHandlersIdle();
        mToken.removeImmediately();
    }

    @Test
    public void testCancelPendingChangeOnHide() {
        // setup currently defaults to no snapshot.
        setUpOnDisplay(mDisplayContent);

        mTask.setWindowingMode(WINDOWING_MODE_FREEFORM);
        assertEquals(1, mDisplayContent.mChangingApps.size());
        assertTrue(mToken.isInChangeTransition());

        // Changing visibility should cancel the change transition and become closing
        mToken.setVisibility(false, false);
        assertEquals(0, mDisplayContent.mChangingApps.size());
        assertFalse(mToken.isInChangeTransition());

        waitUntilHandlersIdle();
        mToken.removeImmediately();
    }
}