Fixing dead lock in loading icon for recents
> getBitmapInfo() is called on background thead which blocks on the main thread to get InvariantDeviceProfile > getDefaultIcon() can be called on the main thread, which would get blocked on a previous call of getBitmapInfo() Bug: 117588621 Change-Id: I6549398c7e0a49284fe59950965495074ab8cdd0
This commit is contained in:
parent
4548a7d48d
commit
719f58b23f
|
@ -43,7 +43,6 @@ public class NormalizedIconLoader extends IconLoader {
|
|||
private final SparseArray<BitmapInfo> mDefaultIcons = new SparseArray<>();
|
||||
private final DrawableFactory mDrawableFactory;
|
||||
private final boolean mDisableColorExtraction;
|
||||
private LauncherIcons mLauncherIcons;
|
||||
|
||||
public NormalizedIconLoader(Context context, TaskKeyLruCache<Drawable> iconCache,
|
||||
LruCache<ComponentName, ActivityInfo> activityInfoCache,
|
||||
|
@ -73,19 +72,18 @@ public class NormalizedIconLoader extends IconLoader {
|
|||
false));
|
||||
}
|
||||
|
||||
private synchronized BitmapInfo getBitmapInfo(Drawable drawable, int userId,
|
||||
private BitmapInfo getBitmapInfo(Drawable drawable, int userId,
|
||||
int primaryColor, boolean isInstantApp) {
|
||||
if (mLauncherIcons == null) {
|
||||
mLauncherIcons = LauncherIcons.obtain(mContext);
|
||||
try (LauncherIcons la = LauncherIcons.obtain(mContext)) {
|
||||
if (mDisableColorExtraction) {
|
||||
mLauncherIcons.disableColorExtraction();
|
||||
la.disableColorExtraction();
|
||||
}
|
||||
}
|
||||
la.setWrapperBackgroundColor(primaryColor);
|
||||
|
||||
mLauncherIcons.setWrapperBackgroundColor(primaryColor);
|
||||
// User version code O, so that the icon is always wrapped in an adaptive icon container.
|
||||
return mLauncherIcons.createBadgedIconBitmap(drawable, UserHandle.of(userId),
|
||||
Build.VERSION_CODES.O, isInstantApp);
|
||||
// User version code O, so that the icon is always wrapped in an adaptive icon container
|
||||
return la.createBadgedIconBitmap(drawable, UserHandle.of(userId),
|
||||
Build.VERSION_CODES.O, isInstantApp);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in New Issue