From 1c32f49199daf41d8197c1138787036420e4d998 Mon Sep 17 00:00:00 2001 From: Winson Chung Date: Fri, 10 Apr 2020 12:37:10 -0700 Subject: [PATCH] Fixing issue with removing tasks immediately after boot - Due to tasks only being loaded in the task list and not in the task hierarchy, ensure that we listen to the task list callback to invalidate the cached list as well. Bug: 144892997 Change-Id: I0aa2ac0e629b8883410ebafbdc4ca2d5d9bc0fca --- .../src/com/android/quickstep/RecentTasksList.java | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/quickstep/src/com/android/quickstep/RecentTasksList.java b/quickstep/src/com/android/quickstep/RecentTasksList.java index 10f9febfb7..b0ce8e6cf9 100644 --- a/quickstep/src/com/android/quickstep/RecentTasksList.java +++ b/quickstep/src/com/android/quickstep/RecentTasksList.java @@ -123,6 +123,17 @@ public class RecentTasksList extends TaskStackChangeListener { mChangeId++; } + @Override + public void onRecentTaskListUpdated() { + // In some cases immediately after booting, the tasks in the system recent task list may be + // loaded, but not in the active task hierarchy in the system. These tasks are displayed in + // overview, but removing them don't result in a onTaskStackChanged() nor a onTaskRemoved() + // callback (those are for changes to the active tasks), but the task list is still updated, + // so we should also invalidate the change id to ensure we load a new list instead of + // reusing a stale list. + mChangeId++; + } + @Override public void onTaskRemoved(int taskId) { mTasks = loadTasksInBackground(Integer.MAX_VALUE, false);