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

Commit a2c5e126 authored by Android Build Coastguard Worker's avatar Android Build Coastguard Worker
Browse files

Snap for 8414339 from f7f4a777 to tm-qpr1-release

Change-Id: Iaa8dee1cf799be7a810347a84c53586f6b3e09c5
parents 8be16ca8 f7f4a777
Loading
Loading
Loading
Loading
+17 −4
Original line number Diff line number Diff line
@@ -59,6 +59,7 @@ public class ClockDrawableWrapper extends AdaptiveIconDrawable implements Bitmap
    private static final String TAG = "ClockDrawableWrapper";

    private static final boolean DISABLE_SECONDS = true;
    private static final int NO_COLOR = -1;

    // Time after which the clock icon should check for an update. The actual invalidate
    // will only happen in case of any change.
@@ -322,16 +323,19 @@ public class ClockDrawableWrapper extends AdaptiveIconDrawable implements Bitmap
                @DrawableCreationFlags  int creationFlags) {
            AnimationInfo info;
            Bitmap bg;
            int themedFgColor;
            ColorFilter bgFilter;
            if ((creationFlags & FLAG_THEMED) != 0 && themeData != null) {
                int[] colors = ThemedIconDrawable.getColors(context);
                Drawable tintedDrawable = themeData.baseDrawableState.newDrawable().mutate();
                themedFgColor = colors[1];
                tintedDrawable.setTint(colors[1]);
                info = themeData.copyForIcon(tintedDrawable);
                bg = themeBackground;
                bgFilter = new BlendModeColorFilter(colors[0], BlendMode.SRC_IN);
            } else {
                info = animInfo;
                themedFgColor = NO_COLOR;
                bg = mFlattenedBackground;
                bgFilter = null;
            }
@@ -339,7 +343,7 @@ public class ClockDrawableWrapper extends AdaptiveIconDrawable implements Bitmap
                return super.newIcon(context, creationFlags);
            }
            ClockIconDrawable.ClockConstantState cs = new ClockIconDrawable.ClockConstantState(
                    icon, color, boundsOffset, info, bg, bgFilter);
                    icon, color, themedFgColor, boundsOffset, info, bg, bgFilter);
            FastBitmapDrawable d = cs.newDrawable();
            applyFlags(context, d, creationFlags);
            return d;
@@ -366,6 +370,7 @@ public class ClockDrawableWrapper extends AdaptiveIconDrawable implements Bitmap

        private final Bitmap mBG;
        private final Paint mBgPaint = new Paint(Paint.FILTER_BITMAP_FLAG | Paint.ANTI_ALIAS_FLAG);
        private final int mThemedFgColor;

        private final AdaptiveIconDrawable mFullDrawable;
        private final LayerDrawable mFG;
@@ -378,6 +383,7 @@ public class ClockDrawableWrapper extends AdaptiveIconDrawable implements Bitmap

            mBG = cs.mBG;
            mBgPaint.setColorFilter(cs.mBgFilter);
            mThemedFgColor = cs.mThemedFgColor;

            mFullDrawable = (AdaptiveIconDrawable) mAnimInfo.baseDrawableState.newDrawable();
            mFG = (LayerDrawable) mFullDrawable.getForeground();
@@ -424,6 +430,11 @@ public class ClockDrawableWrapper extends AdaptiveIconDrawable implements Bitmap
            mFullDrawable.setColorFilter(mPaint.getColorFilter());
        }

        @Override
        public int getIconColor() {
            return isThemed() ? mThemedFgColor : super.getIconColor();
        }

        @Override
        public void run() {
            if (mAnimInfo.applyTime(mTime, mFG)) {
@@ -457,8 +468,8 @@ public class ClockDrawableWrapper extends AdaptiveIconDrawable implements Bitmap

        @Override
        public FastBitmapConstantState newConstantState() {
            return new ClockConstantState(mBitmap, mIconColor, mBoundsOffset, mAnimInfo, mBG,
                    mBgPaint.getColorFilter());
            return new ClockConstantState(mBitmap, mIconColor, mThemedFgColor, mBoundsOffset,
                    mAnimInfo, mBG, mBgPaint.getColorFilter());
        }

        private static class ClockConstantState extends FastBitmapConstantState {
@@ -467,14 +478,16 @@ public class ClockDrawableWrapper extends AdaptiveIconDrawable implements Bitmap
            private final AnimationInfo mAnimInfo;
            private final Bitmap mBG;
            private final ColorFilter mBgFilter;
            private final int mThemedFgColor;

            ClockConstantState(Bitmap bitmap, int color,
            ClockConstantState(Bitmap bitmap, int color, int themedFgColor,
                    float boundsOffset, AnimationInfo animInfo, Bitmap bg, ColorFilter bgFilter) {
                super(bitmap, color);
                mBoundsOffset = boundsOffset;
                mAnimInfo = animInfo;
                mBG = bg;
                mBgFilter = bgFilter;
                mThemedFgColor = themedFgColor;
            }

            @Override
+6 −2
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
package com.android.launcher3.icons;

import static com.android.launcher3.icons.BaseIconFactory.getBadgeSizeForIconSize;
import static com.android.launcher3.icons.GraphicsUtils.setColorAlphaBound;

import android.animation.ObjectAnimator;
import android.graphics.Bitmap;
@@ -35,6 +36,7 @@ import android.view.animation.DecelerateInterpolator;
import android.view.animation.Interpolator;

import androidx.annotation.Nullable;
import androidx.core.graphics.ColorUtils;

public class FastBitmapDrawable extends Drawable implements Drawable.Callback {

@@ -42,6 +44,7 @@ public class FastBitmapDrawable extends Drawable implements Drawable.Callback {
    private static final Interpolator DEACCEL = new DecelerateInterpolator();

    private static final float PRESSED_SCALE = 1.1f;
    public static final int WHITE_SCRIM_ALPHA = 138;

    private static final float DISABLED_DESATURATION = 1f;
    private static final float DISABLED_BRIGHTNESS = 0.5f;
@@ -128,10 +131,11 @@ public class FastBitmapDrawable extends Drawable implements Drawable.Callback {
    }

    /**
     * Returns the primary icon color
     * Returns the primary icon color, slightly tinted white
     */
    public int getIconColor() {
        return mIconColor;
        int whiteScrim = setColorAlphaBound(Color.WHITE, WHITE_SCRIM_ALPHA);
        return ColorUtils.compositeColors(whiteScrim, mIconColor);
    }

    /**
+9 −0
Original line number Diff line number Diff line
@@ -74,6 +74,10 @@ public class ThemedIconDrawable extends FastBitmapDrawable {
        return new ThemedConstantState(bitmapInfo, colorBg, colorFg);
    }

    public void changeBackgroundColor(int colorBg){
        mBgPaint.setColorFilter(new BlendModeColorFilter(colorBg, BlendMode.SRC_IN));
    }

    static class ThemedConstantState extends FastBitmapConstantState {

        final BitmapInfo bitmapInfo;
@@ -112,4 +116,9 @@ public class ThemedIconDrawable extends FastBitmapDrawable {
        }
        return colors;
    }

    @Override
    public int getIconColor() {
        return colorFg;
    }
}
+5 −0
Original line number Diff line number Diff line
@@ -594,6 +594,11 @@ public abstract class BaseIconCache {
                Bitmap monoBitmap = Bitmap.createBitmap(
                        icon.getWidth(), icon.getHeight(), Config.ALPHA_8);
                monoBitmap.copyPixelsFromBuffer(ByteBuffer.wrap(data));
                Bitmap hwMonoBitmap = monoBitmap.copy(Config.HARDWARE, false /*isMutable*/);
                if (hwMonoBitmap != null) {
                    monoBitmap.recycle();
                    monoBitmap = hwMonoBitmap;
                }
                try (BaseIconFactory factory = getIconFactory()) {
                    entry.bitmap.setMonoIcon(monoBitmap, factory);
                }
+1 −0
Original line number Diff line number Diff line
@@ -46,4 +46,5 @@ public class ResultType {
    public static final int PEOPLE_TILE = 1 << 14;
    public static final int LEGACY_SHORTCUT = 1 << 15;
    public static final int MEMORY = 1 << 16;
    public static final int WEB_SUGGEST = 1 << 17;
}