From 766b9b255bd9db10f22ddf81c8168085224c7e59 Mon Sep 17 00:00:00 2001 From: Jiaquan He Date: Fri, 17 Feb 2017 16:44:59 -0800 Subject: [PATCH] Fix ColorStateList bug. A ColorStateList should be stateful when it has at least one non-wildcard state. Test: Manually Bug: 35487255 Change-Id: Id94b6a8d172e22a522f73fcb378e342656f95e39 --- core/java/android/content/res/ColorStateList.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/core/java/android/content/res/ColorStateList.java b/core/java/android/content/res/ColorStateList.java index 273522a94af3f..a46db06ebdc07 100644 --- a/core/java/android/content/res/ColorStateList.java +++ b/core/java/android/content/res/ColorStateList.java @@ -508,8 +508,8 @@ public class ColorStateList extends ComplexColor implements Parcelable { } /** - * Indicates whether this color state list contains more than one state spec - * and will change color based on state. + * Indicates whether this color state list contains at least one state spec + * and the first spec is not empty (e.g. match-all). * * @return True if this color state list changes color based on state, false * otherwise. @@ -517,7 +517,7 @@ public class ColorStateList extends ComplexColor implements Parcelable { */ @Override public boolean isStateful() { - return mStateSpecs.length > 1; + return mStateSpecs.length >= 1 && mStateSpecs[0].length > 0; } /**