Clear mEnterTransitionCoordinator after content shows.

Fixes: 233975804

After content has been shown, we should clear the
mEnterTransitonCoordinator so that the exit doesn't
accidentally try to use the enter transition information
to remove Views.

Test: manually tested example from bug report
Change-Id: Ida7ca354cb75953d1d5ecffc159da0d7320d4349
This commit is contained in:
George Mount
2022-06-08 14:22:41 -07:00
parent a55c15df95
commit 8aef548893

View File

@@ -263,6 +263,11 @@ class ActivityTransitionState {
// After orientation change, the onResume can come in before the top Activity has
// left, so if the Activity is not top, wait a second for the top Activity to exit.
if (mEnterTransitionCoordinator == null || activity.isTopOfTask()) {
if (mEnterTransitionCoordinator != null) {
mEnterTransitionCoordinator.runAfterTransitionsComplete(() -> {
mEnterTransitionCoordinator = null;
});
}
restoreExitedViews();
restoreReenteringViews();
} else {
@@ -271,6 +276,11 @@ class ActivityTransitionState {
public void run() {
if (mEnterTransitionCoordinator == null ||
mEnterTransitionCoordinator.isWaitingForRemoteExit()) {
if (mEnterTransitionCoordinator != null) {
mEnterTransitionCoordinator.runAfterTransitionsComplete(() -> {
mEnterTransitionCoordinator = null;
});
}
restoreExitedViews();
restoreReenteringViews();
} else if (mEnterTransitionCoordinator.isReturning()) {