Merge "Preemptively clear the thumbnail cache as tasks are removed" into ub-launcher3-qt-dev
This commit is contained in:
@@ -476,6 +476,12 @@ public class TaskView extends FrameLayout implements PageCallbacks, Reusable {
|
||||
public void onRecycle() {
|
||||
resetViewTransforms();
|
||||
setFullscreenProgress(0);
|
||||
// Clear any references to the thumbnail (it will be re-read either from the cache or the
|
||||
// system on next bind)
|
||||
mSnapshotView.setThumbnail(mTask, null);
|
||||
if (mTask != null) {
|
||||
mTask.thumbnail = null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -119,6 +119,16 @@ public class RecentTasksList extends TaskStackChangeListener {
|
||||
mChangeId++;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTaskRemoved(int taskId) {
|
||||
for (int i = mTasks.size() - 1; i >= 0; i--) {
|
||||
if (mTasks.get(i).key.id == taskId) {
|
||||
mTasks.remove(i);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized void onActivityPinned(String packageName, int userId, int taskId,
|
||||
int stackId) {
|
||||
|
||||
@@ -166,6 +166,12 @@ public class RecentsModel extends TaskStackChangeListener {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTaskRemoved(int taskId) {
|
||||
Task.TaskKey dummyKey = new Task.TaskKey(taskId, 0, null, null, 0, 0);
|
||||
mThumbnailCache.remove(dummyKey);
|
||||
}
|
||||
|
||||
public void setSystemUiProxy(ISystemUiProxy systemUiProxy) {
|
||||
mSystemUiProxy = systemUiProxy;
|
||||
}
|
||||
|
||||
@@ -186,6 +186,13 @@ public class TaskThumbnailCache {
|
||||
mCache.evictAll();
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes the cached thumbnail for the given task.
|
||||
*/
|
||||
public void remove(Task.TaskKey key) {
|
||||
mCache.remove(key);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return The cache size.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user