mirror of
https://github.com/revanced/Apktool.git
synced 2025-02-12 20:06:48 +01:00
Merge pull request #1770 from iBotPeaches/issue-1769
Correct compression type of AOSP default no-compress extensions
This commit is contained in:
commit
684e96a4fe
@ -168,8 +168,7 @@ public class Androlib {
|
|||||||
String ext;
|
String ext;
|
||||||
|
|
||||||
for (String file : files) {
|
for (String file : files) {
|
||||||
if (isAPKFileNames(file) && !NO_COMPRESS_PATTERN.matcher(file).find()) {
|
if (isAPKFileNames(file) && unk.getCompressionLevel(file) == 0) {
|
||||||
if (unk.getCompressionLevel(file) == 0) {
|
|
||||||
|
|
||||||
if (StringUtils.countMatches(file, ".") > 1) {
|
if (StringUtils.countMatches(file, ".") > 1) {
|
||||||
ext = file;
|
ext = file;
|
||||||
@ -180,12 +179,11 @@ public class Androlib {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! uncompressedFilesOrExts.contains(ext)) {
|
if (!uncompressedFilesOrExts.contains(ext)) {
|
||||||
uncompressedFilesOrExts.add(ext);
|
uncompressedFilesOrExts.add(ext);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
} catch (DirectoryException ex) {
|
} catch (DirectoryException ex) {
|
||||||
throw new AndrolibException(ex);
|
throw new AndrolibException(ex);
|
||||||
}
|
}
|
||||||
@ -789,9 +787,4 @@ public class Androlib {
|
|||||||
private final static String[] APK_STANDARD_ALL_FILENAMES = new String[] {
|
private final static String[] APK_STANDARD_ALL_FILENAMES = new String[] {
|
||||||
"classes.dex", "AndroidManifest.xml", "resources.arsc", "res", "r", "R",
|
"classes.dex", "AndroidManifest.xml", "resources.arsc", "res", "r", "R",
|
||||||
"lib", "libs", "assets", "META-INF", "kotlin" };
|
"lib", "libs", "assets", "META-INF", "kotlin" };
|
||||||
// Taken from AOSP's frameworks/base/tools/aapt/Package.cpp
|
|
||||||
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)$");
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -173,6 +173,13 @@ public class BuildAndDecodeTest extends BaseTest {
|
|||||||
assertEquals(0x8888, aaaa.length());
|
assertEquals(0x8888, aaaa.length());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void storedMp3FilesAreNotCompressedTest() throws BrutException {
|
||||||
|
ExtFile extFile = new ExtFile(sTmpDir, "testapp.apk");
|
||||||
|
Integer built = extFile.getDirectory().getCompressionLevel("res/raw/rain.mp3");
|
||||||
|
assertEquals(new Integer(0), built);
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void crossTypeTest() throws BrutException {
|
public void crossTypeTest() throws BrutException {
|
||||||
compareValuesFiles("values-mcc003/strings.xml");
|
compareValuesFiles("values-mcc003/strings.xml");
|
||||||
|
@ -10,6 +10,10 @@ versionInfo:
|
|||||||
versionCode: '1'
|
versionCode: '1'
|
||||||
versionName: '1.0'
|
versionName: '1.0'
|
||||||
compressionType: false
|
compressionType: false
|
||||||
|
doNotCompress:
|
||||||
|
- arsc
|
||||||
|
- png
|
||||||
|
- mp3
|
||||||
unknownFiles:
|
unknownFiles:
|
||||||
hidden.file: '8'
|
hidden.file: '8'
|
||||||
non\u007Fprintable.file: '8'
|
non\u007Fprintable.file: '8'
|
||||||
|
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user