mirror of
https://github.com/revanced/Apktool.git
synced 2024-11-11 15:09:24 +01:00
remove jre7 code from testing class, added comments for manifest changing
This commit is contained in:
parent
f89b51c74e
commit
d2fc74d984
@ -275,14 +275,15 @@ final public class AndrolibResources {
|
|||||||
fileDecoder.decodeManifest(inApk, "AndroidManifest.xml", out,
|
fileDecoder.decodeManifest(inApk, "AndroidManifest.xml", out,
|
||||||
"AndroidManifest.xml");
|
"AndroidManifest.xml");
|
||||||
|
|
||||||
// fix package (Android 4.2)
|
|
||||||
adjust_package_manifest(resTable, outDir.getAbsolutePath()
|
|
||||||
+ File.separator + "AndroidManifest.xml");
|
|
||||||
|
|
||||||
// Remove versionName / versionCode (aapt API 16)
|
// Remove versionName / versionCode (aapt API 16)
|
||||||
if (resTable.getAnalysisMode() == false) {
|
if (!resTable.getAnalysisMode()) {
|
||||||
remove_manifest_versions(outDir.getAbsolutePath()
|
|
||||||
+ File.separator + "AndroidManifest.xml");
|
// check for a mismatch between resources.arsc package and the package listed in AndroidManifest
|
||||||
|
// also remove the android::versionCode / versionName from manifest for rebuild
|
||||||
|
// this is a required change to prevent aapt warning about conflicting versions
|
||||||
|
// it will be passed as a parameter to aapt like "--min-sdk-version" via apktool.yml
|
||||||
|
adjust_package_manifest(resTable, outDir.getAbsolutePath() + File.separator + "AndroidManifest.xml");
|
||||||
|
remove_manifest_versions(outDir.getAbsolutePath() + File.separator + "AndroidManifest.xml");
|
||||||
}
|
}
|
||||||
if (inApk.containsDir("res")) {
|
if (inApk.containsDir("res")) {
|
||||||
in = inApk.getDir("res");
|
in = inApk.getDir("res");
|
||||||
|
@ -17,11 +17,14 @@ package brut.androlib;
|
|||||||
|
|
||||||
import brut.androlib.res.util.ExtFile;
|
import brut.androlib.res.util.ExtFile;
|
||||||
import brut.common.BrutException;
|
import brut.common.BrutException;
|
||||||
|
import brut.directory.FileDirectory;
|
||||||
import brut.util.OS;
|
import brut.util.OS;
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
import java.nio.file.*;
|
import java.nio.file.*;
|
||||||
import java.nio.file.attribute.BasicFileAttributes;
|
import java.nio.file.attribute.BasicFileAttributes;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.Iterator;
|
||||||
|
import java.util.Set;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
import org.custommonkey.xmlunit.*;
|
import org.custommonkey.xmlunit.*;
|
||||||
import org.junit.*;
|
import org.junit.*;
|
||||||
@ -223,47 +226,37 @@ public class BuildAndDecodeTest {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void compareBinaryFolder(String path, boolean res) throws BrutException, IOException {
|
private boolean compareBinaryFolder(String path, boolean res) throws BrutException, IOException {
|
||||||
|
|
||||||
String tmp = "";
|
String tmp = "";
|
||||||
if (res) {
|
if (res) {
|
||||||
tmp = File.separatorChar + "res" + File.separatorChar;
|
tmp = File.separatorChar + "res" + File.separatorChar;
|
||||||
}
|
}
|
||||||
|
|
||||||
Files.walkFileTree(Paths.get(sTestOrigDir.toPath() + tmp + path), new SimpleFileVisitor<Path>() {
|
FileDirectory fileDirectory = new FileDirectory(sTestOrigDir + tmp + path);
|
||||||
|
|
||||||
@Override
|
Set<String> files = fileDirectory.getFiles(true);
|
||||||
public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException {
|
for (String filename : files) {
|
||||||
|
File control = new File(filename);
|
||||||
|
|
||||||
// hacky fix - load test by changing name of control
|
// hacky fix - load test by changing name of control
|
||||||
File control = file.toFile();
|
File test = new File(control.toString().replace("testapp-orig", "testapp-new"));
|
||||||
File test = new File(file.toString().replace("testapp-orig", "testapp-new"));
|
|
||||||
|
|
||||||
if (test.isFile()) {
|
if (test.isFile()) {
|
||||||
if (control.hashCode() != test.hashCode()) {
|
if (control.hashCode() != test.hashCode()) {
|
||||||
sResult = false;
|
return false;
|
||||||
return FileVisitResult.TERMINATE;
|
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
sResult = false;
|
|
||||||
return FileVisitResult.TERMINATE;
|
|
||||||
}
|
}
|
||||||
return FileVisitResult.CONTINUE;
|
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean compareResFolder(String path) throws BrutException, IOException {
|
private boolean compareResFolder(String path) throws BrutException, IOException {
|
||||||
sResult = true;
|
return compareBinaryFolder(path, true);
|
||||||
compareBinaryFolder(path, true);
|
|
||||||
return sResult;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean compareLibsFolder(String path) throws BrutException, IOException {
|
private boolean compareLibsFolder(String path) throws BrutException, IOException {
|
||||||
sResult = true;
|
return compareBinaryFolder(File.separatorChar + path,false);
|
||||||
compareBinaryFolder(File.separatorChar + path,false);
|
|
||||||
return sResult;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void compareValuesFiles(String path) throws BrutException {
|
private void compareValuesFiles(String path) throws BrutException {
|
||||||
@ -313,8 +306,6 @@ public class BuildAndDecodeTest {
|
|||||||
private static ExtFile sTestOrigDir;
|
private static ExtFile sTestOrigDir;
|
||||||
private static ExtFile sTestNewDir;
|
private static ExtFile sTestNewDir;
|
||||||
|
|
||||||
private static boolean sResult;
|
|
||||||
|
|
||||||
private final static Logger LOGGER = Logger
|
private final static Logger LOGGER = Logger
|
||||||
.getLogger(BuildAndDecodeTest.class.getName());
|
.getLogger(BuildAndDecodeTest.class.getName());
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user