OSDN Git Service

Prevent widget previews from showing empty images.
authorArtem Shvadskiy <ashvadskiy@cyngn.com>
Tue, 3 May 2016 22:40:57 +0000 (15:40 -0700)
committerArtem Shvadskiy <ashvadskiy@cyngn.com>
Tue, 3 May 2016 22:40:57 +0000 (15:40 -0700)
commitdd6f2a2891a8445591be3e9fa53db293d7fd880b
tree043698ac8de0fd2fd18536f246e7f967ee837d1f
parent90106d85b75a60a8bdc9c4ad891e4a2e7ce548dd
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
src/com/android/launcher3/WidgetPreviewLoader.java
src/com/android/launcher3/widget/WidgetCell.java
src/com/android/launcher3/widget/WidgetsContainerView.java