mirror of
https://github.com/revanced/Apktool.git
synced 2025-05-30 21:40:11 +02:00
Merge pull request #2068 from iBotPeaches/issue-2064
Fix: Support decoding raw "qmg" files
This commit is contained in:
commit
5199c98a71
@ -79,7 +79,7 @@ public class ResFileDecoder {
|
|||||||
// check for raw 9patch images
|
// check for raw 9patch images
|
||||||
for (String extension : RAW_9PATCH_IMAGE_EXTENSIONS) {
|
for (String extension : RAW_9PATCH_IMAGE_EXTENSIONS) {
|
||||||
if (inFileName.toLowerCase().endsWith("." + extension)) {
|
if (inFileName.toLowerCase().endsWith("." + extension)) {
|
||||||
copyRaw(inDir, outDir, outFileName);
|
copyRaw(inDir, outDir, inFileName, outFileName);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -107,7 +107,7 @@ public class ResFileDecoder {
|
|||||||
// check for raw image
|
// check for raw image
|
||||||
for (String extension : RAW_IMAGE_EXTENSIONS) {
|
for (String extension : RAW_IMAGE_EXTENSIONS) {
|
||||||
if (inFileName.toLowerCase().endsWith("." + extension)) {
|
if (inFileName.toLowerCase().endsWith("." + extension)) {
|
||||||
copyRaw(inDir, outDir, outFileName);
|
copyRaw(inDir, outDir, inFileName, outFileName);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -144,9 +144,10 @@ public class ResFileDecoder {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void copyRaw(Directory inDir, Directory outDir, String filename) throws AndrolibException {
|
public void copyRaw(Directory inDir, Directory outDir, String inFilename,
|
||||||
|
String outFilename) throws AndrolibException {
|
||||||
try {
|
try {
|
||||||
DirUtil.copyToDir(inDir, outDir, filename);
|
DirUtil.copyToDir(inDir, outDir, inFilename, outFilename);
|
||||||
} catch (DirectoryException ex) {
|
} catch (DirectoryException ex) {
|
||||||
throw new AndrolibException(ex);
|
throw new AndrolibException(ex);
|
||||||
}
|
}
|
||||||
@ -168,6 +169,7 @@ public class ResFileDecoder {
|
|||||||
|
|
||||||
private final static String[] RAW_IMAGE_EXTENSIONS = new String[] {
|
private final static String[] RAW_IMAGE_EXTENSIONS = new String[] {
|
||||||
"m4a", // apple
|
"m4a", // apple
|
||||||
|
"qmg", // samsung
|
||||||
};
|
};
|
||||||
|
|
||||||
private final static String[] RAW_9PATCH_IMAGE_EXTENSIONS = new String[] {
|
private final static String[] RAW_9PATCH_IMAGE_EXTENSIONS = new String[] {
|
||||||
|
@ -26,6 +26,7 @@ import org.junit.BeforeClass;
|
|||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
import static org.junit.Assert.*;
|
import static org.junit.Assert.*;
|
||||||
|
|
||||||
@ -94,6 +95,11 @@ public class BuildAndDecodeTest extends BaseTest {
|
|||||||
compareXmlFiles("res/drawable/$avd_hide_password__0.xml");
|
compareXmlFiles("res/drawable/$avd_hide_password__0.xml");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void samsungQmgFilesHandledTest() throws IOException, BrutException {
|
||||||
|
compareBinaryFolder("drawable-xhdpi", true);
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void confirmManifestStructureTest() throws BrutException {
|
public void confirmManifestStructureTest() throws BrutException {
|
||||||
compareXmlFiles("AndroidManifest.xml");
|
compareXmlFiles("AndroidManifest.xml");
|
||||||
|
Binary file not shown.
After Width: | Height: | Size: 14 KiB |
@ -41,17 +41,19 @@ public class DirUtil {
|
|||||||
|
|
||||||
public static void copyToDir(Directory in, Directory out, String fileName)
|
public static void copyToDir(Directory in, Directory out, String fileName)
|
||||||
throws DirectoryException {
|
throws DirectoryException {
|
||||||
|
copyToDir(in, out, fileName, fileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void copyToDir(Directory in, Directory out, String inFile, String outFile)
|
||||||
|
throws DirectoryException {
|
||||||
try {
|
try {
|
||||||
if (in.containsDir(fileName)) {
|
if (in.containsDir(inFile)) {
|
||||||
// TODO: remove before copying
|
in.getDir(inFile).copyToDir(out.createDir(outFile));
|
||||||
in.getDir(fileName).copyToDir(out.createDir(fileName));
|
|
||||||
} else {
|
} else {
|
||||||
BrutIO.copyAndClose(in.getFileInput(fileName),
|
BrutIO.copyAndClose(in.getFileInput(inFile), out.getFileOutput(outFile));
|
||||||
out.getFileOutput(fileName));
|
|
||||||
}
|
}
|
||||||
} catch (IOException ex) {
|
} catch (IOException ex) {
|
||||||
throw new DirectoryException(
|
throw new DirectoryException("Error copying file: " + inFile, ex);
|
||||||
"Error copying file: " + fileName, ex);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user