From abd917d1393318f34ad434138b47623b675faaf2 Mon Sep 17 00:00:00 2001 From: John Reck Date: Wed, 4 Jan 2017 19:04:25 -0800 Subject: [PATCH] Workaround for custom TypedArray injectors Fixes: 33814858 Works around a crash for apps that inject custom TypedArrays, which is completely unsupported, but given the ease with which the crash can be worked just going with higher compatibility on this one. Test: App referenced in bug launches Change-Id: Iac9a9b4fefd08815544211ffa49b02259920381f --- core/java/android/content/res/TypedArray.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/java/android/content/res/TypedArray.java b/core/java/android/content/res/TypedArray.java index ca95ce19fa9c9..391220134adeb 100644 --- a/core/java/android/content/res/TypedArray.java +++ b/core/java/android/content/res/TypedArray.java @@ -79,7 +79,7 @@ public class TypedArray { final int dataLen = len * AssetManager.STYLE_NUM_ENTRIES; final int indicesLen = len + 1; final VMRuntime runtime = VMRuntime.getRuntime(); - if (mData == null || mData.length < dataLen) { + if (mDataAddress == 0 || mData.length < dataLen) { mData = (int[]) runtime.newNonMovableArray(int.class, dataLen); mDataAddress = runtime.addressOf(mData); mIndices = (int[]) runtime.newNonMovableArray(int.class, indicesLen);