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

Commit db704c86 authored by Mady Mellor's avatar Mady Mellor Committed by Android (Google) Code Review
Browse files

Merge "Update Bubbles for BubbleIconFactory refactor" into udc-dev

parents 9a22d1b4 da8ade43
Loading
Loading
Loading
Loading
+0 −4
Original line number Diff line number Diff line
@@ -47,7 +47,6 @@ import android.util.Log;

import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.logging.InstanceId;
import com.android.launcher3.icons.BubbleBadgeIconFactory;
import com.android.launcher3.icons.BubbleIconFactory;
import com.android.wm.shell.bubbles.bar.BubbleBarExpandedView;
import com.android.wm.shell.bubbles.bar.BubbleBarLayerView;
@@ -436,7 +435,6 @@ public class Bubble implements BubbleViewProvider {
     * @param stackView the view the bubble is added to, iff showing as floating.
     * @param layerView the layer the bubble is added to, iff showing in the bubble bar.
     * @param iconFactory the icon factory use to create images for the bubble.
     * @param badgeIconFactory the icon factory to create app badges for the bubble.
     */
    void inflate(BubbleViewInfoTask.Callback callback,
            Context context,
@@ -444,7 +442,6 @@ public class Bubble implements BubbleViewProvider {
            @Nullable BubbleStackView stackView,
            @Nullable BubbleBarLayerView layerView,
            BubbleIconFactory iconFactory,
            BubbleBadgeIconFactory badgeIconFactory,
            boolean skipInflation) {
        if (isBubbleLoading()) {
            mInflationTask.cancel(true /* mayInterruptIfRunning */);
@@ -455,7 +452,6 @@ public class Bubble implements BubbleViewProvider {
                stackView,
                layerView,
                iconFactory,
                badgeIconFactory,
                skipInflation,
                callback,
                mMainExecutor);
+8 −12
Original line number Diff line number Diff line
@@ -89,7 +89,6 @@ import androidx.annotation.Nullable;

import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.statusbar.IStatusBarService;
import com.android.launcher3.icons.BubbleBadgeIconFactory;
import com.android.launcher3.icons.BubbleIconFactory;
import com.android.wm.shell.R;
import com.android.wm.shell.ShellTaskOrganizer;
@@ -209,7 +208,6 @@ public class BubbleController implements ConfigurationChangeListener,
    @Nullable private BubbleStackView mStackView;
    @Nullable private BubbleBarLayerView mLayerView;
    private BubbleIconFactory mBubbleIconFactory;
    private BubbleBadgeIconFactory mBubbleBadgeIconFactory;
    private BubblePositioner mBubblePositioner;
    private Bubbles.SysuiProxy mSysuiProxy;

@@ -321,8 +319,7 @@ public class BubbleController implements ConfigurationChangeListener,
        mBubbleData = data;
        mSavedUserBubbleData = new SparseArray<>();
        mBubbleIconFactory = new BubbleIconFactory(context,
                context.getResources().getDimensionPixelSize(R.dimen.bubble_size));
        mBubbleBadgeIconFactory = new BubbleBadgeIconFactory(context,
                context.getResources().getDimensionPixelSize(R.dimen.bubble_size),
                context.getResources().getDimensionPixelSize(R.dimen.bubble_badge_size),
                context.getResources().getColor(R.color.important_conversation),
                context.getResources().getDimensionPixelSize(
@@ -700,6 +697,10 @@ public class BubbleController implements ConfigurationChangeListener,
        return mBubblePositioner;
    }

    BubbleIconFactory getIconFactory() {
        return mBubbleIconFactory;
    }

    public Bubbles.SysuiProxy getSysuiProxy() {
        return mSysuiProxy;
    }
@@ -936,8 +937,7 @@ public class BubbleController implements ConfigurationChangeListener,
            mStackView.onThemeChanged();
        }
        mBubbleIconFactory = new BubbleIconFactory(mContext,
                mContext.getResources().getDimensionPixelSize(R.dimen.bubble_size));
        mBubbleBadgeIconFactory = new BubbleBadgeIconFactory(mContext,
                mContext.getResources().getDimensionPixelSize(R.dimen.bubble_size),
                mContext.getResources().getDimensionPixelSize(R.dimen.bubble_badge_size),
                mContext.getResources().getColor(R.color.important_conversation),
                mContext.getResources().getDimensionPixelSize(
@@ -951,7 +951,6 @@ public class BubbleController implements ConfigurationChangeListener,
                    mStackView,
                    mLayerView,
                    mBubbleIconFactory,
                    mBubbleBadgeIconFactory,
                    false /* skipInflation */);
        }
        for (Bubble b : mBubbleData.getOverflowBubbles()) {
@@ -961,7 +960,6 @@ public class BubbleController implements ConfigurationChangeListener,
                    mStackView,
                    mLayerView,
                    mBubbleIconFactory,
                    mBubbleBadgeIconFactory,
                    false /* skipInflation */);
        }
    }
@@ -978,8 +976,7 @@ public class BubbleController implements ConfigurationChangeListener,
                mScreenBounds.set(newConfig.windowConfiguration.getBounds());
                mBubbleData.onMaxBubblesChanged();
                mBubbleIconFactory = new BubbleIconFactory(mContext,
                        mContext.getResources().getDimensionPixelSize(R.dimen.bubble_size));
                mBubbleBadgeIconFactory = new BubbleBadgeIconFactory(mContext,
                        mContext.getResources().getDimensionPixelSize(R.dimen.bubble_size),
                        mContext.getResources().getDimensionPixelSize(R.dimen.bubble_badge_size),
                        mContext.getResources().getColor(R.color.important_conversation),
                        mContext.getResources().getDimensionPixelSize(
@@ -1275,7 +1272,6 @@ public class BubbleController implements ConfigurationChangeListener,
                        mStackView,
                        mLayerView,
                        mBubbleIconFactory,
                        mBubbleBadgeIconFactory,
                        true /* skipInflation */);
            });
            return null;
@@ -1351,7 +1347,7 @@ public class BubbleController implements ConfigurationChangeListener,
        bubble.setInflateSynchronously(mInflateSynchronously);
        bubble.inflate(b -> mBubbleData.notificationEntryUpdated(b, suppressFlyout, showInShade),
                mContext, this, mStackView,  mLayerView,
                mBubbleIconFactory, mBubbleBadgeIconFactory,
                mBubbleIconFactory,
                false /* skipInflation */);
    }

+1 −0
Original line number Diff line number Diff line
@@ -38,6 +38,7 @@ import androidx.annotation.Nullable;

import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.util.FrameworkStatsLog;
import com.android.launcher3.icons.BubbleIconFactory;
import com.android.wm.shell.R;
import com.android.wm.shell.bubbles.Bubbles.DismissReason;
import com.android.wm.shell.common.bubbles.BubbleBarUpdate;
+5 −1
Original line number Diff line number Diff line
@@ -95,7 +95,11 @@ class BubbleOverflow(
        overflowBtn?.iconDrawable?.setTint(shapeColor)

        val iconFactory = BubbleIconFactory(context,
                context.getResources().getDimensionPixelSize(R.dimen.bubble_size))
                context.getResources().getDimensionPixelSize(R.dimen.bubble_size),
                context.getResources().getDimensionPixelSize(R.dimen.bubble_badge_size),
                context.getResources().getColor(R.color.important_conversation),
                context.getResources().getDimensionPixelSize(
                        com.android.internal.R.dimen.importance_ring_stroke_width))

        // Update bitmap
        val fg = InsetDrawable(overflowBtn?.iconDrawable, overflowIconInset)
+8 −13
Original line number Diff line number Diff line
@@ -42,7 +42,6 @@ import android.view.LayoutInflater;
import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.graphics.ColorUtils;
import com.android.launcher3.icons.BitmapInfo;
import com.android.launcher3.icons.BubbleBadgeIconFactory;
import com.android.launcher3.icons.BubbleIconFactory;
import com.android.wm.shell.R;
import com.android.wm.shell.bubbles.bar.BubbleBarExpandedView;
@@ -75,7 +74,6 @@ public class BubbleViewInfoTask extends AsyncTask<Void, Void, BubbleViewInfoTask
    private WeakReference<BubbleStackView> mStackView;
    private WeakReference<BubbleBarLayerView> mLayerView;
    private BubbleIconFactory mIconFactory;
    private BubbleBadgeIconFactory mBadgeIconFactory;
    private boolean mSkipInflation;
    private Callback mCallback;
    private Executor mMainExecutor;
@@ -90,7 +88,6 @@ public class BubbleViewInfoTask extends AsyncTask<Void, Void, BubbleViewInfoTask
            @Nullable BubbleStackView stackView,
            @Nullable BubbleBarLayerView layerView,
            BubbleIconFactory factory,
            BubbleBadgeIconFactory badgeFactory,
            boolean skipInflation,
            Callback c,
            Executor mainExecutor) {
@@ -100,7 +97,6 @@ public class BubbleViewInfoTask extends AsyncTask<Void, Void, BubbleViewInfoTask
        mStackView = new WeakReference<>(stackView);
        mLayerView = new WeakReference<>(layerView);
        mIconFactory = factory;
        mBadgeIconFactory = badgeFactory;
        mSkipInflation = skipInflation;
        mCallback = c;
        mMainExecutor = mainExecutor;
@@ -110,10 +106,10 @@ public class BubbleViewInfoTask extends AsyncTask<Void, Void, BubbleViewInfoTask
    protected BubbleViewInfo doInBackground(Void... voids) {
        if (mController.get().isShowingAsBubbleBar()) {
            return BubbleViewInfo.populateForBubbleBar(mContext.get(), mController.get(),
                    mLayerView.get(), mBadgeIconFactory, mBubble, mSkipInflation);
                    mLayerView.get(), mIconFactory, mBubble, mSkipInflation);
        } else {
            return BubbleViewInfo.populate(mContext.get(), mController.get(), mStackView.get(),
                    mIconFactory, mBadgeIconFactory, mBubble, mSkipInflation);
                    mIconFactory, mBubble, mSkipInflation);
        }
    }

@@ -156,7 +152,7 @@ public class BubbleViewInfoTask extends AsyncTask<Void, Void, BubbleViewInfoTask

        @Nullable
        public static BubbleViewInfo populateForBubbleBar(Context c, BubbleController controller,
                BubbleBarLayerView layerView, BubbleBadgeIconFactory badgeIconFactory, Bubble b,
                BubbleBarLayerView layerView, BubbleIconFactory iconFactory, Bubble b,
                boolean skipInflation) {
            BubbleViewInfo info = new BubbleViewInfo();

@@ -195,7 +191,7 @@ public class BubbleViewInfoTask extends AsyncTask<Void, Void, BubbleViewInfoTask
                return null;
            }

            info.rawBadgeBitmap = badgeIconFactory.getBadgeBitmap(badgedIcon, false).icon;
            info.rawBadgeBitmap = iconFactory.getBadgeBitmap(badgedIcon, false).icon;

            return info;
        }
@@ -203,8 +199,7 @@ public class BubbleViewInfoTask extends AsyncTask<Void, Void, BubbleViewInfoTask
        @VisibleForTesting
        @Nullable
        public static BubbleViewInfo populate(Context c, BubbleController controller,
                BubbleStackView stackView, BubbleIconFactory iconFactory,
                BubbleBadgeIconFactory badgeIconFactory, Bubble b,
                BubbleStackView stackView, BubbleIconFactory iconFactory, Bubble b,
                boolean skipInflation) {
            BubbleViewInfo info = new BubbleViewInfo();

@@ -256,16 +251,16 @@ public class BubbleViewInfoTask extends AsyncTask<Void, Void, BubbleViewInfoTask
                bubbleDrawable = appIcon;
            }

            BitmapInfo badgeBitmapInfo = badgeIconFactory.getBadgeBitmap(badgedIcon,
            BitmapInfo badgeBitmapInfo = iconFactory.getBadgeBitmap(badgedIcon,
                    b.isImportantConversation());
            info.badgeBitmap = badgeBitmapInfo.icon;
            // Raw badge bitmap never includes the important conversation ring
            info.rawBadgeBitmap = b.isImportantConversation()
                    ? badgeIconFactory.getBadgeBitmap(badgedIcon, false).icon
                    ? iconFactory.getBadgeBitmap(badgedIcon, false).icon
                    : badgeBitmapInfo.icon;

            float[] bubbleBitmapScale = new float[1];
            info.bubbleBitmap = iconFactory.createIconBitmap(bubbleDrawable, bubbleBitmapScale);
            info.bubbleBitmap = iconFactory.getBubbleBitmap(bubbleDrawable, bubbleBitmapScale);

            // Dot color & placement
            Path iconPath = PathParser.createPathFromPathData(
Loading