Skip to content

Commit

Permalink
Merge branch 'fix/uncompressed_files_bug' of https://github.com/reali…
Browse files Browse the repository at this point in the history
…tyJie/Apktool into realityJie-fix/uncompressed_files_bug
  • Loading branch information
iBotPeaches committed Nov 19, 2019
2 parents f076def + 5197e21 commit 7910802
Showing 1 changed file with 8 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -169,14 +169,12 @@ public void recordUncompressedFiles(ExtFile apkFile, Collection<String> uncompre

for (String file : files) {
if (isAPKFileNames(file) &&
unk.getCompressionLevel(file) == 0 &&
unk.getSize(file) != 0) {
unk.getCompressionLevel(file) == 0 &&
unk.getSize(file) != 0) {

ext = FilenameUtils.getExtension(file);

// If we don't have a png extension, but we have multiple "dots", we may have another iteration
// of OEM specific 9patch files. We need to record full path for these.
if (ext.isEmpty() || (!ext.equals("png") && StringUtils.countMatches(file, ".") > 1)) {
if (ext.isEmpty() || !NO_COMPRESS_PATTERN.matcher(ext).find()) {
ext = file;
}
if (!uncompressedFilesOrExts.contains(ext)) {
Expand Down Expand Up @@ -485,7 +483,7 @@ public boolean buildResourcesFull(File appDir, UsesFramework usesFramework)
ninePatch = null;
}
mAndRes.aaptPackage(apkFile, new File(appDir,
"AndroidManifest.xml"), new File(appDir, "res"),
"AndroidManifest.xml"), new File(appDir, "res"),
ninePatch, null, parseUsesFramework(usesFramework));

Directory tmpDir = new ExtFile(apkFile).getDirectory();
Expand Down Expand Up @@ -547,7 +545,7 @@ public boolean buildManifest(ExtFile appDir, UsesFramework usesFramework)
}

mAndRes.aaptPackage(apkFile, new File(appDir,
"AndroidManifest.xml"), null, ninePatch, null,
"AndroidManifest.xml"), null, ninePatch, null,
parseUsesFramework(usesFramework));

Directory tmpDir = new ExtFile(apkFile).getDirectory();
Expand Down Expand Up @@ -796,4 +794,7 @@ public void close() throws IOException {
private final static String[] APK_STANDARD_ALL_FILENAMES = new String[] {
"classes.dex", "AndroidManifest.xml", "resources.arsc", "res", "r", "R",
"lib", "libs", "assets", "META-INF", "kotlin" };
private final static Pattern NO_COMPRESS_PATTERN = Pattern.compile("(" +
"jpg|jpeg|png|gif|wav|mp2|mp3|ogg|aac|mpg|mpeg|mid|midi|smf|jet|rtttl|imy|xmf|mp4|" +
"m4a|m4v|3gp|3gpp|3g2|3gpp2|amr|awb|wma|wmv|webm|mkv)$");
}

0 comments on commit 7910802

Please sign in to comment.