Fix shape icon and name mismatch problem

Updated the analysis to b/157535141.
Root cause: the gms app updated to use a BitmapDrawable icon which was filtered out to in the shape app list, but its name was still in the name list.
Fix: let's also filter out the app name from list

Test: Manually
Fixes: 157535141
Change-Id: I76ee3fb91d153cd6d1ded19496d1fabd6a1d73ba
diff --git a/src/com/android/customization/model/theme/ThemeBundle.java b/src/com/android/customization/model/theme/ThemeBundle.java
index 8f15e6d..f319c87 100644
--- a/src/com/android/customization/model/theme/ThemeBundle.java
+++ b/src/com/android/customization/model/theme/ThemeBundle.java
@@ -303,6 +303,7 @@
         public PreviewInfo createPreviewInfo(Context context) {
             ShapeDrawable shapeDrawable = null;
             List<Drawable> shapeIcons = new ArrayList<>();
+            List<String> shapeIconNames = new ArrayList<>();
             Path path = mShapePath;
             if (!TextUtils.isEmpty(mPathString)) {
                 path = PathParser.createPathFromPathData(mPathString);
@@ -312,13 +313,17 @@
                 shapeDrawable = new ShapeDrawable(shape);
                 shapeDrawable.setIntrinsicHeight((int) PATH_SIZE);
                 shapeDrawable.setIntrinsicWidth((int) PATH_SIZE);
-                for (Drawable icon : mAppIcons) {
+                for (int i = 0; i < mAppIcons.size(); i++) {
+                    Drawable icon = mAppIcons.get(i);
+                    String name = mAppIconNames.get(i);
                     if (icon instanceof AdaptiveIconDrawable) {
                         AdaptiveIconDrawable adaptiveIcon = (AdaptiveIconDrawable) icon;
                         shapeIcons.add(new DynamicAdaptiveIconDrawable(adaptiveIcon.getBackground(),
                                 adaptiveIcon.getForeground(), path));
+                        shapeIconNames.add(name);
                     } else if (icon instanceof DynamicAdaptiveIconDrawable) {
                         shapeIcons.add(icon);
+                        shapeIconNames.add(name);
                     }
                     // TODO: add iconloader library's legacy treatment helper methods for
                     //  non-adaptive icons
@@ -326,7 +331,7 @@
             }
             return new PreviewInfo(context, mBodyFontFamily, mHeadlineFontFamily, mColorAccentLight,
                     mColorAccentDark, mIcons, shapeDrawable, mCornerRadius, shapeIcons,
-                    mAppIconNames);
+                    shapeIconNames);
         }
 
         public Map<String, String> getPackages() {