Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4fb9663f authored by Jerry Chang's avatar Jerry Chang Committed by Automerger Merge Worker
Browse files

Merge "Fix not able to enter split screen with trampoline launch" into...

Merge "Fix not able to enter split screen with trampoline launch" into tm-qpr-dev am: 71c5174a am: 7009226a

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



Change-Id: Ib9a843a0dc82487f6f932f6861499b9bf71e90b9
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents fde9618e 7009226a
Loading
Loading
Loading
Loading
+17 −3
Original line number Diff line number Diff line
@@ -2645,9 +2645,9 @@ class ActivityStarter {

        if (differentTopTask && !mAvoidMoveToFront) {
            mStartActivity.intent.addFlags(Intent.FLAG_ACTIVITY_BROUGHT_TO_FRONT);
            if (mSourceRecord == null || (mSourceRootTask.getTopNonFinishingActivity() != null
                    && mSourceRootTask.getTopNonFinishingActivity().getTask()
                            == mSourceRecord.getTask())) {
            // TODO(b/264487981): Consider using BackgroundActivityStartController to determine
            //  whether to bring the launching activity to the front.
            if (mSourceRecord == null || inTopNonFinishingTask(mSourceRecord)) {
                // We really do want to push this one into the user's face, right now.
                if (mLaunchTaskBehind && mSourceRecord != null) {
                    intentActivity.setTaskToAffiliateWith(mSourceRecord.getTask());
@@ -2706,6 +2706,20 @@ class ActivityStarter {
                mRootWindowContainer.getDefaultTaskDisplayArea(), mTargetRootTask);
    }

    private boolean inTopNonFinishingTask(ActivityRecord r) {
        if (r == null || r.getTask() == null) {
            return false;
        }

        final Task rTask = r.getTask();
        final Task parent = rTask.getCreatedByOrganizerTask() != null
                ? rTask.getCreatedByOrganizerTask() : r.getRootTask();
        final ActivityRecord topNonFinishingActivity = parent != null
                ? parent.getTopNonFinishingActivity() : null;

        return topNonFinishingActivity != null && topNonFinishingActivity.getTask() == rTask;
    }

    private void resumeTargetRootTaskIfNeeded() {
        if (mDoResume) {
            final ActivityRecord next = mTargetRootTask.topRunningActivity(