Fixing regression in background task loading.
Bug: 117603579 Test: Take systrace, ensure that we aren't loading thumbnails on the UI thread Change-Id: I4b522246a5ab12dc37c1dffdccd05232bbc1f6fe
This commit is contained in:
parent
d4dc9545c3
commit
f107c9ef6d
|
@ -143,8 +143,8 @@ public class RecentsModel extends TaskStackChangeListener {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Keep the cache up to date with the latest thumbnails
|
// Keep the cache up to date with the latest thumbnails
|
||||||
|
int runningTaskId = RecentsModel.getRunningTaskId();
|
||||||
mTaskList.getTasks(mThumbnailCache.getCacheSize(), true /* keysOnly */, (tasks) -> {
|
mTaskList.getTasks(mThumbnailCache.getCacheSize(), true /* keysOnly */, (tasks) -> {
|
||||||
int runningTaskId = RecentsModel.getRunningTaskId();
|
|
||||||
for (Task task : tasks) {
|
for (Task task : tasks) {
|
||||||
if (task.key.id == runningTaskId) {
|
if (task.key.id == runningTaskId) {
|
||||||
// Skip the running task, it's not going to have an up-to-date snapshot by the
|
// Skip the running task, it's not going to have an up-to-date snapshot by the
|
||||||
|
|
|
@ -108,8 +108,9 @@ public class TaskThumbnailCache {
|
||||||
Preconditions.assertUIThread();
|
Preconditions.assertUIThread();
|
||||||
|
|
||||||
// Fetch the thumbnail for this task and put it in the cache
|
// Fetch the thumbnail for this task and put it in the cache
|
||||||
mCache.put(task.key, ActivityManagerWrapper.getInstance().getTaskThumbnail(
|
updateThumbnailInBackground(task, true /* reducedResolution */, (t) -> {
|
||||||
task.key.id, true /* reducedResolution */));
|
mCache.put(task.key, t.thumbnail);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue