Loading services/core/java/com/android/server/wm/ActivityRecord.java +12 −6 Original line number Diff line number Diff line Loading @@ -3790,8 +3790,6 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A ProtoLog.v(WM_DEBUG_APP_TRANSITIONS, "Removing app token: %s", this); commitVisibility(false /* visible */, true /* performLayout */); getDisplayContent().mOpeningApps.remove(this); getDisplayContent().mUnknownAppVisibilityController.appRemovedOrHidden(this); mWmService.mTaskSnapshotController.onAppRemoved(this); Loading @@ -3799,8 +3797,6 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A mTaskSupervisor.mStoppingActivities.remove(this); waitingToShow = false; // TODO(b/169035022): move to a more-appropriate place. mAtmService.getTransitionController().collect(this); // Defer removal of this activity when either a child is animating, or app transition is on // going. App transition animation might be applied on the parent task not on the activity, // but the actual frame buffer is associated with the activity, so we have to keep the Loading @@ -3816,6 +3812,16 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A delayed = true; } // Don't commit visibility if it is waiting to animate. It will be set post animation. if (!delayed) { commitVisibility(false /* visible */, true /* performLayout */); } else { setVisibleRequested(false /* visible */); } // TODO(b/169035022): move to a more-appropriate place. mAtmService.getTransitionController().collect(this); ProtoLog.v(WM_DEBUG_APP_TRANSITIONS, "Removing app %s delayed=%b animation=%s animating=%b", this, delayed, getAnimation(), Loading Loading @@ -4972,7 +4978,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A private void postApplyAnimation(boolean visible) { final boolean usingShellTransitions = mAtmService.getTransitionController().getTransitionPlayer() != null; final boolean delayed = isAnimating(PARENTS | CHILDREN, final boolean delayed = isAnimating(TRANSITION | PARENTS | CHILDREN, ANIMATION_TYPE_APP_TRANSITION | ANIMATION_TYPE_WINDOW_ANIMATION | ANIMATION_TYPE_RECENTS); if (!delayed && !usingShellTransitions) { Loading Loading @@ -6912,7 +6918,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A @Override void prepareSurfaces() { final boolean show = isVisible() || isAnimating(PARENTS, final boolean show = isVisible() || isAnimating(TRANSITION | PARENTS, ANIMATION_TYPE_APP_TRANSITION | ANIMATION_TYPE_RECENTS); if (mSurfaceControl != null) { Loading services/core/java/com/android/server/wm/WindowState.java +1 −2 Original line number Diff line number Diff line Loading @@ -2582,8 +2582,7 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP } } final boolean isAnimating = mAnimatingExit || isAnimating(TRANSITION | PARENTS, EXIT_ANIMATING_TYPES) && (mActivityRecord == null || !mActivityRecord.isWaitingForTransitionStart()); || isAnimating(TRANSITION | PARENTS, EXIT_ANIMATING_TYPES); final boolean lastWindowIsStartingWindow = startingWindow && mActivityRecord != null && mActivityRecord.isLastWindow(this); // We delay the removal of a window if it has a showing surface that can be used to run Loading services/tests/wmtests/src/com/android/server/wm/ActivityRecordTests.java +19 −0 Original line number Diff line number Diff line Loading @@ -2987,6 +2987,7 @@ public class ActivityRecordTests extends WindowTestsBase { mDisplayContent.setImeInputTarget(app); // Simulate app is closing and expect the last IME is shown and IME insets is frozen. mDisplayContent.mOpeningApps.clear(); app.mActivityRecord.commitVisibility(false, false); app.mActivityRecord.onWindowsGone(); Loading @@ -3005,6 +3006,24 @@ public class ActivityRecordTests extends WindowTestsBase { assertFalse(app.mActivityRecord.mImeInsetsFrozenUntilStartInput); } @Test public void testInClosingAnimation_doNotHideSurface() { final WindowState app = createWindow(null, TYPE_APPLICATION, "app"); makeWindowVisibleAndDrawn(app); // Put the activity in close transition. mDisplayContent.mOpeningApps.clear(); mDisplayContent.mClosingApps.add(app.mActivityRecord); mDisplayContent.prepareAppTransition(TRANSIT_CLOSE); // Update visibility and call to remove window app.mActivityRecord.commitVisibility(false, false); app.mActivityRecord.prepareSurfaces(); // Because the app is waiting for transition, it should not hide the surface. assertTrue(app.mActivityRecord.isSurfaceShowing()); } private void assertHasStartingWindow(ActivityRecord atoken) { assertNotNull(atoken.mStartingSurface); assertNotNull(atoken.mStartingData); Loading Loading
services/core/java/com/android/server/wm/ActivityRecord.java +12 −6 Original line number Diff line number Diff line Loading @@ -3790,8 +3790,6 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A ProtoLog.v(WM_DEBUG_APP_TRANSITIONS, "Removing app token: %s", this); commitVisibility(false /* visible */, true /* performLayout */); getDisplayContent().mOpeningApps.remove(this); getDisplayContent().mUnknownAppVisibilityController.appRemovedOrHidden(this); mWmService.mTaskSnapshotController.onAppRemoved(this); Loading @@ -3799,8 +3797,6 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A mTaskSupervisor.mStoppingActivities.remove(this); waitingToShow = false; // TODO(b/169035022): move to a more-appropriate place. mAtmService.getTransitionController().collect(this); // Defer removal of this activity when either a child is animating, or app transition is on // going. App transition animation might be applied on the parent task not on the activity, // but the actual frame buffer is associated with the activity, so we have to keep the Loading @@ -3816,6 +3812,16 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A delayed = true; } // Don't commit visibility if it is waiting to animate. It will be set post animation. if (!delayed) { commitVisibility(false /* visible */, true /* performLayout */); } else { setVisibleRequested(false /* visible */); } // TODO(b/169035022): move to a more-appropriate place. mAtmService.getTransitionController().collect(this); ProtoLog.v(WM_DEBUG_APP_TRANSITIONS, "Removing app %s delayed=%b animation=%s animating=%b", this, delayed, getAnimation(), Loading Loading @@ -4972,7 +4978,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A private void postApplyAnimation(boolean visible) { final boolean usingShellTransitions = mAtmService.getTransitionController().getTransitionPlayer() != null; final boolean delayed = isAnimating(PARENTS | CHILDREN, final boolean delayed = isAnimating(TRANSITION | PARENTS | CHILDREN, ANIMATION_TYPE_APP_TRANSITION | ANIMATION_TYPE_WINDOW_ANIMATION | ANIMATION_TYPE_RECENTS); if (!delayed && !usingShellTransitions) { Loading Loading @@ -6912,7 +6918,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A @Override void prepareSurfaces() { final boolean show = isVisible() || isAnimating(PARENTS, final boolean show = isVisible() || isAnimating(TRANSITION | PARENTS, ANIMATION_TYPE_APP_TRANSITION | ANIMATION_TYPE_RECENTS); if (mSurfaceControl != null) { Loading
services/core/java/com/android/server/wm/WindowState.java +1 −2 Original line number Diff line number Diff line Loading @@ -2582,8 +2582,7 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP } } final boolean isAnimating = mAnimatingExit || isAnimating(TRANSITION | PARENTS, EXIT_ANIMATING_TYPES) && (mActivityRecord == null || !mActivityRecord.isWaitingForTransitionStart()); || isAnimating(TRANSITION | PARENTS, EXIT_ANIMATING_TYPES); final boolean lastWindowIsStartingWindow = startingWindow && mActivityRecord != null && mActivityRecord.isLastWindow(this); // We delay the removal of a window if it has a showing surface that can be used to run Loading
services/tests/wmtests/src/com/android/server/wm/ActivityRecordTests.java +19 −0 Original line number Diff line number Diff line Loading @@ -2987,6 +2987,7 @@ public class ActivityRecordTests extends WindowTestsBase { mDisplayContent.setImeInputTarget(app); // Simulate app is closing and expect the last IME is shown and IME insets is frozen. mDisplayContent.mOpeningApps.clear(); app.mActivityRecord.commitVisibility(false, false); app.mActivityRecord.onWindowsGone(); Loading @@ -3005,6 +3006,24 @@ public class ActivityRecordTests extends WindowTestsBase { assertFalse(app.mActivityRecord.mImeInsetsFrozenUntilStartInput); } @Test public void testInClosingAnimation_doNotHideSurface() { final WindowState app = createWindow(null, TYPE_APPLICATION, "app"); makeWindowVisibleAndDrawn(app); // Put the activity in close transition. mDisplayContent.mOpeningApps.clear(); mDisplayContent.mClosingApps.add(app.mActivityRecord); mDisplayContent.prepareAppTransition(TRANSIT_CLOSE); // Update visibility and call to remove window app.mActivityRecord.commitVisibility(false, false); app.mActivityRecord.prepareSurfaces(); // Because the app is waiting for transition, it should not hide the surface. assertTrue(app.mActivityRecord.isSurfaceShowing()); } private void assertHasStartingWindow(ActivityRecord atoken) { assertNotNull(atoken.mStartingSurface); assertNotNull(atoken.mStartingData); Loading