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

Commit bf914699 authored by Andrii Kulian's avatar Andrii Kulian Committed by android-build-merger
Browse files

Merge \"Don\'t update mTaskToReturnTo when task is cleared\" into nyc-dev

am: 1a77efe9

Change-Id: Idb9aad2fb3161552b699f271bed940cb47fd98ad
parents 7fbbbd5e 1a77efe9
Loading
Loading
Loading
Loading
+10 −6
Original line number Original line Diff line number Diff line
@@ -167,8 +167,9 @@ class ActivityStarter {
    private Intent mNewTaskIntent;
    private Intent mNewTaskIntent;
    private ActivityStack mSourceStack;
    private ActivityStack mSourceStack;
    private ActivityStack mTargetStack;
    private ActivityStack mTargetStack;
    // TODO: Is the mMoveHome flag really needed?
    // Indicates that we moved other task and are going to put something on top soon, so
    private boolean mMovedHome;
    // we don't want to show it redundantly or accidentally change what's shown below.
    private boolean mMovedOtherTask;
    private boolean mMovedToFront;
    private boolean mMovedToFront;
    private boolean mNoAnimation;
    private boolean mNoAnimation;
    private boolean mKeepCurTransition;
    private boolean mKeepCurTransition;
@@ -206,7 +207,7 @@ class ActivityStarter {
        mSourceStack = null;
        mSourceStack = null;


        mTargetStack = null;
        mTargetStack = null;
        mMovedHome = false;
        mMovedOtherTask = false;
        mMovedToFront = false;
        mMovedToFront = false;
        mNoAnimation = false;
        mNoAnimation = false;
        mKeepCurTransition = false;
        mKeepCurTransition = false;
@@ -1039,7 +1040,6 @@ class ActivityStarter {
                resumeTargetStackIfNeeded();
                resumeTargetStackIfNeeded();
                return START_RETURN_INTENT_TO_CALLER;
                return START_RETURN_INTENT_TO_CALLER;
            }
            }

            setTaskFromIntentActivity(mReusedActivity);
            setTaskFromIntentActivity(mReusedActivity);


            if (!mAddingToTask && mReuseTask == null) {
            if (!mAddingToTask && mReuseTask == null) {
@@ -1108,7 +1108,7 @@ class ActivityStarter {
                Slog.e(TAG, "Attempted Lock Task Mode violation mStartActivity=" + mStartActivity);
                Slog.e(TAG, "Attempted Lock Task Mode violation mStartActivity=" + mStartActivity);
                return START_RETURN_LOCK_TASK_MODE_VIOLATION;
                return START_RETURN_LOCK_TASK_MODE_VIOLATION;
            }
            }
            if (!mMovedHome) {
            if (!mMovedOtherTask) {
                updateTaskReturnToType(mStartActivity.task, mLaunchFlags, topStack);
                updateTaskReturnToType(mStartActivity.task, mLaunchFlags, topStack);
            }
            }
        } else if (mSourceRecord != null) {
        } else if (mSourceRecord != null) {
@@ -1472,7 +1472,7 @@ class ActivityStarter {
                if (mLaunchTaskBehind && mSourceRecord != null) {
                if (mLaunchTaskBehind && mSourceRecord != null) {
                    intentActivity.setTaskToAffiliateWith(mSourceRecord.task);
                    intentActivity.setTaskToAffiliateWith(mSourceRecord.task);
                }
                }
                mMovedHome = true;
                mMovedOtherTask = true;


                // If the launch flags carry both NEW_TASK and CLEAR_TASK, the task's activities
                // If the launch flags carry both NEW_TASK and CLEAR_TASK, the task's activities
                // will be cleared soon by ActivityStarter in setTaskFromIntentActivity().
                // will be cleared soon by ActivityStarter in setTaskFromIntentActivity().
@@ -1550,6 +1550,10 @@ class ActivityStarter {
            mReuseTask = intentActivity.task;
            mReuseTask = intentActivity.task;
            mReuseTask.performClearTaskLocked();
            mReuseTask.performClearTaskLocked();
            mReuseTask.setIntent(mStartActivity);
            mReuseTask.setIntent(mStartActivity);
            // When we clear the task - focus will be adjusted, which will bring another task
            // to top before we launch the activity we need. This will temporary swap their
            // mTaskToReturnTo values and we don't want to overwrite them accidentally.
            mMovedOtherTask = true;
        } else if ((mLaunchFlags & FLAG_ACTIVITY_CLEAR_TOP) != 0
        } else if ((mLaunchFlags & FLAG_ACTIVITY_CLEAR_TOP) != 0
                || mLaunchSingleInstance || mLaunchSingleTask) {
                || mLaunchSingleInstance || mLaunchSingleTask) {
            ActivityRecord top = intentActivity.task.performClearTaskLocked(mStartActivity,
            ActivityRecord top = intentActivity.task.performClearTaskLocked(mStartActivity,