Removing legacy default thumbnail logic.
- With the move to snapshots, we no longer keep a local cache of the
thumbnails and tasks which have no thumbnails will be handled
in the snapshot from the system (if it uses FLAG_SECURE) or in
Recents directly through the task description background color.
In the case of this bug, the default thumbnail (1x1 white bitmap) was
incorrectly being applied because the system could not take a snapshot
of the app due to DRM.
Bug: 62447895
Test: Open any app with DRM, play video, tap Recents
Change-Id: I02e87cf513eb9750b39d54d085b0c19645b7ed52
diff --git a/packages/SystemUI/src/com/android/systemui/recents/model/RecentsTaskLoader.java b/packages/SystemUI/src/com/android/systemui/recents/model/RecentsTaskLoader.java
index 15e1739..1da2d74 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/model/RecentsTaskLoader.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/model/RecentsTaskLoader.java
@@ -100,7 +100,6 @@
TaskResourceLoadQueue mLoadQueue;
TaskKeyLruCache<Drawable> mIconCache;
- Bitmap mDefaultThumbnail;
BitmapDrawable mDefaultIcon;
boolean mStarted;
@@ -111,11 +110,10 @@
/** Constructor, creates a new loading thread that loads task resources in the background */
public BackgroundTaskLoader(TaskResourceLoadQueue loadQueue,
- TaskKeyLruCache<Drawable> iconCache, Bitmap defaultThumbnail,
- BitmapDrawable defaultIcon, OnIdleChangedListener onIdleChangedListener) {
+ TaskKeyLruCache<Drawable> iconCache, BitmapDrawable defaultIcon,
+ OnIdleChangedListener onIdleChangedListener) {
mLoadQueue = loadQueue;
mIconCache = iconCache;
- mDefaultThumbnail = defaultThumbnail;
mDefaultIcon = defaultIcon;
mMainThreadHandler = new Handler();
mOnIdleChangedListener = onIdleChangedListener;
@@ -230,18 +228,14 @@
}
if (DEBUG) Log.d(TAG, "Loading thumbnail: " + t.key);
- final ThumbnailData cachedThumbnailData = ssp.getTaskThumbnail(t.key.id,
+ final ThumbnailData thumbnailData = ssp.getTaskThumbnail(t.key.id,
true /* reducedResolution */);
- if (cachedThumbnailData.thumbnail == null) {
- cachedThumbnailData.thumbnail = mDefaultThumbnail;
- }
-
if (!mCancelled) {
// Notify that the task data has changed
final Drawable finalIcon = cachedIcon;
mMainThreadHandler.post(
- () -> t.notifyTaskDataLoaded(cachedThumbnailData, finalIcon));
+ () -> t.notifyTaskDataLoaded(thumbnailData, finalIcon));
}
}
}
@@ -282,7 +276,6 @@
int mDefaultTaskBarBackgroundColor;
int mDefaultTaskViewBackgroundColor;
BitmapDrawable mDefaultIcon;
- Bitmap mDefaultThumbnail;
private TaskKeyLruCache.EvictionCallback mClearActivityInfoOnEviction =
new TaskKeyLruCache.EvictionCallback() {
@@ -304,15 +297,10 @@
mMaxIconCacheSize = res.getInteger(R.integer.config_recents_max_icon_count);
int iconCacheSize = RecentsDebugFlags.Static.DisableBackgroundCache ? 1 :
mMaxIconCacheSize;
- int thumbnailCacheSize = RecentsDebugFlags.Static.DisableBackgroundCache ? 1 :
- mMaxThumbnailCacheSize;
// Create the default assets
Bitmap icon = Bitmap.createBitmap(1, 1, Bitmap.Config.ALPHA_8);
icon.eraseColor(0);
- mDefaultThumbnail = Bitmap.createBitmap(1, 1, Bitmap.Config.ARGB_8888);
- mDefaultThumbnail.setHasAlpha(false);
- mDefaultThumbnail.eraseColor(0xFFffffff);
mDefaultIcon = new BitmapDrawable(context.getResources(), icon);
// Initialize the proxy, cache and loaders
@@ -325,7 +313,7 @@
mContentDescriptionCache = new TaskKeyLruCache<>(numRecentTasks,
mClearActivityInfoOnEviction);
mActivityInfoCache = new LruCache(numRecentTasks);
- mLoader = new BackgroundTaskLoader(mLoadQueue, mIconCache, mDefaultThumbnail, mDefaultIcon,
+ mLoader = new BackgroundTaskLoader(mLoadQueue, mIconCache, mDefaultIcon,
mHighResThumbnailLoader::setTaskLoadQueueIdle);
}