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

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

Put new Activity at frontOfTask

If all previous activities are finishing then a newly added activity
should be marked frontOfTask. Not doing so will cause the wrong
activity to be brought up next.

Fixes bug 12054192.
Fixes bug 11575233.

Change-Id: I663a4da62aa55359c2e970276a6c7cade557634f
parent 1eb87f2c
Loading
Loading
Loading
Loading
+15 −0
Original line number Diff line number Diff line
@@ -1769,6 +1769,21 @@ final class ActivityStack {

        r.putInHistory();
        r.frontOfTask = newTask;
        if (!r.frontOfTask) {
            // It is possible that the current frontOfTask activity is finishing. Check for that.
            ArrayList<ActivityRecord> activities = task.mActivities;
            for (int activityNdx = 0; activityNdx < activities.size(); ++activityNdx) {
                final ActivityRecord activity = activities.get(activityNdx);
                if (activity.finishing) {
                    continue;
                }
                if (activity == r) {
                    // All activities before r are finishing.
                    r.frontOfTask = true;
                }
                break;
            }
        }
        if (!isHomeStack() || numActivities() > 0) {
            // We want to show the starting preview window if we are
            // switching to a new task, or the next activity's process is