Merge "Avoid creating new instance when started for result with singleInstance/singleTask" into sc-dev am: 38e2107006

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/13433265

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Ic01f3f7a02ea1d0e0ea613869b94b6df2e4a2e72
This commit is contained in:
Jeff Chang
2021-02-05 10:18:35 +00:00
committed by Automerger Merge Worker

View File

@@ -1814,8 +1814,7 @@ class ActivityStarter {
}
private Task computeTargetTask() {
if (mStartActivity.resultTo == null && mInTask == null && !mAddingToTask
&& (mLaunchFlags & FLAG_ACTIVITY_NEW_TASK) != 0) {
if (mInTask == null && !mAddingToTask && (mLaunchFlags & FLAG_ACTIVITY_NEW_TASK) != 0) {
// A new task should be created instead of using existing one.
return null;
} else if (mSourceRecord != null) {
@@ -2505,7 +2504,9 @@ class ActivityStarter {
// If bring to front is requested, and no result is requested and we have not been given
// an explicit task to launch in to, and we can find a task that was started with this
// same component, then instead of launching bring that one to the front.
putIntoExistingTask &= mInTask == null && mStartActivity.resultTo == null;
putIntoExistingTask &= !isLaunchModeOneOf(LAUNCH_SINGLE_INSTANCE, LAUNCH_SINGLE_TASK)
? (mInTask == null && mStartActivity.resultTo == null)
: (mInTask == null);
ActivityRecord intentActivity = null;
if (putIntoExistingTask) {
if (LAUNCH_SINGLE_INSTANCE == mLaunchMode) {