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

Commit 1ac47791 authored by Craig Mautner's avatar Craig Mautner Committed by Android (Google) Code Review
Browse files

Merge "Propagate the return-to-home flag to next task."

parents 89852c14 e418ecd1
Loading
Loading
Loading
Loading
+12 −4
Original line number Diff line number Diff line
@@ -1235,11 +1235,18 @@ final class ActivityStack {
            return false;
        }

        if (prev != null && prev.mLaunchHomeTaskNext && prev.finishing && topTask() == prev.task &&
                prev.task.getTopActivity() == null) {
        if (prev != null && prev.mLaunchHomeTaskNext && prev.finishing && prev.frontOfTask) {
            if (DEBUG_STACK)  mStackSupervisor.validateTopActivitiesLocked();
            final TaskRecord task = prev.task;
            if (topTask() != task) {
                // This task is going away but it was supposed to return to the home task.
                // Now the task above it has to return to the home task instead.
                final int taskNdx = mTaskHistory.indexOf(task) + 1;
                mTaskHistory.get(taskNdx).mActivities.get(0).mLaunchHomeTaskNext = true;
            } else {
                return mStackSupervisor.resumeHomeActivity(prev);
            }
        }

        // If we are sleeping, and there is no resumed activity, and the top
        // activity is paused, well that is the state we want.
@@ -2948,7 +2955,7 @@ final class ActivityStack {
            }
            if ((flags & ActivityManager.MOVE_TASK_WITH_HOME) != 0) {
                // Caller wants the home activity moved with it.  To accomplish this,
                // we'll just move the home task to the top first.
                // we'll just indicate that this task returns to the home task.
                task.mActivities.get(0).mLaunchHomeTaskNext = true;
            }
            moveTaskToFrontLocked(task, null, options);
@@ -3066,6 +3073,7 @@ final class ActivityStack {

        if (mResumedActivity != null && mResumedActivity.task == tr &&
                mResumedActivity.mLaunchHomeTaskNext) {
            // TODO: Can we skip the next line and just pass mResumedAct. to resumeHomeAct.()?
            mResumedActivity.mLaunchHomeTaskNext = false;
            return mStackSupervisor.resumeHomeActivity(null);
        }