Fix recents order being reversed sometimes

Occasionally, the recents list items were reversed.  This is because
RecentsTaskList#getTasks returns the actual backing list which we were
reversing, so we solve this by making a new array list.

Bug: 131367388
Test: Do repro in bug, no longer gives reversed order
Change-Id: I825d284e4768c2b53fedf07480e99d195acfa6d6
This commit is contained in:
Kevin
2019-04-30 12:51:32 -07:00
parent d9c0fe130b
commit 72e8025f75
@@ -80,7 +80,8 @@ public final class TaskListLoader {
return;
}
// TODO: Look into error checking / more robust handling for when things go wrong.
mTaskListChangeId = mRecentsModel.getTasks(tasks -> {
mTaskListChangeId = mRecentsModel.getTasks(loadedTasks -> {
ArrayList<Task> tasks = new ArrayList<>(loadedTasks);
// Reverse tasks to put most recent at the bottom of the view
Collections.reverse(tasks);
// Load task content