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

Commit 533ed173 authored by Liana Kazanova (xWF)'s avatar Liana Kazanova (xWF) Committed by Android (Google) Code Review
Browse files

Revert "Do not cache default app icons when returned from PackageManager"

This reverts commit 9171f26e.

Reason for revert: DroidMonitor: Potential culprit for http://b/369222239 - verifying through ABTD before revert submission. This is part of the standard investigation process, and does not mean your CL will be reverted.

Change-Id: Ibcd110e68322272c16e087e08f2aefeee84752bb
parent 9171f26e
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -208,7 +208,7 @@ public class BaseIconFactory implements AutoCloseable {
     * The bitmap is visually normalized with other icons and has enough spacing to add shadow.
     *
     * @param icon source of the icon
     * @return a bitmap suitable for displaying as an icon at various system UIs.
     * @return a bitmap suitable for disaplaying as an icon at various system UIs.
     */
    @TargetApi(Build.VERSION_CODES.TIRAMISU)
    @NonNull
+1 −3
Original line number Diff line number Diff line
@@ -367,9 +367,7 @@ public abstract class BaseIconCache {
        // Icon can't be loaded from cachingLogic, which implies alternative icon was loaded
        // (e.g. fallback icon, default icon). So we drop here since there's no point in caching
        // an empty entry.
        if (entry.bitmap.isNullOrLowRes() || isDefaultIcon(entry.bitmap, user)) {
            return;
        }
        if (entry.bitmap.isNullOrLowRes()) return;

        CharSequence entryTitle = cachingLogic.getLabel(object);
        if (TextUtils.isEmpty(entryTitle)) {
+4 −17
Original line number Diff line number Diff line
@@ -21,13 +21,11 @@ import android.content.Context
import android.content.pm.LauncherActivityInfo
import android.os.Build.VERSION
import android.os.UserHandle
import android.util.Log
import com.android.launcher3.Flags.useNewIconForArchivedApps
import com.android.launcher3.icons.BaseIconFactory.IconOptions
import com.android.launcher3.icons.BitmapInfo

object LauncherActivityCachingLogic : CachingLogic<LauncherActivityInfo> {
    const val TAG = "LauncherActivityCachingLogic"

    override fun getComponent(info: LauncherActivityInfo): ComponentName = info.componentName

@@ -47,21 +45,10 @@ object LauncherActivityCachingLogic : CachingLogic<LauncherActivityInfo> {
            iconOptions.setIsArchived(
                useNewIconForArchivedApps() && VERSION.SDK_INT >= 35 && info.activityInfo.isArchived
            )
            val iconDrawable = cache.iconProvider.getIcon(info, li.fullResIconDpi)
            if (
                VERSION.SDK_INT >= 30 &&
                    context.packageManager.isDefaultApplicationIcon(iconDrawable)
            ) {
                Log.w(
                    TAG,
                    "loadIcon: Default app icon returned from PackageManager." +
                        " component=${info.componentName}, user=${info.user}",
                    Exception(),
            return li.createBadgedIconBitmap(
                cache.iconProvider.getIcon(info, li.fullResIconDpi),
                iconOptions,
            )
                // Make sure this default icon always matches BaseIconCache#getDefaultIcon
                return cache.getDefaultIcon(info.user)
            }
            return li.createBadgedIconBitmap(iconDrawable, iconOptions)
        }
    }
}