diff options
| author | 2020-01-06 15:55:29 +0000 | |
|---|---|---|
| committer | 2020-01-06 15:55:29 +0000 | |
| commit | f5f05dff780f0cb73dfcd635a70d39f02d1db3d2 (patch) | |
| tree | 0eb6704a3b9649a9d946b75611c0513999e49f73 | |
| parent | d76aada89fca9b358bfdbcb2c9952edf9a54693d (diff) | |
| parent | d0c14f3a89f065ebe09a4d8643edd64718d2c66b (diff) | |
Merge "Hold off on destroying an activity until the resumed one is visible."
| -rw-r--r-- | services/core/java/com/android/server/wm/ActivityRecord.java | 3 | ||||
| -rw-r--r-- | services/tests/wmtests/src/com/android/server/wm/ActivityRecordTests.java | 2 |
2 files changed, 2 insertions, 3 deletions
diff --git a/services/core/java/com/android/server/wm/ActivityRecord.java b/services/core/java/com/android/server/wm/ActivityRecord.java index b156d1bd8886..8bedeae03ad4 100644 --- a/services/core/java/com/android/server/wm/ActivityRecord.java +++ b/services/core/java/com/android/server/wm/ActivityRecord.java @@ -2624,14 +2624,13 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A // TODO(b/137329632): find the next activity directly underneath this one, not just anywhere final ActivityRecord next = getDisplay().topRunningActivity( true /* considerKeyguardState */); - final boolean isVisible = mVisibleRequested || nowVisible; // isNextNotYetVisible is to check if the next activity is invisible, or it has been // requested to be invisible but its windows haven't reported as invisible. If so, it // implied that the current finishing activity should be added into stopping list rather // than destroy immediately. final boolean isNextNotYetVisible = next != null && (!next.nowVisible || !next.mVisibleRequested); - if (isVisible && isNextNotYetVisible) { + if ((mVisibleRequested || isState(PAUSED)) && isNextNotYetVisible) { // Add this activity to the list of stopping activities. It will be processed and // destroyed when the next activity reports idle. addToStopping(false /* scheduleIdle */, false /* idleDelayed */, diff --git a/services/tests/wmtests/src/com/android/server/wm/ActivityRecordTests.java b/services/tests/wmtests/src/com/android/server/wm/ActivityRecordTests.java index d6bd1d07a786..73b2f6b2dc37 100644 --- a/services/tests/wmtests/src/com/android/server/wm/ActivityRecordTests.java +++ b/services/tests/wmtests/src/com/android/server/wm/ActivityRecordTests.java @@ -902,7 +902,7 @@ public class ActivityRecordTests extends ActivityTestsBase { topActivity.mVisibleRequested = false; topActivity.nowVisible = false; topActivity.finishing = true; - topActivity.setState(PAUSED, "true"); + topActivity.setState(STOPPED, "true"); // Mark the bottom activity as not visible, so that we would wait for it before removing // the top one. mActivity.mVisibleRequested = false; |