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

Commit 2fe75877 authored by Charlie Anderson's avatar Charlie Anderson
Browse files

Reuse same default IconShape in BaseIconFactory

Bug: 426259519
Bug: 421883017
Test: presubmit
Flag: com.android.launcher3.enable_launcher_icon_shapes
Change-Id: I4412325e346ac497225e6b279c6dbbea7b4fe25e
parent 77e70997
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -98,6 +98,9 @@ public class BaseIconFactory implements AutoCloseable {

    /** Shadow bitmap used as background for theme icons */
    private Bitmap mWhiteShadowLayer;
    /** Default IconShape for when custom shape is not needed */
    private IconShape mDefaultIconShape;

    /** Bitmap used for {@link BitmapShader} to mask Adaptive Icons when drawing */
    private Bitmap mShaderBitmap;

@@ -259,11 +262,13 @@ public class BaseIconFactory implements AutoCloseable {
     */
    public IconShape getDefaultIconShape() {
        if (!mDrawFullBleedIcons) return IconShape.EMPTY;
        if (mDefaultIconShape != null) return mDefaultIconShape;
        AdaptiveIconDrawable tempAdaptiveIcon =
                new AdaptiveIconDrawable(new ColorDrawable(BLACK), null);
        tempAdaptiveIcon.setBounds(0, 0, mIconBitmapSize, mIconBitmapSize);
        return new IconShape(mIconBitmapSize, tempAdaptiveIcon.getIconMask(),
        mDefaultIconShape = new IconShape(mIconBitmapSize, tempAdaptiveIcon.getIconMask(),
                getWhiteShadowLayer());
        return mDefaultIconShape;
    }

    @NonNull