diff options
| author | 2020-04-24 11:41:29 +0800 | |
|---|---|---|
| committer | 2020-04-24 16:27:43 +0800 | |
| commit | a31e01fc2523c009573ad5e78468977786ea18de (patch) | |
| tree | 68cf7cf92ec541d062425b9b9d0decebc933605f | |
| parent | 6dd1627a27d9dc403cf99d23f80068f2edc07496 (diff) | |
Only adjust the task position when there is no move-to-top request.
Adjust the check order when adjusting the focus.
If there is no move-to-top request, only adjust the task position,
otherwise it may send top position change to unrelated activities.
Bug: 154685134
Test: atest ActivityLifecycleTopResumedStateTests
Test: atest ActivityRecordTests
Change-Id: I0827641b8f24e8f42e6b8e8703648dc540c902ef
| -rw-r--r-- | services/core/java/com/android/server/wm/Task.java | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/services/core/java/com/android/server/wm/Task.java b/services/core/java/com/android/server/wm/Task.java index 66e1b1758d85..a9f6a2f1334b 100644 --- a/services/core/java/com/android/server/wm/Task.java +++ b/services/core/java/com/android/server/wm/Task.java @@ -2688,9 +2688,16 @@ class Task extends WindowContainer<WindowContainer> { return null; } + final ActivityStack rootTask = (ActivityStack) focusableTask.getRootTask(); + if (!moveParentsToTop) { + // Only move the next stack to top in its task container. + WindowContainer parent = focusableTask.getParent(); + parent.positionChildAt(POSITION_TOP, focusableTask, false /* includingParents */); + return rootTask; + } + final String myReason = reason + " adjustFocusToNextFocusableStack"; final ActivityRecord top = focusableTask.topRunningActivity(); - final ActivityStack rootTask = (ActivityStack) focusableTask.getRootTask(); if (focusableTask.isActivityTypeHome() && (top == null || !top.mVisibleRequested)) { // If we will be focusing on the home stack next and its current top activity isn't // visible, then use the move the home stack task to top to make the activity visible. @@ -2698,13 +2705,6 @@ class Task extends WindowContainer<WindowContainer> { return rootTask; } - if (!moveParentsToTop) { - // Only move the next stack to top in its task container. - WindowContainer parent = focusableTask.getParent(); - parent.positionChildAt(POSITION_TOP, focusableTask, false /* includingParents */); - return rootTask; - } - // Move the entire hierarchy to top with updating global top resumed activity // and focused application if needed. focusableTask.moveToFront(myReason); |