Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e0c16831 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Fixing dead lock in loading icon for recents" into ub-launcher3-master

parents 76cce29d 719f58b2
Loading
Loading
Loading
Loading
+8 −10
Original line number Diff line number Diff line
@@ -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,20 +72,19 @@ 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),
            // 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
    protected Drawable getBadgedActivityIcon(ActivityInfo activityInfo, int userId,