mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-02-20 11:18:21 +00:00
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:
@@ -498,7 +498,9 @@ public class InstallShortcutReceiver extends BroadcastReceiver {
|
||||
return Pair.create((ItemInfo) si, (Object) activityInfo);
|
||||
} else if (shortcutInfo != null) {
|
||||
ShortcutInfo si = new ShortcutInfo(shortcutInfo, mContext);
|
||||
LauncherIcons.createShortcutIcon(shortcutInfo, mContext).applyTo(si);
|
||||
LauncherIcons li = LauncherIcons.obtain(mContext);
|
||||
li.createShortcutIcon(shortcutInfo).applyTo(si);
|
||||
li.recycle();
|
||||
return Pair.create((ItemInfo) si, (Object) shortcutInfo);
|
||||
} else if (providerInfo != null) {
|
||||
LauncherAppWidgetProviderInfo info = LauncherAppWidgetProviderInfo
|
||||
@@ -643,15 +645,18 @@ public class InstallShortcutReceiver extends BroadcastReceiver {
|
||||
info.user = Process.myUserHandle();
|
||||
|
||||
BitmapInfo iconInfo = null;
|
||||
LauncherIcons li = LauncherIcons.obtain(app.getContext());
|
||||
if (bitmap instanceof Bitmap) {
|
||||
iconInfo = LauncherIcons.createIconBitmap((Bitmap) bitmap, app.getContext());
|
||||
iconInfo = li.createIconBitmap((Bitmap) bitmap);
|
||||
} else {
|
||||
Parcelable extra = data.getParcelableExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE);
|
||||
if (extra instanceof Intent.ShortcutIconResource) {
|
||||
info.iconResource = (Intent.ShortcutIconResource) extra;
|
||||
iconInfo = LauncherIcons.createIconBitmap(info.iconResource, app.getContext());
|
||||
iconInfo = li.createIconBitmap(info.iconResource);
|
||||
}
|
||||
}
|
||||
li.recycle();
|
||||
|
||||
if (iconInfo == null) {
|
||||
iconInfo = app.getIconCache().getDefaultIcon(info.user);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user