summaryrefslogtreecommitdiff
path: root/core/java/android
diff options
context:
space:
mode:
authorAlan Viverette <alanv@google.com>2015-06-01 18:00:05 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2015-06-01 18:00:06 +0000
commit0ee2c1aef93987663968dbfd693cc5eda06c8244 (patch)
tree778685039ec68ec8019e5b85022db46e04717f69 /core/java/android
parent254ed616712866518225dbc156182f39339e76a4 (diff)
parent50ba321fbcecd0b050d755ff5a02eba7ab97bb00 (diff)
Merge "Prevent crash when ColorStateList has unresolved attrs" into mnc-dev
Diffstat (limited to 'core/java/android')
-rw-r--r--core/java/android/content/res/ColorStateList.java14
1 files changed, 8 insertions, 6 deletions
diff --git a/core/java/android/content/res/ColorStateList.java b/core/java/android/content/res/ColorStateList.java
index 14bfac5a74bb..579634f1290a 100644
--- a/core/java/android/content/res/ColorStateList.java
+++ b/core/java/android/content/res/ColorStateList.java
@@ -382,6 +382,14 @@ public class ColorStateList implements Parcelable {
defaultAlphaMod = 1.0f;
}
+ // Extract the theme attributes, if any, before attempting to
+ // read from the typed array. This prevents a crash if we have
+ // unresolved attrs.
+ themeAttrsList[i] = a.extractThemeAttrs(themeAttrsList[i]);
+ if (themeAttrsList[i] != null) {
+ hasUnresolvedAttrs = true;
+ }
+
final int baseColor = a.getColor(
R.styleable.ColorStateListItem_color, mColors[i]);
final float alphaMod = a.getFloat(
@@ -391,12 +399,6 @@ public class ColorStateList implements Parcelable {
// Account for any configuration changes.
mChangingConfigurations |= a.getChangingConfigurations();
- // Extract the theme attributes, if any.
- themeAttrsList[i] = a.extractThemeAttrs(themeAttrsList[i]);
- if (themeAttrsList[i] != null) {
- hasUnresolvedAttrs = true;
- }
-
a.recycle();
}
}