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

Commit 000957ce authored by Wale Ogunwale's avatar Wale Ogunwale
Browse files

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

Also, made event log reason for remove task when moving different
from when removing.

Bug: 19946163
Change-Id: Iea2b7a84040759e9ad0a7dc8c6f4aee67b15467b
parent cdf0a97f
Loading
Loading
Loading
Loading
+13 −5
Original line number Diff line number Diff line
@@ -4208,14 +4208,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;
@@ -4232,7 +4240,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();