Throw exception from SystemUiProxy.getRecentTasks for invalid result
- The reason Recents is empty after a force-stop is when RecentsTasksList.getTasks is called first time after restart, the result is always invalid but we cached the invalid result with a chagneId(=1). The next time we call getTasks again, we think the cached result is valid, and returend an empty list. - The fix is to mark such result as invalid to avoid caching the wrong result Fix: 353926204 Test: RecentTasksListTest Flag: EXEMPT bugfix Change-Id: If15ab8fd7454db8a08c22b17eaac73f0c78aa75f
This commit is contained in:
1 parent
fd7499bb82
commit
3210f73125
3 files changed
+53
-14
No files matched your search
@@ -300,8 +300,12 @@ public class RecentTasksList {
|
||||
@VisibleForTesting
|
||||
TaskLoadResult loadTasksInBackground(int numTasks, int requestId, boolean loadKeysOnly) {
|
||||
int currentUserId = Process.myUserHandle().getIdentifier();
|
||||
ArrayList<GroupedRecentTaskInfo> rawTasks =
|
||||
mSysUiProxy.getRecentTasks(numTasks, currentUserId);
|
||||
ArrayList<GroupedRecentTaskInfo> rawTasks;
|
||||
try {
|
||||
rawTasks = mSysUiProxy.getRecentTasks(numTasks, currentUserId);
|
||||
} catch (SystemUiProxy.GetRecentTasksException e) {
|
||||
return INVALID_RESULT;
|
||||
}
|
||||
// The raw tasks are given in most-recent to least-recent order, we need to reverse it
|
||||
Collections.reverse(rawTasks);
|
||||
|
||||
@@ -416,8 +420,12 @@ public class RecentTasksList {
|
||||
}
|
||||
writer.println(prefix + " ]");
|
||||
int currentUserId = Process.myUserHandle().getIdentifier();
|
||||
ArrayList<GroupedRecentTaskInfo> rawTasks =
|
||||
mSysUiProxy.getRecentTasks(Integer.MAX_VALUE, currentUserId);
|
||||
ArrayList<GroupedRecentTaskInfo> rawTasks;
|
||||
try {
|
||||
rawTasks = mSysUiProxy.getRecentTasks(Integer.MAX_VALUE, currentUserId);
|
||||
} catch (SystemUiProxy.GetRecentTasksException e) {
|
||||
rawTasks = new ArrayList<>();
|
||||
}
|
||||
writer.println(prefix + " rawTasks=[");
|
||||
for (GroupedRecentTaskInfo task : rawTasks) {
|
||||
TaskInfo taskInfo1 = task.getTaskInfo1();
|
||||
|
||||
Reference in new issue
Block a user