Android: Fix style extract on Android N

Task-number: QTBUG-52744
Change-Id: If53a76929f3bc903573917cfd968431532817ace
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
(cherry picked from commit 392372392c)
Reviewed-by: Christian Stromme <christian.stromme@qt.io>
This commit is contained in:
BogDan Vatra 2016-04-21 15:45:13 +03:00
parent 178ab88562
commit 27fce8c07d

View File

@ -787,7 +787,14 @@ public class ExtractStyle {
private JSONObject findPatchesMarings(Drawable d) throws JSONException, NoSuchFieldException, IllegalAccessException
{
NinePatch np = (NinePatch) getAccessibleField(NinePatchDrawable.class, "mNinePatch").get(d);
NinePatch np;
Field f = tryGetAccessibleField(NinePatchDrawable.class, "mNinePatch");
if (f != null) {
np = (NinePatch) f.get(d);
} else {
Object state = getAccessibleField(NinePatchDrawable.class, "mNinePatchState").get(d);
np = (NinePatch) getAccessibleField(state.getClass(), "mNinePatch").get(state);
}
if (Build.VERSION.SDK_INT < 19)
return getJsonChunkInfo(extractChunkInfo((byte[]) getAccessibleField(np.getClass(), "mChunk").get(np)));
else