Making LauncherIcons thread safe

Creating a pool of LauncherIcons so that they can be used from multiple threads

Change-Id: Idc7b5ddb47b6e338a5389f3c4faa6f63de108c72
This commit is contained in:
Sunny Goyal
2018-01-09 15:34:38 -08:00
parent 383b7fa02a
commit 18a4e5aefb
21 changed files with 276 additions and 391 deletions

View File

@@ -469,8 +469,11 @@ public class WidgetPreviewLoader {
}
RectF boxRect = drawBoxWithShadow(c, size, size);
Bitmap icon = LauncherIcons.createScaledBitmapWithoutShadow(
mutateOnMainThread(info.getFullResIcon(mIconCache)), mContext, 0);
LauncherIcons li = LauncherIcons.obtain(mContext);
Bitmap icon = li.createScaledBitmapWithoutShadow(
mutateOnMainThread(info.getFullResIcon(mIconCache)), 0);
li.recycle();
Rect src = new Rect(0, 0, icon.getWidth(), icon.getHeight());
boxRect.set(0, 0, iconSize, iconSize);