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

Commit 0d152a5b authored by Sunny Goyal's avatar Sunny Goyal Committed by Android (Google) Code Review
Browse files

Merge "Revert "Revert "Removing unnecessary iconFactory class when gene..."" into main

parents 42476cc3 3de59f24
Loading
Loading
Loading
Loading
+6 −11
Original line number Diff line number Diff line
@@ -31,7 +31,6 @@ import android.graphics.drawable.Drawable;
import android.os.UserHandle;
import android.text.TextUtils;
import android.util.SparseArray;
import android.view.accessibility.AccessibilityManager;

import androidx.annotation.WorkerThread;

@@ -45,6 +44,7 @@ import com.android.launcher3.pm.UserCache;
import com.android.launcher3.util.DisplayController;
import com.android.launcher3.util.DisplayController.DisplayInfoChangeListener;
import com.android.launcher3.util.DisplayController.Info;
import com.android.launcher3.util.FlagOp;
import com.android.launcher3.util.Preconditions;
import com.android.quickstep.util.CancellableTask;
import com.android.quickstep.util.TaskKeyLruCache;
@@ -62,7 +62,6 @@ import java.util.function.Consumer;
public class TaskIconCache implements DisplayInfoChangeListener {

    private final Executor mBgExecutor;
    private final AccessibilityManager mAccessibilityManager;

    private final Context mContext;
    private final TaskKeyLruCache<TaskCacheEntry> mIconCache;
@@ -79,7 +78,6 @@ public class TaskIconCache implements DisplayInfoChangeListener {
    public TaskIconCache(Context context, Executor bgExecutor, IconProvider iconProvider) {
        mContext = context;
        mBgExecutor = bgExecutor;
        mAccessibilityManager = context.getSystemService(AccessibilityManager.class);
        mIconProvider = iconProvider;

        Resources res = context.getResources();
@@ -238,17 +236,14 @@ public class TaskIconCache implements DisplayInfoChangeListener {
            if ((index = mDefaultIcons.indexOfKey(userId)) >= 0) {
                return mDefaultIcons.valueAt(index).newIcon(mContext);
            } else {
                try (BaseIconFactory li = getIconFactory()) {
                BitmapInfo info = mDefaultIconBase.withFlags(
                            li.getBitmapFlagOp(new IconOptions()
                                    .setUser(UserCache.INSTANCE.get(mContext)
                                            .getUserInfo(UserHandle.of(userId)))));
                        UserCache.INSTANCE.get(mContext).getUserInfo(UserHandle.of(userId))
                                .applyBitmapInfoFlags(FlagOp.NO_OP));
                mDefaultIcons.put(userId, info);
                return info.newIcon(mContext);
            }
        }
    }
    }

    @WorkerThread
    private BitmapInfo getBitmapInfo(Drawable drawable, int userId,
+6 −7
Original line number Diff line number Diff line
@@ -79,7 +79,6 @@ import androidx.core.graphics.ColorUtils;

import com.android.launcher3.dragndrop.FolderAdaptiveIcon;
import com.android.launcher3.graphics.TintedDrawableSpan;
import com.android.launcher3.icons.BaseIconFactory;
import com.android.launcher3.icons.BitmapInfo;
import com.android.launcher3.icons.LauncherIcons;
import com.android.launcher3.icons.ShortcutCachingLogic;
@@ -91,6 +90,7 @@ import com.android.launcher3.pm.UserCache;
import com.android.launcher3.shortcuts.ShortcutKey;
import com.android.launcher3.shortcuts.ShortcutRequest;
import com.android.launcher3.testing.shared.ResourceUtils;
import com.android.launcher3.util.FlagOp;
import com.android.launcher3.util.IntArray;
import com.android.launcher3.util.SplitConfigurationOptions.SplitPositionOption;
import com.android.launcher3.util.Themes;
@@ -676,12 +676,11 @@ public final class Utilities {
        }

        if (badge == null) {
            try (LauncherIcons li = LauncherIcons.obtain(context)) {
            badge = BitmapInfo.LOW_RES_INFO.withFlags(
                                li.getBitmapFlagOp(new BaseIconFactory.IconOptions().setUser(
                                        UserCache.INSTANCE.get(context).getUserInfo(info.user))))
                            UserCache.INSTANCE.get(context)
                                    .getUserInfo(info.user)
                                    .applyBitmapInfoFlags(FlagOp.NO_OP))
                    .getBadgeDrawable(context, useTheme);
            }
            if (badge == null) {
                badge = new ColorDrawable(Color.TRANSPARENT);
            }