修復 arsc 的正確壓縮和對齊
在 ZFileOptions 中為 .arsc 檔案添加 4 字節對齊規則,並在新增條目時將 resources.arsc 處理為原生程式庫。確保 resources.arsc 的正確對齊。
This commit is contained in:
parent
11fc7aa9a2
commit
97a23caa9e
|
|
@ -120,7 +120,8 @@ public class NPatch {
|
||||||
|
|
||||||
private static final ZFileOptions Z_FILE_OPTIONS = new ZFileOptions().setAlignmentRule(AlignmentRules.compose(
|
private static final ZFileOptions Z_FILE_OPTIONS = new ZFileOptions().setAlignmentRule(AlignmentRules.compose(
|
||||||
AlignmentRules.constantForSuffix(".so", 4096),
|
AlignmentRules.constantForSuffix(".so", 4096),
|
||||||
AlignmentRules.constantForSuffix(ORIGINAL_APK_ASSET_PATH, 4096)
|
AlignmentRules.constantForSuffix(ORIGINAL_APK_ASSET_PATH, 4096),
|
||||||
|
AlignmentRules.constantForSuffix(".arsc", 4)
|
||||||
));
|
));
|
||||||
|
|
||||||
private final JCommander jCommander;
|
private final JCommander jCommander;
|
||||||
|
|
@ -368,7 +369,7 @@ public class NPatch {
|
||||||
if (name.startsWith("META-INF") && (name.endsWith(".SF") || name.endsWith(".MF") || name.endsWith(".RSA"))) continue;
|
if (name.startsWith("META-INF") && (name.endsWith(".SF") || name.endsWith(".MF") || name.endsWith(".RSA"))) continue;
|
||||||
|
|
||||||
try (InputStream is = entry.open()) {
|
try (InputStream is = entry.open()) {
|
||||||
if (name.endsWith(".so")) {
|
if (name.endsWith(".so") || name.equals("resources.arsc")) {
|
||||||
dstZFile.add(name, is, false);
|
dstZFile.add(name, is, false);
|
||||||
} else {
|
} else {
|
||||||
dstZFile.add(name, is);
|
dstZFile.add(name, is);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue