summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author sai.gairuboina-IN009276 <sai.gairuboina@oppo.com> 2025-01-09 20:55:08 +0530
committer sai.gairuboina-IN009276 <sai.gairuboina@oppo.com> 2025-01-10 10:06:32 +0530
commit3f045e24b218e8805fbaeb8b1bb59c5a89b63ef7 (patch)
tree223f3de0a57beb55fe230054868e3d941bc1f8ae
parent4109b47910ce9c361cc8cc0195963696c0eaf2e7 (diff)
Crash during Task switch
Problem: { 1.Open realmelink app->pair a device 2.add this app to google device controls 3.Click on the paired device multiple times and observe crash } Solution: { 1. Timing of methods in removeTask->resetTaskInfo->shellExecutor order is causing the crash 2. Cache the taskToken and use it in lamda to fix NPE and make sure task is removed from recents history } Bug: 388747629 https: //partnerissuetracker.corp.google.com/u/1/issues/388747629 Change-Id: I47a38a6a41ba4095c8d3bacf242e91230381454b
-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);
});
}