diff --git a/INTERNAL.md b/INTERNAL.md index e9723dbe..2326f42c 100644 --- a/INTERNAL.md +++ b/INTERNAL.md @@ -208,7 +208,8 @@ First step is using the [platform_frameworks_base](https://github.com/iBotPeache While previously unorganized, the repo now follows the branch naming convention depending on the current Android version. So `apktool_7.1` corresponds to the 7.1 Android release. This branch should work for all `android-7.1.x` tags for AOSP. -We didn't follow this naming convention until Android 7.1. So don't go looking for older versions. +We didn't follow this naming convention until Android 7.1. So don't go looking for older versions. The current version +is `apktool-9.0.0`, which corresponds to the Android 9.0 (Pie) release. This repo has a variety of changes applied. These changes range from disabling optimizations to lessening the rules that aapt regularly has. We do this because apktool's job is to not fix apks, but rather keep them as close to the @@ -224,8 +225,8 @@ we aren't building the entire AOSP package, the initial build is to just see if We check out a certain tag. Currently we use - * aapt2 - `master#05c09faad2ab67ada8d354440680d40176841b6c`. - * aapt1 - `android-8.1.0_r9`. + * aapt2 - `android-9.0.0_r3`. + * aapt1 - `android-9.0.0_r3`. ### Including our modified `frameworks/base` package. diff --git a/brut.apktool/apktool-lib/src/main/resources/prebuilt/aapt/linux/aapt b/brut.apktool/apktool-lib/src/main/resources/prebuilt/aapt/linux/aapt index 2e33dc33..40d1c24c 100755 Binary files a/brut.apktool/apktool-lib/src/main/resources/prebuilt/aapt/linux/aapt and b/brut.apktool/apktool-lib/src/main/resources/prebuilt/aapt/linux/aapt differ diff --git a/brut.apktool/apktool-lib/src/main/resources/prebuilt/aapt/macosx/aapt b/brut.apktool/apktool-lib/src/main/resources/prebuilt/aapt/macosx/aapt index 7f0f6e67..1b94a3dc 100755 Binary files a/brut.apktool/apktool-lib/src/main/resources/prebuilt/aapt/macosx/aapt and b/brut.apktool/apktool-lib/src/main/resources/prebuilt/aapt/macosx/aapt differ diff --git a/brut.apktool/apktool-lib/src/main/resources/prebuilt/aapt/windows/aapt.exe b/brut.apktool/apktool-lib/src/main/resources/prebuilt/aapt/windows/aapt.exe index ca6d3b91..f7972d7a 100755 Binary files a/brut.apktool/apktool-lib/src/main/resources/prebuilt/aapt/windows/aapt.exe and b/brut.apktool/apktool-lib/src/main/resources/prebuilt/aapt/windows/aapt.exe differ diff --git a/brut.apktool/apktool-lib/src/main/resources/prebuilt/aapt2/linux/aapt2 b/brut.apktool/apktool-lib/src/main/resources/prebuilt/aapt2/linux/aapt2 index d61eb902..71ad03a3 100755 Binary files a/brut.apktool/apktool-lib/src/main/resources/prebuilt/aapt2/linux/aapt2 and b/brut.apktool/apktool-lib/src/main/resources/prebuilt/aapt2/linux/aapt2 differ diff --git a/brut.apktool/apktool-lib/src/main/resources/prebuilt/aapt2/macosx/aapt2 b/brut.apktool/apktool-lib/src/main/resources/prebuilt/aapt2/macosx/aapt2 index 957487d5..3752ab2f 100755 Binary files a/brut.apktool/apktool-lib/src/main/resources/prebuilt/aapt2/macosx/aapt2 and b/brut.apktool/apktool-lib/src/main/resources/prebuilt/aapt2/macosx/aapt2 differ diff --git a/brut.apktool/apktool-lib/src/main/resources/prebuilt/aapt2/windows/aapt2.exe b/brut.apktool/apktool-lib/src/main/resources/prebuilt/aapt2/windows/aapt2.exe index 8338faa0..5496a556 100755 Binary files a/brut.apktool/apktool-lib/src/main/resources/prebuilt/aapt2/windows/aapt2.exe and b/brut.apktool/apktool-lib/src/main/resources/prebuilt/aapt2/windows/aapt2.exe differ diff --git a/brut.apktool/apktool-lib/src/test/java/brut/androlib/BaseTest.java b/brut.apktool/apktool-lib/src/test/java/brut/androlib/BaseTest.java index 1682fb07..f0f7b953 100644 --- a/brut.apktool/apktool-lib/src/test/java/brut/androlib/BaseTest.java +++ b/brut.apktool/apktool-lib/src/test/java/brut/androlib/BaseTest.java @@ -117,6 +117,8 @@ public class BaseTest { if (qualifier == null) { XMLUnit.setIgnoreWhitespace(true); + XMLUnit.setIgnoreAttributeOrder(true); + XMLUnit.setCompareUnmatched(false); assertXMLEqual(control, test); return; } diff --git a/brut.apktool/apktool-lib/src/test/java/brut/androlib/aapt1/DebugTagRetainedTest.java b/brut.apktool/apktool-lib/src/test/java/brut/androlib/aapt1/DebugTagRetainedTest.java index 2e0658fc..68f555cb 100644 --- a/brut.apktool/apktool-lib/src/test/java/brut/androlib/aapt1/DebugTagRetainedTest.java +++ b/brut.apktool/apktool-lib/src/test/java/brut/androlib/aapt1/DebugTagRetainedTest.java @@ -20,17 +20,19 @@ import brut.androlib.*; import brut.directory.ExtFile; import brut.common.BrutException; import brut.util.OS; +import org.custommonkey.xmlunit.XMLUnit; import org.junit.AfterClass; import org.junit.BeforeClass; import org.junit.Test; +import org.xml.sax.SAXException; import java.io.File; import java.io.IOException; import java.nio.file.Files; import java.nio.file.Paths; -import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; +import static org.custommonkey.xmlunit.XMLAssert.assertXMLEqual; /** * @author Connor Tumbleson @@ -70,16 +72,21 @@ public class DebugTagRetainedTest extends BaseTest { } @Test - public void DebugIsTruePriorToBeingFalseTest() throws IOException { + public void DebugIsTruePriorToBeingFalseTest() throws IOException, SAXException { String apk = "issue1235-new"; - String expected = TestUtils.replaceNewlines("\n" + - "\n" + - " " + - ""); + 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)); - assertEquals(expected, obtained); + + XMLUnit.setIgnoreWhitespace(true); + XMLUnit.setIgnoreAttributeOrder(true); + XMLUnit.setCompareUnmatched(false); + + assertXMLEqual(expected, obtained); } } \ No newline at end of file diff --git a/brut.apktool/apktool-lib/src/test/java/brut/androlib/aapt1/ProviderAttributeTest.java b/brut.apktool/apktool-lib/src/test/java/brut/androlib/aapt1/ProviderAttributeTest.java index e6cb4b8f..642965f8 100644 --- a/brut.apktool/apktool-lib/src/test/java/brut/androlib/aapt1/ProviderAttributeTest.java +++ b/brut.apktool/apktool-lib/src/test/java/brut/androlib/aapt1/ProviderAttributeTest.java @@ -23,16 +23,18 @@ import brut.androlib.TestUtils; import brut.directory.ExtFile; import brut.common.BrutException; import brut.util.OS; +import org.custommonkey.xmlunit.XMLUnit; import org.junit.AfterClass; import org.junit.BeforeClass; import org.junit.Test; +import org.xml.sax.SAXException; import java.io.File; import java.io.IOException; import java.nio.file.Files; import java.nio.file.Paths; -import static org.junit.Assert.assertEquals; +import static org.custommonkey.xmlunit.XMLAssert.assertXMLEqual; import static org.junit.Assert.assertTrue; public class ProviderAttributeTest extends BaseTest { @@ -50,7 +52,7 @@ public class ProviderAttributeTest extends BaseTest { } @Test - public void isProviderStringReplacementWorking() throws BrutException, IOException { + public void isProviderStringReplacementWorking() throws BrutException, IOException, SAXException { String apk = "issue636.apk"; // decode issue636.apk @@ -70,7 +72,7 @@ public class ProviderAttributeTest extends BaseTest { apkDecoder.decode(); String expected = TestUtils.replaceNewlines("\n" + - "\n" + + "\n" + " \n" + " \n" + " \n" + @@ -80,7 +82,12 @@ public class ProviderAttributeTest extends BaseTest { byte[] encoded = Files.readAllBytes(Paths.get(sTmpDir + File.separator + apk + ".out.two" + File.separator + "AndroidManifest.xml")); String obtained = TestUtils.replaceNewlines(new String(encoded)); - assertEquals(expected, obtained); + + XMLUnit.setIgnoreWhitespace(true); + XMLUnit.setIgnoreAttributeOrder(true); + XMLUnit.setCompareUnmatched(false); + + assertXMLEqual(expected, obtained); } private boolean fileExists(String filepath) { diff --git a/brut.apktool/apktool-lib/src/test/java/brut/androlib/decode/ExternalEntityTest.java b/brut.apktool/apktool-lib/src/test/java/brut/androlib/decode/ExternalEntityTest.java index dceaca5d..6cd58b5c 100644 --- a/brut.apktool/apktool-lib/src/test/java/brut/androlib/decode/ExternalEntityTest.java +++ b/brut.apktool/apktool-lib/src/test/java/brut/androlib/decode/ExternalEntityTest.java @@ -62,11 +62,11 @@ public class ExternalEntityTest extends BaseTest { @Test public void doctypeTest() throws IOException { - String expected = TestUtils.replaceNewlines("\n" + - "\n" + - " \n" + - ""); + String expected = TestUtils.replaceNewlines("" + + " "); byte[] encoded = Files.readAllBytes(Paths.get(sTestOrigDir + File.separator + "output" + File.separator + "AndroidManifest.xml")); String obtained = TestUtils.replaceNewlines(new String(encoded)); diff --git a/brut.apktool/apktool-lib/src/test/resources/aapt1/issue767/issue767.apk b/brut.apktool/apktool-lib/src/test/resources/aapt1/issue767/issue767.apk index fdc88b03..7eff5752 100644 Binary files a/brut.apktool/apktool-lib/src/test/resources/aapt1/issue767/issue767.apk and b/brut.apktool/apktool-lib/src/test/resources/aapt1/issue767/issue767.apk differ diff --git a/brut.apktool/apktool-lib/src/test/resources/aapt1/testapp/AndroidManifest.xml b/brut.apktool/apktool-lib/src/test/resources/aapt1/testapp/AndroidManifest.xml index 057f5576..313ccae1 100644 --- a/brut.apktool/apktool-lib/src/test/resources/aapt1/testapp/AndroidManifest.xml +++ b/brut.apktool/apktool-lib/src/test/resources/aapt1/testapp/AndroidManifest.xml @@ -1,5 +1,5 @@ - + diff --git a/brut.apktool/apktool-lib/src/test/resources/aapt2/pkgid8/AndroidManifest.xml b/brut.apktool/apktool-lib/src/test/resources/aapt2/pkgid8/AndroidManifest.xml index 0be2ca2e..8f3c1650 100644 --- a/brut.apktool/apktool-lib/src/test/resources/aapt2/pkgid8/AndroidManifest.xml +++ b/brut.apktool/apktool-lib/src/test/resources/aapt2/pkgid8/AndroidManifest.xml @@ -1,4 +1,3 @@ - + diff --git a/brut.apktool/apktool-lib/src/test/resources/aapt2/testapp/AndroidManifest.xml b/brut.apktool/apktool-lib/src/test/resources/aapt2/testapp/AndroidManifest.xml index 78d83f63..6d86e9f4 100644 --- a/brut.apktool/apktool-lib/src/test/resources/aapt2/testapp/AndroidManifest.xml +++ b/brut.apktool/apktool-lib/src/test/resources/aapt2/testapp/AndroidManifest.xml @@ -1,3 +1,3 @@ - + diff --git a/build.gradle b/build.gradle index fde3be3d..55bd250d 100644 --- a/build.gradle +++ b/build.gradle @@ -117,7 +117,7 @@ subprojects { snakeyaml: 'org.yaml:snakeyaml:1.18:android', smali: 'org.smali:smali:2.2.2', xmlpull: 'xpp3:xpp3:1.1.4c', - xmlunit: 'xmlunit:xmlunit:1.3', + xmlunit: 'xmlunit:xmlunit:1.6', ] }