use of com.android.quickstep.util.CancellableTask in project android_packages_apps_Launcher3 by crdroidandroid.
the class TaskThumbnailCache method updateThumbnailInBackground.
private CancellableTask updateThumbnailInBackground(TaskKey key, boolean lowResolution, Consumer<ThumbnailData> callback) {
Preconditions.assertUIThread();
ThumbnailData cachedThumbnail = mCache.getAndInvalidateIfModified(key);
if (cachedThumbnail != null && (!cachedThumbnail.reducedResolution || lowResolution)) {
// Already cached, lets use that thumbnail
callback.accept(cachedThumbnail);
return null;
}
CancellableTask<ThumbnailData> request = new CancellableTask<ThumbnailData>() {
@Override
public ThumbnailData getResultOnBg() {
return ActivityManagerWrapper.getInstance().getTaskThumbnail(key.id, lowResolution);
}
@Override
public void handleResult(ThumbnailData result) {
mCache.put(key, result);
callback.accept(result);
}
};
mBgExecutor.execute(request);
return request;
}
use of com.android.quickstep.util.CancellableTask in project android_packages_apps_Launcher3 by ArrowOS.
the class TaskThumbnailCache method updateThumbnailInBackground.
private CancellableTask updateThumbnailInBackground(TaskKey key, boolean lowResolution, Consumer<ThumbnailData> callback) {
Preconditions.assertUIThread();
ThumbnailData cachedThumbnail = mCache.getAndInvalidateIfModified(key);
if (cachedThumbnail != null && cachedThumbnail.thumbnail != null && (!cachedThumbnail.reducedResolution || lowResolution)) {
// Already cached, lets use that thumbnail
callback.accept(cachedThumbnail);
return null;
}
CancellableTask<ThumbnailData> request = new CancellableTask<ThumbnailData>() {
@Override
public ThumbnailData getResultOnBg() {
return ActivityManagerWrapper.getInstance().getTaskThumbnail(key.id, lowResolution);
}
@Override
public void handleResult(ThumbnailData result) {
mCache.put(key, result);
callback.accept(result);
}
};
mBgExecutor.execute(request);
return request;
}
use of com.android.quickstep.util.CancellableTask in project android_packages_apps_Launcher3 by ProtonAOSP.
the class TaskThumbnailCache method updateThumbnailInBackground.
private CancellableTask updateThumbnailInBackground(TaskKey key, boolean lowResolution, Consumer<ThumbnailData> callback) {
Preconditions.assertUIThread();
ThumbnailData cachedThumbnail = mCache.getAndInvalidateIfModified(key);
if (cachedThumbnail != null && cachedThumbnail.thumbnail != null && (!cachedThumbnail.reducedResolution || lowResolution)) {
// Already cached, lets use that thumbnail
callback.accept(cachedThumbnail);
return null;
}
CancellableTask<ThumbnailData> request = new CancellableTask<ThumbnailData>() {
@Override
public ThumbnailData getResultOnBg() {
return ActivityManagerWrapper.getInstance().getTaskThumbnail(key.id, lowResolution);
}
@Override
public void handleResult(ThumbnailData result) {
mCache.put(key, result);
callback.accept(result);
}
};
mBgExecutor.execute(request);
return request;
}
use of com.android.quickstep.util.CancellableTask in project android_packages_apps_404Launcher by P-404.
the class TaskThumbnailCache method updateThumbnailInBackground.
private CancellableTask updateThumbnailInBackground(TaskKey key, boolean lowResolution, Consumer<ThumbnailData> callback) {
Preconditions.assertUIThread();
ThumbnailData cachedThumbnail = mCache.getAndInvalidateIfModified(key);
if (cachedThumbnail != null && cachedThumbnail.thumbnail != null && (!cachedThumbnail.reducedResolution || lowResolution)) {
// Already cached, lets use that thumbnail
callback.accept(cachedThumbnail);
return null;
}
CancellableTask<ThumbnailData> request = new CancellableTask<ThumbnailData>() {
@Override
public ThumbnailData getResultOnBg() {
return ActivityManagerWrapper.getInstance().getTaskThumbnail(key.id, lowResolution);
}
@Override
public void handleResult(ThumbnailData result) {
mCache.put(key, result);
callback.accept(result);
}
};
mBgExecutor.execute(request);
return request;
}
use of com.android.quickstep.util.CancellableTask in project android_packages_apps_Launcher3 by AOSPA.
the class TaskThumbnailCache method updateThumbnailInBackground.
private CancellableTask updateThumbnailInBackground(TaskKey key, boolean lowResolution, Consumer<ThumbnailData> callback) {
Preconditions.assertUIThread();
ThumbnailData cachedThumbnail = mCache.getAndInvalidateIfModified(key);
if (cachedThumbnail != null && cachedThumbnail.thumbnail != null && (!cachedThumbnail.reducedResolution || lowResolution)) {
// Already cached, lets use that thumbnail
callback.accept(cachedThumbnail);
return null;
}
CancellableTask<ThumbnailData> request = new CancellableTask<ThumbnailData>() {
@Override
public ThumbnailData getResultOnBg() {
return ActivityManagerWrapper.getInstance().getTaskThumbnail(key.id, lowResolution);
}
@Override
public void handleResult(ThumbnailData result) {
mCache.put(key, result);
callback.accept(result);
}
};
mBgExecutor.execute(request);
return request;
}
Aggregations