Merge "Do not remove/hide surface when waiting for transition start" into sc-v2-dev am: 4650065c80
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15886711 Change-Id: I257fd7f28d48fb1fad3fcc687a517b40c1f77a28
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);
|
ProtoLog.v(WM_DEBUG_APP_TRANSITIONS, "Removing app token: %s", this);
|
||||||
|
|
||||||
commitVisibility(false /* visible */, true /* performLayout */);
|
|
||||||
|
|
||||||
getDisplayContent().mOpeningApps.remove(this);
|
getDisplayContent().mOpeningApps.remove(this);
|
||||||
getDisplayContent().mUnknownAppVisibilityController.appRemovedOrHidden(this);
|
getDisplayContent().mUnknownAppVisibilityController.appRemovedOrHidden(this);
|
||||||
mWmService.mTaskSnapshotController.onAppRemoved(this);
|
mWmService.mTaskSnapshotController.onAppRemoved(this);
|
||||||
@@ -3799,8 +3797,6 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
|
|||||||
mTaskSupervisor.mStoppingActivities.remove(this);
|
mTaskSupervisor.mStoppingActivities.remove(this);
|
||||||
waitingToShow = false;
|
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
|
// 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,
|
// 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
|
// 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;
|
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,
|
ProtoLog.v(WM_DEBUG_APP_TRANSITIONS,
|
||||||
"Removing app %s delayed=%b animation=%s animating=%b", this, delayed,
|
"Removing app %s delayed=%b animation=%s animating=%b", this, delayed,
|
||||||
getAnimation(),
|
getAnimation(),
|
||||||
@@ -4972,7 +4978,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
|
|||||||
private void postApplyAnimation(boolean visible) {
|
private void postApplyAnimation(boolean visible) {
|
||||||
final boolean usingShellTransitions =
|
final boolean usingShellTransitions =
|
||||||
mAtmService.getTransitionController().getTransitionPlayer() != null;
|
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_APP_TRANSITION | ANIMATION_TYPE_WINDOW_ANIMATION
|
||||||
| ANIMATION_TYPE_RECENTS);
|
| ANIMATION_TYPE_RECENTS);
|
||||||
if (!delayed && !usingShellTransitions) {
|
if (!delayed && !usingShellTransitions) {
|
||||||
@@ -6912,7 +6918,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
void prepareSurfaces() {
|
void prepareSurfaces() {
|
||||||
final boolean show = isVisible() || isAnimating(PARENTS,
|
final boolean show = isVisible() || isAnimating(TRANSITION | PARENTS,
|
||||||
ANIMATION_TYPE_APP_TRANSITION | ANIMATION_TYPE_RECENTS);
|
ANIMATION_TYPE_APP_TRANSITION | ANIMATION_TYPE_RECENTS);
|
||||||
|
|
||||||
if (mSurfaceControl != null) {
|
if (mSurfaceControl != null) {
|
||||||
|
|||||||
@@ -2577,8 +2577,7 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
final boolean isAnimating = mAnimatingExit
|
final boolean isAnimating = mAnimatingExit
|
||||||
|| isAnimating(TRANSITION | PARENTS, EXIT_ANIMATING_TYPES)
|
|| isAnimating(TRANSITION | PARENTS, EXIT_ANIMATING_TYPES);
|
||||||
&& (mActivityRecord == null || !mActivityRecord.isWaitingForTransitionStart());
|
|
||||||
final boolean lastWindowIsStartingWindow = startingWindow && mActivityRecord != null
|
final boolean lastWindowIsStartingWindow = startingWindow && mActivityRecord != null
|
||||||
&& mActivityRecord.isLastWindow(this);
|
&& mActivityRecord.isLastWindow(this);
|
||||||
// We delay the removal of a window if it has a showing surface that can be used to run
|
// 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);
|
mDisplayContent.setImeInputTarget(app);
|
||||||
|
|
||||||
// Simulate app is closing and expect the last IME is shown and IME insets is frozen.
|
// 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.commitVisibility(false, false);
|
||||||
app.mActivityRecord.onWindowsGone();
|
app.mActivityRecord.onWindowsGone();
|
||||||
|
|
||||||
@@ -3005,6 +3006,24 @@ public class ActivityRecordTests extends WindowTestsBase {
|
|||||||
assertFalse(app.mActivityRecord.mImeInsetsFrozenUntilStartInput);
|
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) {
|
private void assertHasStartingWindow(ActivityRecord atoken) {
|
||||||
assertNotNull(atoken.mStartingSurface);
|
assertNotNull(atoken.mStartingSurface);
|
||||||
assertNotNull(atoken.mStartingData);
|
assertNotNull(atoken.mStartingData);
|
||||||
|
|||||||
Reference in New Issue
Block a user