mirror of
https://github.com/revanced/Apktool.git
synced 2024-12-11 21:37:47 +01:00
Fix « doNotCompress » in case of obfuscated resources.
This commit is contained in:
parent
f8df056a2c
commit
c4e8f88499
@ -184,6 +184,9 @@ public class Androlib {
|
||||
|
||||
if (ext.isEmpty() || !NO_COMPRESS_PATTERN.matcher(ext).find()) {
|
||||
ext = file;
|
||||
if (mAndRes.ObfFiles.containsKey(ext)) {
|
||||
ext = mAndRes.ObfFiles.get(ext);
|
||||
}
|
||||
}
|
||||
if (!uncompressedFilesOrExts.contains(ext)) {
|
||||
uncompressedFilesOrExts.add(ext);
|
||||
|
@ -247,7 +247,7 @@ final public class AndrolibResources {
|
||||
|
||||
LOGGER.info("Decoding file-resources...");
|
||||
for (ResResource res : pkg.listFiles()) {
|
||||
fileDecoder.decode(res, in, out);
|
||||
fileDecoder.decode(res, in, out, ObfFiles);
|
||||
}
|
||||
|
||||
LOGGER.info("Decoding values */* XMLs...");
|
||||
@ -1041,6 +1041,8 @@ final public class AndrolibResources {
|
||||
|
||||
public BuildOptions buildOptions;
|
||||
|
||||
public Map<String, String> ObfFiles = new HashMap();
|
||||
|
||||
// TODO: dirty static hack. I have to refactor decoding mechanisms.
|
||||
public static boolean sKeepBroken = false;
|
||||
|
||||
|
@ -27,6 +27,7 @@ import brut.directory.Directory;
|
||||
import brut.directory.DirectoryException;
|
||||
|
||||
import java.io.*;
|
||||
import java.util.Map;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
@ -37,10 +38,11 @@ public class ResFileDecoder {
|
||||
this.mDecoders = decoders;
|
||||
}
|
||||
|
||||
public void decode(ResResource res, Directory inDir, Directory outDir)
|
||||
public void decode(ResResource res, Directory inDir, Directory outDir, Map<String, String> obfFiles)
|
||||
throws AndrolibException {
|
||||
|
||||
ResFileValue fileValue = (ResFileValue) res.getValue();
|
||||
String inFileFullName = fileValue.toString();
|
||||
String inFileName = fileValue.getStrippedPath();
|
||||
String outResName = res.getFilePath();
|
||||
String typeName = res.getResSpec().getType().getName();
|
||||
@ -55,6 +57,11 @@ public class ResFileDecoder {
|
||||
outFileName = outResName + ext;
|
||||
}
|
||||
|
||||
String outFileFullName = "res/"+outFileName;
|
||||
if (!inFileFullName.equals(outFileFullName)) {
|
||||
obfFiles.put(inFileFullName, outFileFullName);
|
||||
}
|
||||
|
||||
try {
|
||||
if (typeName.equals("raw")) {
|
||||
decode(inDir, inFileName, outDir, outFileName, "raw");
|
||||
|
Loading…
Reference in New Issue
Block a user