summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Pragya Bajoria <pragyabajoria@google.com> 2025-01-13 03:00:24 -0800
committer Gerrit Code Review <noreply-gerritcodereview@google.com> 2025-01-13 03:00:24 -0800
commit441f3367e4c6d9c4406567227e5535396587b17c (patch)
treefc8894db57d0caa51c01da82d8af130301fbf9ec
parent98f0555dce914dc3807b936cc3aca3923b2a3f32 (diff)
parent3f045e24b218e8805fbaeb8b1bb59c5a89b63ef7 (diff)
Merge "Crash during Task switch" into main
-rw-r--r--libs/WindowManager/Shell/src/com/android/wm/shell/taskview/TaskViewTaskController.java5
1 files changed, 4 insertions, 1 deletions
diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/taskview/TaskViewTaskController.java b/libs/WindowManager/Shell/src/com/android/wm/shell/taskview/TaskViewTaskController.java
index e74342e1910c..1931ea969bbc 100644
--- a/libs/WindowManager/Shell/src/com/android/wm/shell/taskview/TaskViewTaskController.java
+++ b/libs/WindowManager/Shell/src/com/android/wm/shell/taskview/TaskViewTaskController.java
@@ -529,9 +529,12 @@ public class TaskViewTaskController implements ShellTaskOrganizer.TaskListener {
Slog.w(TAG, "Trying to remove a task that was never added? (no taskToken)");
return;
}
+ // Cache it to avoid NPE and make sure to remove it from recents history.
+ // mTaskToken can be cleared in onTaskVanished() when the task is removed.
+ final WindowContainerToken taskToken = mTaskToken;
mShellExecutor.execute(() -> {
WindowContainerTransaction wct = new WindowContainerTransaction();
- wct.removeTask(mTaskToken);
+ wct.removeTask(taskToken);
mTaskViewTransitions.closeTaskView(wct, this);
});
}