From b7eb3cfd001ef2394ded7c79aaecee18d57d0552 Mon Sep 17 00:00:00 2001 From: Louis Chang Date: Mon, 30 Sep 2019 21:41:52 +0800 Subject: [PATCH] Not resuming stack top activity while restarting if it is launched-behind Adding launched-behind condition check when determining whether to resume the stack top activity, instead of avoid resuming the launched-behind activity while restarting it. This should be done earlier because AWT and AR will be unified into one object, which updates AWT#mLaunchTaskBehind to false while committing visibility (via ActivityStack#makeVisibleAndRestartIfNeeded() -> AR#setVisible()), and breaks RecentsAnimationTest#testRestartRecentsActivity(). Bug: 80414790 Test: atest RecentsAnimationTest Change-Id: Ica95d4202c6b8e6d315432558529b0a8b7549efb --- .../java/com/android/server/wm/ActivityStack.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/services/core/java/com/android/server/wm/ActivityStack.java b/services/core/java/com/android/server/wm/ActivityStack.java index 2ab3e01278e98..ab1f258df8c71 100644 --- a/services/core/java/com/android/server/wm/ActivityStack.java +++ b/services/core/java/com/android/server/wm/ActivityStack.java @@ -2106,7 +2106,11 @@ class ActivityStack extends ConfigurationContainer { boolean aboveTop = top != null; final boolean stackShouldBeVisible = shouldBeVisible(starting); boolean behindFullscreenActivity = !stackShouldBeVisible; - final boolean resumeTopActivity = isFocusable() && isInStackLocked(starting) == null; + // We should not resume activities that being launched behind because these + // activities are actually behind other fullscreen activities, but still required + // to be visible (such as performing Recents animation). + final boolean resumeTopActivity = isFocusable() && isInStackLocked(starting) == null + && top != null && !top.mLaunchTaskBehind; for (int taskNdx = mTaskHistory.size() - 1; taskNdx >= 0; --taskNdx) { final TaskRecord task = mTaskHistory.get(taskNdx); final ArrayList activities = task.mActivities; @@ -2332,11 +2336,7 @@ class ActivityStack extends ConfigurationContainer { r.setVisible(true); } if (r != starting) { - // We should not resume activities that being launched behind because these - // activities are actually behind other fullscreen activities, but still required - // to be visible (such as performing Recents animation). - mStackSupervisor.startSpecificActivityLocked(r, andResume && !r.mLaunchTaskBehind, - true /* checkConfig */); + mStackSupervisor.startSpecificActivityLocked(r, andResume, true /* checkConfig */); return true; } }