Loading services/core/java/com/android/server/wm/ActivityRecord.java +1 −13 Original line number Diff line number Diff line Loading @@ -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); Loading Loading @@ -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 Loading services/core/java/com/android/server/wm/Task.java +2 −11 Original line number Diff line number Diff line Loading @@ -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 Loading Loading @@ -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) { Loading services/core/java/com/android/server/wm/WindowContainer.java +10 −0 Original line number Diff line number Diff line Loading @@ -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(); Loading Loading @@ -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); Loading Loading @@ -2033,6 +2042,7 @@ class WindowContainer<E extends WindowContainer> extends ConfigurationContainer< void cancelAnimation() { mSurfaceAnimator.cancelAnimation(); mSurfaceFreezer.unfreeze(getPendingTransaction()); } @Override Loading services/tests/wmtests/src/com/android/server/wm/AppChangeTransitionTests.java +3 −8 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -97,7 +96,6 @@ public class AppChangeTransitionTests extends WindowTestsBase { } @Test @FlakyTest(bugId = 131005232) public void testModeChangeRemoteAnimatorNoSnapshot() { // setup currently defaults to no snapshot. setUpOnDisplay(mDisplayContent); Loading @@ -115,7 +113,6 @@ public class AppChangeTransitionTests extends WindowTestsBase { } @Test @FlakyTest(bugId = 131005232) public void testCancelPendingChangeOnRemove() { // setup currently defaults to no snapshot. setUpOnDisplay(mDisplayContent); Loading @@ -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); Loading @@ -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(); Loading Loading
services/core/java/com/android/server/wm/ActivityRecord.java +1 −13 Original line number Diff line number Diff line Loading @@ -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); Loading Loading @@ -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 Loading
services/core/java/com/android/server/wm/Task.java +2 −11 Original line number Diff line number Diff line Loading @@ -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 Loading Loading @@ -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) { Loading
services/core/java/com/android/server/wm/WindowContainer.java +10 −0 Original line number Diff line number Diff line Loading @@ -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(); Loading Loading @@ -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); Loading Loading @@ -2033,6 +2042,7 @@ class WindowContainer<E extends WindowContainer> extends ConfigurationContainer< void cancelAnimation() { mSurfaceAnimator.cancelAnimation(); mSurfaceFreezer.unfreeze(getPendingTransaction()); } @Override Loading
services/tests/wmtests/src/com/android/server/wm/AppChangeTransitionTests.java +3 −8 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -97,7 +96,6 @@ public class AppChangeTransitionTests extends WindowTestsBase { } @Test @FlakyTest(bugId = 131005232) public void testModeChangeRemoteAnimatorNoSnapshot() { // setup currently defaults to no snapshot. setUpOnDisplay(mDisplayContent); Loading @@ -115,7 +113,6 @@ public class AppChangeTransitionTests extends WindowTestsBase { } @Test @FlakyTest(bugId = 131005232) public void testCancelPendingChangeOnRemove() { // setup currently defaults to no snapshot. setUpOnDisplay(mDisplayContent); Loading @@ -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); Loading @@ -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(); Loading