Wake task persister whenever a new task is added
- The creation of a new task will trigger writing the task to disk in
several places. However, when a task is added to the TaskPersister
write queue (ie. in ActivityRecord.onParentChanged), the task may
not yet have been added to the set of RecentTasks.
The task persister, as a part of onPreProcessItem() will try to fetch
the persistable task ids to write from RecentTasks, which may not have
the new task, resulting in it skipping the write of the item (because
the set of persistable tasks have not changed).
The task is then not persisted until the next time a new item is added
to the write queue (can repro by starting a couple tasks, then rebooting
and opening recents again).
Instead, we should ensure that whenever a task is added to the recent
task list, we poke the task persister to ensure that it will have the
latest set of persisted tasks.
Bug: 146014211
Bug: 141560745
Test: atest RecentTasksTest
Test: Open an app, go home, open another app, wait for the task persister
delay and verify that the tasks are in recents
(adb shell dumpsys activity recents)
and also that the persisted tasks have been updated with all tasks
(adb shell cat /data/system_de/0/persisted_taskIds.txt)
Change-Id: I95f80d5fe2ef8d6c3128562bd36d4c95cd582eba
2 files changed