summaryrefslogtreecommitdiffstats
path: root/src/com/android/launcher3/widget/WidgetCell.java
diff options
context:
space:
mode:
authorArtem Shvadskiy <ashvadskiy@cyngn.com>2016-05-03 15:40:57 -0700
committerTom Powell <zifnab@zifnab06.net>2017-03-26 16:21:58 -0700
commit0b990edb72f7c0c9e44b1b81fa92706c92b5cf11 (patch)
treeb480b6adc9f52ad377a201ff6c1430e2fc9dd31c /src/com/android/launcher3/widget/WidgetCell.java
parentbf2936147231a13c913e9367cae119b79f1d64b6 (diff)
downloadandroid_packages_apps_Trebuchet-0b990edb72f7c0c9e44b1b81fa92706c92b5cf11.tar.gz
android_packages_apps_Trebuchet-0b990edb72f7c0c9e44b1b81fa92706c92b5cf11.tar.bz2
android_packages_apps_Trebuchet-0b990edb72f7c0c9e44b1b81fa92706c92b5cf11.zip
Prevent widget previews from showing empty images.
When scrolling through the widget drawer, we submit multiple AsyncTasks to load and display preview images. On certain devices, attempting to load these images from AppWidgetManagerCompat (when we are generating previews for the first time) on a multi-threaded executor can cause us to receive empty images. To avoid this, we allow preview loading from the cache on a multi-threaded executor, but defer preview generation to a single-threaded executor. Additionally, the read and write db methods were not using the same ComponentName output (flattenToString vs flattenToSimpleString), which was resulting in consistent cache misses that forced unnecessary preview regeneration. This has been unified so we properly load from the cache. Change-Id: I3a90cf88fed531713e5d2df876f4ede822f7d569 issue-id: FEIJ-346
Diffstat (limited to 'src/com/android/launcher3/widget/WidgetCell.java')
-rw-r--r--src/com/android/launcher3/widget/WidgetCell.java6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/com/android/launcher3/widget/WidgetCell.java b/src/com/android/launcher3/widget/WidgetCell.java
index 94bbd929f..761747b5f 100644
--- a/src/com/android/launcher3/widget/WidgetCell.java
+++ b/src/com/android/launcher3/widget/WidgetCell.java
@@ -183,7 +183,7 @@ public class WidgetCell extends LinearLayout implements OnLayoutChangeListener {
public void ensurePreview() {
if (mActiveRequest != null) {
- return;
+ mActiveRequest.cleanup();
}
int[] size = getPreviewSize();
if (DEBUG) {
@@ -227,4 +227,8 @@ public class WidgetCell extends LinearLayout implements OnLayoutChangeListener {
}
return "";
}
+
+ public PreviewLoadRequest getActiveRequest() {
+ return mActiveRequest;
+ }
}