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

Commit 2fcecf5b authored by Jon Miranda's avatar Jon Miranda
Browse files

Remove shadows from launcher icons.

Test: manual, verify no shadows on icons
Bug: 175329686
Change-Id: Ie56ac0a1d74fa888e7da24b930b7d0c2fff8f86a
parent 999780e7
Loading
Loading
Loading
Loading
+25 −4
Original line number Diff line number Diff line
@@ -199,7 +199,7 @@ public class BaseIconFactory implements AutoCloseable {

    /**
     * Creates bitmap using the source drawable and various parameters.
     * The bitmap is visually normalized with other icons and has enough spacing to add shadow.
     * The bitmap is visually normalized with other icons.
     *
     * @param icon                      source of the icon
     * @param user                      info can be used for a badge
@@ -210,16 +210,37 @@ public class BaseIconFactory implements AutoCloseable {
     */
    public BitmapInfo createBadgedIconBitmap(@NonNull Drawable icon, UserHandle user,
            boolean shrinkNonAdaptiveIcons, boolean isInstantApp, float[] scale) {
        return createBadgedIconBitmap(icon, user, shrinkNonAdaptiveIcons, isInstantApp, scale,
                false /* addShadow */);
    }

    /**
     * Creates bitmap using the source drawable and various parameters.
     * The bitmap is visually normalized with other icons and has enough spacing to add shadow.
     *
     * @param icon                      source of the icon
     * @param user                      info can be used for a badge
     * @param shrinkNonAdaptiveIcons    {@code true} if non adaptive icons should be treated
     * @param isInstantApp              info can be used for a badge
     * @param scale                     returns the scale result from normalization
     * @param addShadow                 If true, adds a shadow under the icon.
     * @return a bitmap suitable for disaplaying as an icon at various system UIs.
     */
    private BitmapInfo createBadgedIconBitmap(@NonNull Drawable icon, UserHandle user,
            boolean shrinkNonAdaptiveIcons, boolean isInstantApp, float[] scale,
            boolean addShadow) {
        if (scale == null) {
            scale = new float[1];
        }
        icon = normalizeAndWrapToAdaptiveIcon(icon, shrinkNonAdaptiveIcons, null, scale);
        Bitmap bitmap = createIconBitmap(icon, scale[0]);
        if (ATLEAST_OREO && icon instanceof AdaptiveIconDrawable) {
            if (addShadow) {
                mCanvas.setBitmap(bitmap);
                getShadowGenerator().recreateIcon(Bitmap.createBitmap(bitmap), mCanvas);
                mCanvas.setBitmap(null);
            }
        }

        if (isInstantApp) {
            badgeWithDrawable(bitmap, mContext.getDrawable(R.drawable.ic_instant_app_badge));
+1 −1
Original line number Diff line number Diff line
@@ -510,7 +510,7 @@ public abstract class BaseIconCache {
     * Cache class to store the actual entries on disk
     */
    public static final class IconDB extends SQLiteCacheHelper {
        private static final int RELEASE_VERSION = 27;
        private static final int RELEASE_VERSION = 28;

        public static final String TABLE_NAME = "icons";
        public static final String COLUMN_ROWID = "rowid";