Merge "Do not remove/hide surface when waiting for transition start" into sc-v2-dev
This commit is contained in:
@@ -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);
|
||||
@@ -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
|
||||
@@ -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(),
|
||||
@@ -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) {
|
||||
@@ -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) {
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user