Check task switch by comparing leaf task.

In multi-window mode, the previous top root task can be the parent of
the task of launched activity, so the task switch should comparing by
leaf task level.

Bug: 231363211
Test: atest ActivityStarterTests
Test: enter split screen, start another activity from an existing task,
verify there won't create starting window on that task.

Change-Id: Iaf59e405671a1b8a6674bab4f49ee36b6eb24da3
This commit is contained in:
wilsonshih
2022-05-17 13:15:56 +08:00
parent ac94a2dacd
commit c63ea765b5

View File

@@ -1786,7 +1786,8 @@ class ActivityStarter {
}
// Get top task at beginning because the order may be changed when reusing existing task.
final Task prevTopTask = mPreferredTaskDisplayArea.getFocusedRootTask();
final Task prevTopRootTask = mPreferredTaskDisplayArea.getFocusedRootTask();
final Task prevTopTask = prevTopRootTask != null ? prevTopRootTask.getTopLeafTask() : null;
final Task reusedTask = getReusableTask();
// If requested, freeze the task list