From 36f5d615f4c077bf5df97f09e29dc39b5672937e Mon Sep 17 00:00:00 2001 From: Jeff Chang Date: Wed, 10 May 2023 08:58:16 +0000 Subject: [PATCH] =?UTF-8?q?Don=E2=80=98t=20consider=20adjacent=20launch=20?= =?UTF-8?q?root=20if=20the=20existing=20task=20is't=20on=20top?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The adjacent task is considered as a launch root task if an existing task is already in the adjacent task of the launch target. This CL updates the policy while the task is located in an adjacent task and the existing task is on the top. Bug: 280392203 Test: atest ActivityStarterTests Test: split(A|B)->split(A,C|B),drag A to B’side, Result:split(C|A) Change-Id: I006de0438c572defe4f770d29378c8ddfadc351d --- services/core/java/com/android/server/wm/ActivityStarter.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/services/core/java/com/android/server/wm/ActivityStarter.java b/services/core/java/com/android/server/wm/ActivityStarter.java index e8acbe43689c5..3e3eb570d0e3f 100644 --- a/services/core/java/com/android/server/wm/ActivityStarter.java +++ b/services/core/java/com/android/server/wm/ActivityStarter.java @@ -2929,7 +2929,8 @@ class ActivityStarter { // the adjacent task as its launch target. So the existing task will be launched into the // closer one and won't be reparent redundantly. final Task adjacentTargetTask = mTargetRootTask.getAdjacentTask(); - if (adjacentTargetTask != null && intentActivity.isDescendantOf(adjacentTargetTask)) { + if (adjacentTargetTask != null && intentActivity.isDescendantOf(adjacentTargetTask) + && intentTask.isOnTop()) { mTargetRootTask = adjacentTargetTask; }