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

Commit 31d45c8e authored by d34d's avatar d34d Committed by Clark Scheff
Browse files

Themes: Make sure composed icon info is meaningful

We don't want to try and create a composed icon if the parts that
make up a composed icon are not valid or set.

Change-Id: I3d9e7432e4b351de9c0a4e662e028932ee7f08e2
parent 8fe5ff12
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -425,6 +425,12 @@ public class IconPackHelper {
        return mLoadedIconPackResource.getDrawableForDensity(id, density, false);
    }

    public static boolean shouldComposeIcon(ComposedIconInfo iconInfo) {
        return iconInfo != null &&
                (iconInfo.iconBacks != null || iconInfo.iconMask != 0 ||
                        iconInfo.iconUpon != 0 || iconInfo.colorFilter != null);
    }

    public static class IconCustomizer {
        private static final Random sRandom = new Random();
        private static final IThemeService sThemeService;
+5 −4
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
package android.content.res;

import android.app.ComposedIconInfo;
import android.app.IconPackHelper;
import com.android.internal.util.XmlUtils;

import org.xmlpull.v1.XmlPullParser;
@@ -1184,8 +1185,8 @@ public class Resources {
        }
        boolean found = mAssets.getResourceValue(id, 0, outValue, resolveRefs);
        if (found) {
            if (supportComposedIcons && mComposedIconInfo != null && info != null &&
                    info.themedIcon == 0) {
            if (supportComposedIcons && IconPackHelper.shouldComposeIcon(mComposedIconInfo)
                    && info != null && info.themedIcon == 0) {
                Drawable dr = loadDrawable(outValue, id);
                IconCustomizer.getValue(this, id, outValue, dr);
            }
@@ -1222,8 +1223,8 @@ public class Resources {
        }
        boolean found = mAssets.getResourceValue(id, density, outValue, resolveRefs);
        if (found) {
            if (supportComposedIcons && mComposedIconInfo != null && info != null &&
                    info.themedIcon == 0) {
            if (supportComposedIcons && IconPackHelper.shouldComposeIcon(mComposedIconInfo) &&
                    info != null && info.themedIcon == 0) {
                Drawable dr = loadDrawable(outValue, id);
                IconCustomizer.getValue(this, id, outValue, dr);
            }