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

Commit 51277a85 authored by Craig Mautner's avatar Craig Mautner
Browse files

Fixes to handleAppDiedLocked.

- Call in all circumstances but only set launchHomeTaskNext for
  focused stack. Previous version didn't call handleAppDiedLocked for
  non-focused stack.

- Rearrange logic to run down the top task and make sure that all
  remaining activities belong to the dying app. Previous version just
  looked at the top non-finishing activity and based its behavior on
  that.

Fixes bug 11029560.

Change-Id: Ic3a7c873c4c975577d6b390a8955ff41729bdfde
parent 7eb5ce03
Loading
Loading
Loading
Loading
+11 −12
Original line number Diff line number Diff line
@@ -3438,23 +3438,22 @@ final class ActivityStack {
        // Determine if the top task is exiting and should return to home. Do this before it gets
        // removed in removeHistoryRecordsForAppsLocked.
        boolean launchHomeNext = false;
        int top = mTaskHistory.size() - 1;
        while (top >= 0) {
            final TaskRecord topTask = mTaskHistory.get(top);
            if (topTask.mActivities.isEmpty()) {
                // Not possible, but just in case.
                --top;
        TaskRecord topTask = mTaskHistory.get(mTaskHistory.size() - 1);
        ArrayList<ActivityRecord> activities = topTask.mActivities;
        int activityNdx;
        for (activityNdx = activities.size() - 1; activityNdx >= 0; --activityNdx) {
            ActivityRecord r = activities.get(activityNdx);
            if (r.finishing) {
                continue;
            }
            ActivityRecord r = topTask.topRunningActivityLocked(null);
            if (r != null) {
                // r will be launched next.
            if (r.app != app) {
                // This is the dying activity.
                break;
            }
            // There is an activity in topTask that is finishing. If topTask belongs to the app
            // return to home depending on the task flag.
        }
        if (activityNdx < 0) {
            // All activities in task belong to app. Set launchHomeNext to task's value.
            launchHomeNext = topTask.mOnTopOfHome;
            break;
        }

        removeHistoryRecordsForAppLocked(app);
+1 −1
Original line number Diff line number Diff line
@@ -1932,7 +1932,7 @@ public final class ActivityStackSupervisor {
        for (int stackNdx = 0; stackNdx < numStacks; ++stackNdx) {
            final ActivityStack stack = mStacks.get(stackNdx);
            // Only update launchHomeTaskNext for the focused stack.
            launchHomeTaskNext |= (stack == focusedStack && stack.handleAppDiedLocked(app));
            launchHomeTaskNext |= (stack.handleAppDiedLocked(app) && stack == focusedStack);
        }

        if (!restarting) {