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

Commit c8e8d45d authored by Sunny Goyal's avatar Sunny Goyal
Browse files

Always have the current iconShape in BaseIconFactory irrespective of full-bleed setting.

Fixing BitmapInfo to not assume fullbleed shape
IconShape.EMPTY will be used for icons created outside of BaseIconFactory

Bug: 427109551
Flag: EXEMPT bugfix
Test: Verified manually on device
Change-Id: I7b1aa7c7678e5e954706971bed59715b0f83a2cf
parent a9babccb
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
@@ -174,7 +174,11 @@ public class BaseIconFactory implements AutoCloseable {
                new ColorDrawable(PLACEHOLDER_BACKGROUND_COLOR),
                new CenterTextDrawable(placeholder, color));
        Bitmap icon = createIconBitmap(drawable, ICON_VISIBLE_AREA_FACTOR);
        return BitmapInfo.of(icon, color, getDefaultIconShape());
        BitmapInfo info = BitmapInfo.of(icon, color, getDefaultIconShape());
        if (mDrawFullBleedIcons) {
            info = info.withFlags(FlagOp.NO_OP.addFlag(FLAG_FULL_BLEED));
        }
        return info;
    }

    public BitmapInfo createIconBitmap(Bitmap icon) {
@@ -262,7 +266,6 @@ public class BaseIconFactory implements AutoCloseable {
     * Generates an IconShape based on the current bitmap size and default icon mask.
     */
    public IconShape getDefaultIconShape() {
        if (!mDrawFullBleedIcons) return IconShape.EMPTY;
        if (mDefaultIconShape != null) return mDefaultIconShape;
        AdaptiveIconDrawable tempAdaptiveIcon =
                new AdaptiveIconDrawable(new ColorDrawable(BLACK), null);
+2 −7
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@ import android.graphics.drawable.Drawable
import androidx.annotation.ColorRes
import androidx.annotation.DrawableRes
import androidx.annotation.IntDef
import com.android.launcher3.icons.BitmapInfo.Companion.FLAG_THEMED
import com.android.launcher3.icons.FastBitmapDrawableDelegate.DelegateFactory
import com.android.launcher3.icons.FastBitmapDrawableDelegate.SimpleDelegateFactory
import com.android.launcher3.icons.PlaceHolderDrawableDelegate.PlaceHolderDelegateFactory
@@ -246,13 +247,7 @@ data class BitmapInfo(

        @JvmStatic
        fun of(bitmap: Bitmap, color: Int, defaultShape: IconShape = IconShape.EMPTY): BitmapInfo {
            val flags = if (defaultShape == IconShape.EMPTY) 0 else FLAG_FULL_BLEED
            return BitmapInfo(
                icon = bitmap,
                color = color,
                defaultIconShape = defaultShape,
                flags = flags,
            )
            return BitmapInfo(icon = bitmap, color = color, defaultIconShape = defaultShape)
        }
    }
}