summaryrefslogtreecommitdiffstats
path: root/core/java/android/content
diff options
context:
space:
mode:
authorAlan Viverette <alanv@google.com>2014-10-30 10:29:03 -0700
committerAlan Viverette <alanv@google.com>2014-10-30 10:29:03 -0700
commit7f4a63d1ebc13c6499a48331ecb78c4d27446dbc (patch)
tree90c9830d6fe16da6753b1c6b0457fd71f4d0fac4 /core/java/android/content
parent674a3a21cba94c129b322b05bbaaf9b1fc8afbd8 (diff)
downloadframeworks_base-7f4a63d1ebc13c6499a48331ecb78c4d27446dbc.zip
frameworks_base-7f4a63d1ebc13c6499a48331ecb78c4d27446dbc.tar.gz
frameworks_base-7f4a63d1ebc13c6499a48331ecb78c4d27446dbc.tar.bz2
Ensure we don't pass null values in to Theme.resolveAttributes
BUG: 18182274 Change-Id: I08acf877cb81478cc205254edf92a31fcf05991d
Diffstat (limited to 'core/java/android/content')
-rw-r--r--core/java/android/content/res/Resources.java14
1 files changed, 8 insertions, 6 deletions
diff --git a/core/java/android/content/res/Resources.java b/core/java/android/content/res/Resources.java
index 6e9efe1..0145e05 100644
--- a/core/java/android/content/res/Resources.java
+++ b/core/java/android/content/res/Resources.java
@@ -18,6 +18,7 @@ package android.content.res;
import android.animation.Animator;
import android.animation.StateListAnimator;
+import android.annotation.NonNull;
import android.util.Pools.SynchronizedPool;
import android.view.ViewDebug;
import com.android.internal.util.XmlUtils;
@@ -1548,20 +1549,21 @@ public class Resources {
* contents of the typed array are ultimately filled in by
* {@link Resources#getValue}.
*
- * @param values The base set of attribute values, must be equal
- * in length to {@code attrs} or {@code null}. All values
- * must be of type {@link TypedValue#TYPE_ATTRIBUTE}.
+ * @param values The base set of attribute values, must be equal in
+ * length to {@code attrs}. All values must be of type
+ * {@link TypedValue#TYPE_ATTRIBUTE}.
* @param attrs The desired attributes to be retrieved.
* @return Returns a TypedArray holding an array of the attribute
* values. Be sure to call {@link TypedArray#recycle()}
* when done with it.
* @hide
*/
- public TypedArray resolveAttributes(int[] values, int[] attrs) {
+ @NonNull
+ public TypedArray resolveAttributes(@NonNull int[] values, @NonNull int[] attrs) {
final int len = attrs.length;
- if (values != null && len != values.length) {
+ if (values == null || len != values.length) {
throw new IllegalArgumentException(
- "Base attribute values must be null or the same length as attrs");
+ "Base attribute values must the same length as attrs");
}
final TypedArray array = TypedArray.obtain(Resources.this, len);