diff options
| author | Alan Viverette <alanv@google.com> | 2015-06-01 15:18:37 -0700 |
|---|---|---|
| committer | Alan Viverette <alanv@google.com> | 2015-06-01 15:18:37 -0700 |
| commit | 069767717a8323bbb05988137a91d40968af2972 (patch) | |
| tree | 143f75fb3c7894c36b1be0516a7dcfda773fa26c /core | |
| parent | bdd500ecd4ceea7d4e4a06ece08c9b9fd5d8aec5 (diff) | |
| download | frameworks_base-069767717a8323bbb05988137a91d40968af2972.zip frameworks_base-069767717a8323bbb05988137a91d40968af2972.tar.gz frameworks_base-069767717a8323bbb05988137a91d40968af2972.tar.bz2 | |
Remove strict mode violation from value to string coercion
The legitimate uses of value to string coercion, including the
interaction between lax attribute formatting and AAPT type inference,
combined with the low likelihood of unintentional coercion and low cost
of most string coercions, makes the value to string coercion violation
overkill.
Bug: 21563086
Change-Id: I7892e776d3e5479fcba507749b074c2abdf1b781
Diffstat (limited to 'core')
| -rw-r--r-- | core/java/android/content/res/TypedArray.java | 23 | ||||
| -rw-r--r-- | core/java/android/view/View.java | 2 |
2 files changed, 1 insertions, 24 deletions
diff --git a/core/java/android/content/res/TypedArray.java b/core/java/android/content/res/TypedArray.java index f0c3f2d..8bcd5d1 100644 --- a/core/java/android/content/res/TypedArray.java +++ b/core/java/android/content/res/TypedArray.java @@ -160,7 +160,6 @@ public class TypedArray { final TypedValue v = mValue; if (getValueAt(index, v)) { - StrictMode.noteResourceMismatch(v); return v.coerceToString(); } @@ -183,24 +182,6 @@ public class TypedArray { */ @Nullable public String getString(int index) { - return getString(index, true); - } - - /** - * Returns a string representation of the value at the given index, - * optionally throwing a resource mismatch strict mode violation if the - * value must be coerced to a string. - * - * @param index the index of the attribute to retrieve - * @param strict {@code true} to throw a strict mode violation for string - * coercion, {@code false} otherwise - * @return a string representation of the value at the given index, or - * {@code null} if the resource could not be coerced to a string - * @see StrictMode#noteResourceMismatch(Object) - * @hide Used internally for view attribute inspection. - */ - @Nullable - public String getString(int index, boolean strict) { if (mRecycled) { throw new RuntimeException("Cannot make calls to a recycled instance!"); } @@ -216,9 +197,6 @@ public class TypedArray { final TypedValue v = mValue; if (getValueAt(index, v)) { - if (strict) { - StrictMode.noteResourceMismatch(v); - } final CharSequence cs = v.coerceToString(); return cs != null ? cs.toString() : null; } @@ -292,7 +270,6 @@ public class TypedArray { final TypedValue v = mValue; if (getValueAt(index, v)) { - StrictMode.noteResourceMismatch(v); final CharSequence cs = v.coerceToString(); return cs != null ? cs.toString() : null; } diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java index 3e621b1..3b1587a 100644 --- a/core/java/android/view/View.java +++ b/core/java/android/view/View.java @@ -4510,7 +4510,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback, } attributes[i] = resourceName; - attributes[i + 1] = t.getString(index, false); + attributes[i + 1] = t.getString(index); i += 2; } |
