From 7f0d94ede9bb3bb0428fa6fd108c064c5cba0510 Mon Sep 17 00:00:00 2001 From: Connor Tumbleson Date: Tue, 25 Jul 2023 06:43:15 -0400 Subject: [PATCH] feat: Introduce --no-compile-sdk-metadata (#3208) * feat: ignore sdk metadata during aapt2 * test: adjust test suite for aapt2 change --- .../src/main/java/brut/androlib/AaptInvoker.java | 2 ++ .../androlib/aapt2/DebuggableFalseChangeToTrueTest.java | 6 +++--- .../java/brut/androlib/aapt2/DebuggableTrueAddedTest.java | 6 +++--- .../brut/androlib/aapt2/DebuggableTrueRetainedTest.java | 6 +++--- 4 files changed, 11 insertions(+), 9 deletions(-) diff --git a/brut.apktool/apktool-lib/src/main/java/brut/androlib/AaptInvoker.java b/brut.apktool/apktool-lib/src/main/java/brut/androlib/AaptInvoker.java index 7aaad3d0..3720829f 100644 --- a/brut.apktool/apktool-lib/src/main/java/brut/androlib/AaptInvoker.java +++ b/brut.apktool/apktool-lib/src/main/java/brut/androlib/AaptInvoker.java @@ -182,6 +182,8 @@ public class AaptInvoker { cmd.add("--allow-reserved-package-id"); + cmd.add("--no-compile-sdk-metadata"); + if (mApkInfo.sparseResources) { cmd.add("--enable-sparse-encoding"); } diff --git a/brut.apktool/apktool-lib/src/test/java/brut/androlib/aapt2/DebuggableFalseChangeToTrueTest.java b/brut.apktool/apktool-lib/src/test/java/brut/androlib/aapt2/DebuggableFalseChangeToTrueTest.java index 426b2902..8ca7f8d6 100644 --- a/brut.apktool/apktool-lib/src/test/java/brut/androlib/aapt2/DebuggableFalseChangeToTrueTest.java +++ b/brut.apktool/apktool-lib/src/test/java/brut/androlib/aapt2/DebuggableFalseChangeToTrueTest.java @@ -75,9 +75,9 @@ public class DebuggableFalseChangeToTrueTest extends BaseTest { String apk = "issue2328-debuggable-flase-new"; String expected = TestUtils.replaceNewlines("" + - " "); + " "); byte[] encoded = Files.readAllBytes(Paths.get(sTmpDir + File.separator + apk + File.separator + "AndroidManifest.xml")); String obtained = TestUtils.replaceNewlines(new String(encoded)); diff --git a/brut.apktool/apktool-lib/src/test/java/brut/androlib/aapt2/DebuggableTrueAddedTest.java b/brut.apktool/apktool-lib/src/test/java/brut/androlib/aapt2/DebuggableTrueAddedTest.java index dc0f192c..9cab0376 100644 --- a/brut.apktool/apktool-lib/src/test/java/brut/androlib/aapt2/DebuggableTrueAddedTest.java +++ b/brut.apktool/apktool-lib/src/test/java/brut/androlib/aapt2/DebuggableTrueAddedTest.java @@ -75,9 +75,9 @@ public class DebuggableTrueAddedTest extends BaseTest { String apk = "issue2328-debuggable-missing-new"; String expected = TestUtils.replaceNewlines("" + - " "); + " "); byte[] encoded = Files.readAllBytes(Paths.get(sTmpDir + File.separator + apk + File.separator + "AndroidManifest.xml")); String obtained = TestUtils.replaceNewlines(new String(encoded)); diff --git a/brut.apktool/apktool-lib/src/test/java/brut/androlib/aapt2/DebuggableTrueRetainedTest.java b/brut.apktool/apktool-lib/src/test/java/brut/androlib/aapt2/DebuggableTrueRetainedTest.java index e7723025..d85822f4 100644 --- a/brut.apktool/apktool-lib/src/test/java/brut/androlib/aapt2/DebuggableTrueRetainedTest.java +++ b/brut.apktool/apktool-lib/src/test/java/brut/androlib/aapt2/DebuggableTrueRetainedTest.java @@ -75,9 +75,9 @@ public class DebuggableTrueRetainedTest extends BaseTest { String apk = "issue2328-debuggable-true-new"; String expected = TestUtils.replaceNewlines("" + - " "); + " "); byte[] encoded = Files.readAllBytes(Paths.get(sTmpDir + File.separator + apk + File.separator + "AndroidManifest.xml")); String obtained = TestUtils.replaceNewlines(new String(encoded));