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

Commit e418ecd1 authored by Craig Mautner's avatar Craig Mautner
Browse files

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

If a task is supposed to launch home when it finishes but then
launches another task and finishes itself, then the new task must
launch home when it finishes.

Fixes bug 8778263.

Change-Id: I6495f6c2e99a906217e73b7b6dcae8ecff435e5f
parent e0eb0e90
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);
        }