From d666f5462173ee2176cf1ece5698960db78e1ca8 Mon Sep 17 00:00:00 2001 From: Jeff Chang Date: Tue, 14 Sep 2021 17:46:10 +0800 Subject: [PATCH] Consider the source task while evaluating the launch-root-task 87a79d3a1d, always launches in the adjacent task of the launch root if the adjacent task is focused. The behavior resulting in Chrome launcher can not launch new tasks to the specified launch root anymore because the adjacent task is always in focus. We should think of using the source task to evaluate the launch-root-task instead of the focus state. Bug: 180079028 Bug: 198810232 Test: atest MultiWindowTests, WMShellUnitTests,TaskDisplayAreaTests Change-Id: I2ad7da94412b1dff1e0deb631b8a2d9b9565eac9 --- services/core/java/com/android/server/wm/TaskDisplayArea.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/services/core/java/com/android/server/wm/TaskDisplayArea.java b/services/core/java/com/android/server/wm/TaskDisplayArea.java index c7ca180bfa14e..3d6929a140807 100644 --- a/services/core/java/com/android/server/wm/TaskDisplayArea.java +++ b/services/core/java/com/android/server/wm/TaskDisplayArea.java @@ -1277,12 +1277,11 @@ final class TaskDisplayArea extends DisplayArea { for (int i = mLaunchRootTasks.size() - 1; i >= 0; --i) { if (mLaunchRootTasks.get(i).contains(windowingMode, activityType)) { final Task launchRootTask = mLaunchRootTasks.get(i).task; - // Return the focusable root task for improving the UX with staged split screen. final TaskFragment adjacentTaskFragment = launchRootTask != null ? launchRootTask.getAdjacentTaskFragment() : null; final Task adjacentRootTask = adjacentTaskFragment != null ? adjacentTaskFragment.asTask() : null; - if (adjacentRootTask != null && adjacentRootTask.isFocusedRootTaskOnDisplay()) { + if (sourceTask != null && sourceTask.getRootTask() == adjacentRootTask) { return adjacentRootTask; } else { return launchRootTask;