Recreate icon factory to update default scale

Issue: icons are normalized correctly on first creation, but not on subsequent theme change.

This happens because Launcher manually updates the default adaptive icon scale, but SysUI does not.

This change recreates BubbleIconFactory (a stateless class) after theme change, to update the default adaptive icon scale used by IconNormalizer.

Bug: 129158983
Test: atest SystemUITests
Test: manual - icons normalize to same size after theme change
Change-Id: Ibc0b11b10e2585bbec18d4f8a4aa4acec43b5a6a
diff --git a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleStackView.java b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleStackView.java
index abd4229..fca32e1 100644
--- a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleStackView.java
+++ b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleStackView.java
@@ -181,6 +181,7 @@
     private float mVerticalPosPercentBeforeRotation = -1;
 
     private int mBubbleSize;
+    private int mIconBitmapSize;
     private int mBubblePaddingTop;
     private int mExpandedViewPadding;
     private int mExpandedAnimateXDistance;
@@ -357,8 +358,8 @@
         mBubbleContainer.setClipChildren(false);
         addView(mBubbleContainer, new FrameLayout.LayoutParams(MATCH_PARENT, MATCH_PARENT));
 
-        int iconBitmapSize = getResources().getDimensionPixelSize(R.dimen.bubble_icon_bitmap_size);
-        mBubbleIconFactory = new BubbleIconFactory(context, iconBitmapSize);
+        mIconBitmapSize = getResources().getDimensionPixelSize(R.dimen.bubble_icon_bitmap_size);
+        mBubbleIconFactory = new BubbleIconFactory(context, mIconBitmapSize);
 
         mExpandedViewContainer = new FrameLayout(context);
         mExpandedViewContainer.setElevation(elevation);
@@ -477,7 +478,10 @@
      * Handle theme changes.
      */
     public void onThemeChanged() {
+        // Recreate icon factory to update default adaptive icon scale.
+        mBubbleIconFactory = new BubbleIconFactory(mContext, mIconBitmapSize);
         for (Bubble b: mBubbleData.getBubbles()) {
+            b.getIconView().setBubbleIconFactory(mBubbleIconFactory);
             b.getIconView().updateViews();
             b.getExpandedView().applyThemeAttrs();
         }