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
This commit is contained in:
Winson Chung committed 2020-04-14 21:03:40 +00:00
1 parent 641fa0659e
commit 1c32f49199
1 file changed
+11
@@ -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);