diff options
author | chihhangchuang <chihhangchuang@google.com> | 2020-05-27 22:44:07 +0800 |
---|---|---|
committer | chihhangchuang <chihhangchuang@google.com> | 2020-05-27 23:03:11 +0800 |
commit | 6cbdde99b71724096b0cfaa52897a7219213dbb7 (patch) | |
tree | 20c525b35657596a22eb894ec583f11f80fd76cb /src/com/android/customization/model/theme | |
parent | 2dfc2b23cc7d5cad7664aa890f4b3e193ffbdb14 (diff) | |
download | ThemePicker-6cbdde99b71724096b0cfaa52897a7219213dbb7.tar.gz |
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
Diffstat (limited to 'src/com/android/customization/model/theme')
-rw-r--r-- | src/com/android/customization/model/theme/ThemeBundle.java | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/com/android/customization/model/theme/ThemeBundle.java b/src/com/android/customization/model/theme/ThemeBundle.java index 8f15e6d3..f319c877 100644 --- a/src/com/android/customization/model/theme/ThemeBundle.java +++ b/src/com/android/customization/model/theme/ThemeBundle.java @@ -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() { |