From 48285bde03a586d7edd064148be82681afa51b74 Mon Sep 17 00:00:00 2001 From: Connor Tumbleson Date: Tue, 5 May 2015 07:43:48 -0500 Subject: [PATCH] Prevent frameworks from modifying sharedLibrary Since all frameworks are decoded the same via readPackage(), reading a framework that was a sharedLibrary would throw the sharedLibrary flag for the apk. Since packageName isn't set until after the first decode, we check the values to make sure we only set this variable on the first apk decoded. Refs #936 --- .../src/main/java/brut/androlib/res/decoder/ARSCDecoder.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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 1ca53d35..35e6cf49 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 @@ -90,7 +90,9 @@ public class ARSCDecoder { // for Apktool's use we need a non-zero packageId. // AOSP indicates 0x02 is next, as 0x01 is system and 0x7F is private. id = 2; - mResTable.setSharedLibrary(true); + if (mResTable.getPackageOriginal() == null && mResTable.getPackageRenamed() == null) { + mResTable.setSharedLibrary(true); + } } String name = mIn.readNullEndedString(128, true);