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

Commit 5bdb44f4 authored by Evan Rosky's avatar Evan Rosky Committed by Automerger Merge Worker
Browse files

Merge "Fix some change-transition issues and tests" into rvc-dev am: e4621628

Change-Id: I7a2ef4e014e3e25b2b2dd9dcb045cfa4fa311a4b
parents 57f4c234 e4621628
Loading
Loading
Loading
Loading
+1 −13
Original line number Diff line number Diff line
@@ -3137,7 +3137,6 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
        commitVisibility(false /* visible */, true /* performLayout */);

        getDisplayContent().mOpeningApps.remove(this);
        getDisplayContent().mChangingContainers.remove(this);
        getDisplayContent().mUnknownAppVisibilityController.appRemovedOrHidden(this);
        mWmService.mTaskSnapshotController.onAppRemoved(this);
        mStackSupervisor.getActivityMetricsLogger().notifyActivityRemoved(this);
@@ -6130,19 +6129,8 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A

    @Override
    void cancelAnimation() {
        cancelAnimationOnly();
        clearThumbnail();
        mSurfaceFreezer.unfreeze(getPendingTransaction());
    }

    /**
     * This only cancels the animation. It doesn't do other teardown like cleaning-up thumbnail
     * or interim leashes.
     * <p>
     * Used when canceling in preparation for starting a new animation.
     */
    void cancelAnimationOnly() {
        super.cancelAnimation();
        clearThumbnail();
    }

    @VisibleForTesting
+2 −11
Original line number Diff line number Diff line
@@ -1992,7 +1992,8 @@ class Task extends WindowContainer<WindowContainer> {
        if (mWmService.mDisableTransitionAnimation
                || !isVisible()
                || getDisplayContent().mAppTransition.isTransitionSet()
                || getSurfaceControl() == null) {
                || getSurfaceControl() == null
                || !isLeafTask()) {
            return false;
        }
        // Only do an animation into and out-of freeform mode for now. Other mode
@@ -2897,22 +2898,12 @@ class Task extends WindowContainer<WindowContainer> {
        if (!isRootTask) {
            adjustBoundsForDisplayChangeIfNeeded(dc);
        }
        final DisplayContent prevDc = mDisplayContent;
        super.onDisplayChanged(dc);
        if (!isRootTask) {
            final int displayId = (dc != null) ? dc.getDisplayId() : INVALID_DISPLAY;
            mWmService.mAtmService.getTaskChangeNotificationController().notifyTaskDisplayChanged(
                    mTaskId, displayId);
        }
        if (prevDc != null && prevDc.mChangingContainers.remove(this)) {
            // This gets called *after* this has been reparented to the new display.
            // That reparenting resulted in this window changing modes (eg. FREEFORM -> FULLSCREEN),
            // so this token is now "frozen" while waiting for the animation to start on prevDc
            // (which will be cancelled since the window is no-longer a child). However, since this
            // is no longer a child of prevDc, this won't be notified of the cancelled animation,
            // so we need to cancel the change transition here.
            mSurfaceFreezer.unfreeze(getPendingTransaction());
        }
    }

    boolean isResizeable(boolean checkSupportsPip) {
+10 −0
Original line number Diff line number Diff line
@@ -526,6 +526,11 @@ class WindowContainer<E extends WindowContainer> extends ConfigurationContainer<
     */
    @CallSuper
    void removeImmediately() {
        final DisplayContent dc = getDisplayContent();
        if (dc != null) {
            mSurfaceFreezer.unfreeze(getPendingTransaction());
            dc.mChangingContainers.remove(this);
        }
        while (!mChildren.isEmpty()) {
            final E child = mChildren.peekLast();
            child.removeImmediately();
@@ -718,6 +723,10 @@ class WindowContainer<E extends WindowContainer> extends ConfigurationContainer<
     * @param dc The display this container is on after changes.
     */
    void onDisplayChanged(DisplayContent dc) {
        if (mDisplayContent != null && mDisplayContent.mChangingContainers.remove(this)) {
            // Cancel any change transition queued-up for this container on the old display.
            mSurfaceFreezer.unfreeze(getPendingTransaction());
        }
        mDisplayContent = dc;
        if (dc != null && dc != this) {
            dc.getPendingTransaction().merge(mPendingTransaction);
@@ -2033,6 +2042,7 @@ class WindowContainer<E extends WindowContainer> extends ConfigurationContainer<

    void cancelAnimation() {
        mSurfaceAnimator.cancelAnimation();
        mSurfaceFreezer.unfreeze(getPendingTransaction());
    }

    @Override
+3 −8
Original line number Diff line number Diff line
@@ -37,7 +37,6 @@ import android.view.RemoteAnimationAdapter;
import android.view.RemoteAnimationDefinition;
import android.view.RemoteAnimationTarget;

import androidx.test.filters.FlakyTest;
import androidx.test.filters.SmallTest;

import org.junit.Test;
@@ -97,7 +96,6 @@ public class AppChangeTransitionTests extends WindowTestsBase {
    }

    @Test
    @FlakyTest(bugId = 131005232)
    public void testModeChangeRemoteAnimatorNoSnapshot() {
        // setup currently defaults to no snapshot.
        setUpOnDisplay(mDisplayContent);
@@ -115,7 +113,6 @@ public class AppChangeTransitionTests extends WindowTestsBase {
    }

    @Test
    @FlakyTest(bugId = 131005232)
    public void testCancelPendingChangeOnRemove() {
        // setup currently defaults to no snapshot.
        setUpOnDisplay(mDisplayContent);
@@ -135,8 +132,7 @@ public class AppChangeTransitionTests extends WindowTestsBase {
    }

    @Test
    @FlakyTest(bugId = 131005232)
    public void testNoChangeWhenMoveDisplay() {
    public void testNoChangeOnOldDisplayWhenMoveDisplay() {
        mDisplayContent.setWindowingMode(WINDOWING_MODE_FULLSCREEN);
        final DisplayContent dc1 = createNewDisplay(Display.STATE_ON);
        dc1.setWindowingMode(WINDOWING_MODE_FREEFORM);
@@ -151,9 +147,8 @@ public class AppChangeTransitionTests extends WindowTestsBase {

        assertEquals(WINDOWING_MODE_FULLSCREEN, mTask.getWindowingMode());

        // Make sure we're not waiting for a change animation (no leash)
        assertFalse(mTask.isInChangeTransition());
        assertNull(mActivity.mSurfaceFreezer.mSnapshot);
        // Make sure the change transition is not the old display
        assertFalse(dc1.mChangingContainers.contains(mTask));

        waitUntilHandlersIdle();
        mActivity.removeImmediately();