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

Commit 9e0f8dea authored by Wale Ogunwale's avatar Wale Ogunwale Committed by Android (Google) Code Review
Browse files

Merge "Don't remove task from recents when moving task to another stack."

parents 950fbdff 000957ce
Loading
Loading
Loading
Loading
+13 −5
Original line number Diff line number Diff line
@@ -4203,14 +4203,22 @@ final class ActivityStack {
    }

    void removeTask(TaskRecord task, String reason) {
        removeTask(task, reason, true);
        removeTask(task, reason, true /* notMoving */);
    }

    void removeTask(TaskRecord task, String reason, boolean removeFromWindowManager) {
    /**
     * Removes the input task from this stack.
     * @param task to remove.
     * @param reason for removal.
     * @param notMoving task to another stack. In the case we are moving we don't want to perform
     *                  some operations on the task like removing it from window manager or recents.
     */
    void removeTask(TaskRecord task, String reason, boolean notMoving) {
        if (notMoving) {
            mStackSupervisor.endLockTaskModeIfTaskEnding(task);
        if (removeFromWindowManager) {
            mWindowManager.removeTask(task.taskId);
        }

        final ActivityRecord r = mResumedActivity;
        if (r != null && r.task == task) {
            mResumedActivity = null;
@@ -4227,7 +4235,7 @@ final class ActivityStack {
        mTaskHistory.remove(task);
        updateTaskMovement(task, true);

        if (task.mActivities.isEmpty()) {
        if (notMoving && task.mActivities.isEmpty()) {
            final boolean isVoiceSession = task.voiceSession != null;
            if (isVoiceSession) {
                try {
+1 −1
Original line number Diff line number Diff line
@@ -2836,7 +2836,7 @@ public final class ActivityStackSupervisor implements DisplayListener {
        }
        mWindowManager.moveTaskToStack(taskId, stackId, toTop);
        if (task.stack != null) {
            task.stack.removeTask(task, "moveTaskToStack", false);
            task.stack.removeTask(task, "moveTaskToStack", false /* notMoving */);
        }
        stack.addTask(task, toTop, true);
        resumeTopActivitiesLocked();
+2 −2
Original line number Diff line number Diff line
@@ -78,7 +78,7 @@ class Task {
        }
        if (DEBUG_STACK) Slog.i(TAG, "moveTaskToStack: removing taskId=" + mTaskId
                + " from stack=" + mStack);
        EventLog.writeEvent(EventLogTags.WM_TASK_REMOVED, mTaskId, "removeTask");
        EventLog.writeEvent(EventLogTags.WM_TASK_REMOVED, mTaskId, "moveTask");
        if (mStack != null) {
            mStack.removeTask(this);
        }
@@ -88,7 +88,7 @@ class Task {
    boolean removeAppToken(AppWindowToken wtoken) {
        boolean removed = mAppTokens.remove(wtoken);
        if (mAppTokens.size() == 0) {
            EventLog.writeEvent(com.android.server.EventLogTags.WM_TASK_REMOVED, mTaskId,
            EventLog.writeEvent(EventLogTags.WM_TASK_REMOVED, mTaskId,
                    "removeAppToken: last token");
            if (mDeferRemoval) {
                removeLocked();