Thumbnail Cache - check canceled status on the right thread.
The cache was checking the canceled status on the background thread, but the cancel call was being made on the main thread. This was leading to canceled requests still delivering this thumbnail in some cases. Bug: 159840851 Test: local build and non-repo of bug Change-Id: I9a3556f6570eee1db39ebec202c115d58010d7f8
This commit is contained in:
@@ -166,11 +166,13 @@ public class TaskThumbnailCache {
|
||||
public void run() {
|
||||
ThumbnailData thumbnail = ActivityManagerWrapper.getInstance().getTaskThumbnail(
|
||||
key.id, lowResolution);
|
||||
if (isCanceled()) {
|
||||
// We don't call back to the provided callback in this case
|
||||
return;
|
||||
}
|
||||
|
||||
MAIN_EXECUTOR.execute(() -> {
|
||||
if (isCanceled()) {
|
||||
// We don't call back to the provided callback in this case
|
||||
return;
|
||||
}
|
||||
|
||||
mCache.put(key, thumbnail);
|
||||
callback.accept(thumbnail);
|
||||
onEnd();
|
||||
|
||||
Reference in New Issue
Block a user