From 3f8d9fa835b3c48c1a3acf402a0a758b86d49f16 Mon Sep 17 00:00:00 2001 From: Connor Tumbleson Date: Mon, 5 Mar 2018 10:28:50 -0500 Subject: [PATCH] aapt2: patch system for decoding pkgId between 0x7f - 0xff --- .../src/main/java/brut/androlib/res/data/ResID.java | 2 +- .../src/main/java/brut/androlib/res/decoder/ARSCDecoder.java | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/data/ResID.java b/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/data/ResID.java index 338090b1..38fe93fc 100644 --- a/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/data/ResID.java +++ b/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/data/ResID.java @@ -31,7 +31,7 @@ public class ResID { } public ResID(int id) { - this(id >> 24, (id >> 16) & 0x000000ff, id & 0x0000ffff, id); + this((id >> 24) & 0xff, (id >> 16) & 0x000000ff, id & 0x0000ffff, id); } public ResID(int package_, int type, int entry, int id) { diff --git a/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/decoder/ARSCDecoder.java b/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/decoder/ARSCDecoder.java index f98a34aa..290a6615 100644 --- a/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/decoder/ARSCDecoder.java +++ b/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/decoder/ARSCDecoder.java @@ -17,6 +17,7 @@ package brut.androlib.res.decoder; import android.util.TypedValue; +import brut.androlib.Androlib; import brut.androlib.AndrolibException; import brut.androlib.res.data.*; import brut.androlib.res.data.value.*; @@ -85,7 +86,7 @@ public class ARSCDecoder { private ResPackage readTablePackage() throws IOException, AndrolibException { checkChunkType(Header.TYPE_PACKAGE); - int id = (byte) mIn.readInt(); + int id = mIn.readInt(); if (id == 0) { // This means we are dealing with a Library Package, we should just temporarily