From 2369dfab4ffc15a022eb6355e63e40fafd17d4d9 Mon Sep 17 00:00:00 2001 From: Jeff Chang Date: Thu, 2 Jun 2022 14:32:57 +0800 Subject: [PATCH] Consider new_task flag when launching with adjacent We should consider the new_task if launching with adjacent flag, otherwise the other split is empty. This CL ignores the flag if there is no new-task flag present during the launching. Bug: 234696171 Test: atest ActivityStarterTests Change-Id: Icb646b73a24b6a9771a75f6745041d77af08f4e0 --- .../java/com/android/server/wm/ActivityStarter.java | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/services/core/java/com/android/server/wm/ActivityStarter.java b/services/core/java/com/android/server/wm/ActivityStarter.java index a30c7445225b9..3bf1c511f23a3 100644 --- a/services/core/java/com/android/server/wm/ActivityStarter.java +++ b/services/core/java/com/android/server/wm/ActivityStarter.java @@ -2501,11 +2501,6 @@ class ActivityStarter { } } - if ((mLaunchFlags & FLAG_ACTIVITY_LAUNCH_ADJACENT) != 0 && mSourceRecord == null) { - // ignore the flag if there is no the sourceRecord - mLaunchFlags &= ~FLAG_ACTIVITY_LAUNCH_ADJACENT; - } - // We'll invoke onUserLeaving before onPause only if the launching // activity did not explicitly state that this is an automated launch. mSupervisor.mUserLeaving = (mLaunchFlags & FLAG_ACTIVITY_NO_USER_ACTION) == 0; @@ -2700,6 +2695,12 @@ class ActivityStarter { mLaunchFlags |= FLAG_ACTIVITY_NEW_TASK; } } + + if ((mLaunchFlags & FLAG_ACTIVITY_LAUNCH_ADJACENT) != 0 + && ((mLaunchFlags & FLAG_ACTIVITY_NEW_TASK) == 0 || mSourceRecord == null)) { + // ignore the flag if there is no the sourceRecord or without new_task flag + mLaunchFlags &= ~FLAG_ACTIVITY_LAUNCH_ADJACENT; + } } private void computeSourceRootTask() {