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

Commit 43f7c8ee authored by Ember Rose's avatar Ember Rose
Browse files

Check resource type, not directory for colors

Previously, Resources#getDrawable() would fail when trying to load a
ColorStateListDrawable from a ColorStateList defined in a resources
directory with a qualifier.

Bug: 137141830
Test: atest android.content.res.cts.ResourcesTest
Change-Id: I2ad57dd7cfa30de64653805d4ea209388ff90f41
parent b1aadaba
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -856,7 +856,8 @@ public class ResourcesImpl {
            stack.push(id);
            try {
                if (file.endsWith(".xml")) {
                    if (file.startsWith("res/color/")) {
                    final String typeName = getResourceTypeName(id);
                    if (typeName != null && typeName.equals("color")) {
                        dr = loadColorOrXmlDrawable(wrapper, value, id, density, file);
                    } else {
                        dr = loadXmlDrawable(wrapper, value, id, density, file);