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

Commit 312ba86b authored by Craig Mautner's avatar Craig Mautner
Browse files

Change task removal sequence

- Remove task after removing activity. Removing the task before
removing the activity led to problems when the task was still needed.

- In WindowManager wait for activity manager to remove the task.
Previously was automatically removing the task when the last activity
was removed.

Fixes bug 12957434.

Change-Id: I7f6b1f09a2e2a845f177f337769075c9376f8bdb
parent d9f9da39
Loading
Loading
Loading
Loading
+9 −9
Original line number Diff line number Diff line
@@ -2697,15 +2697,6 @@ final class ActivityStack {
            here.fillInStackTrace();
            Slog.i(TAG, "Removing activity " + r + " from stack");
        }
        final TaskRecord task = r.task;
        if (task != null && task.removeActivity(r)) {
            if (DEBUG_STACK) Slog.i(TAG,
                    "removeActivityFromHistoryLocked: last activity removed from " + this);
            if (mStackSupervisor.isFrontStack(this) && task == topTask() && task.mOnTopOfHome) {
                mStackSupervisor.moveHomeToTop();
            }
            removeTask(task);
        }
        r.takeFromHistory();
        removeTimeoutsForActivityLocked(r);
        if (DEBUG_STATES) Slog.v(TAG, "Moving to DESTROYED: " + r + " (removed from history)");
@@ -2716,6 +2707,15 @@ final class ActivityStack {
        if (VALIDATE_TOKENS) {
            validateAppTokensLocked();
        }
        final TaskRecord task = r.task;
        if (task != null && task.removeActivity(r)) {
            if (DEBUG_STACK) Slog.i(TAG,
                    "removeActivityFromHistoryLocked: last activity removed from " + this);
            if (mStackSupervisor.isFrontStack(this) && task == topTask() && task.mOnTopOfHome) {
                mStackSupervisor.moveHomeToTop();
            }
            removeTask(task);
        }
        cleanUpActivityServicesLocked(r);
        r.removeUriPermissionsLocked();
    }
+2 −2
Original line number Diff line number Diff line
@@ -4527,8 +4527,8 @@ public class WindowManagerService extends IWindowManager.Stub

    void removeAppFromTaskLocked(AppWindowToken wtoken) {
        final Task task = mTaskIdToTask.get(wtoken.groupId);
        if (!wtoken.mDeferRemoval && task != null && task.removeAppToken(wtoken)) {
            removeTaskLocked(task);
        if (task != null) {
            task.removeAppToken(wtoken);
        }
    }