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

Commit 6cbdde99 authored by chihhangchuang's avatar chihhangchuang
Browse files

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
parent 2dfc2b23
Loading
Loading
Loading
Loading
+7 −2
Original line number Diff line number Diff line
@@ -303,6 +303,7 @@ public class ThemeBundle implements CustomizationOption<ThemeBundle> {
        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 @@ public class ThemeBundle implements CustomizationOption<ThemeBundle> {
                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 @@ public class ThemeBundle implements CustomizationOption<ThemeBundle> {
            }
            return new PreviewInfo(context, mBodyFontFamily, mHeadlineFontFamily, mColorAccentLight,
                    mColorAccentDark, mIcons, shapeDrawable, mCornerRadius, shapeIcons,
                    mAppIconNames);
                    shapeIconNames);
        }

        public Map<String, String> getPackages() {