improve NPatch zip handling
將 android:largeHeap="true" 添加至管理員 manifest 中,防止系統限制 RAM。啟用 ZFileOptions.setNoTimestamps,並將來源 APK 嵌入為唯讀壓縮檔。
This commit is contained in:
parent
97a23caa9e
commit
c1480fa121
|
|
@ -23,6 +23,7 @@
|
|||
android:icon="@mipmap/ic_launcher"
|
||||
android:label="@string/app_name"
|
||||
android:supportsRtl="true"
|
||||
android:largeHeap="true"
|
||||
android:theme="@style/Theme.Material3.DayNight.NoActionBar">
|
||||
|
||||
<!-- 专门为小米手机桌面卸载添加了提示,提升用户体验 -->
|
||||
|
|
|
|||
|
|
@ -118,7 +118,9 @@ public class NPatch {
|
|||
"x86_64"
|
||||
));
|
||||
|
||||
private static final ZFileOptions Z_FILE_OPTIONS = new ZFileOptions().setAlignmentRule(AlignmentRules.compose(
|
||||
private static final ZFileOptions Z_FILE_OPTIONS = new ZFileOptions()
|
||||
.setNoTimestamps(true)
|
||||
.setAlignmentRule(AlignmentRules.compose(
|
||||
AlignmentRules.constantForSuffix(".so", 4096),
|
||||
AlignmentRules.constantForSuffix(ORIGINAL_APK_ASSET_PATH, 4096),
|
||||
AlignmentRules.constantForSuffix(".arsc", 4)
|
||||
|
|
@ -196,7 +198,7 @@ public class NPatch {
|
|||
logger.i("Parsing original apk...");
|
||||
|
||||
try (var dstZFile = ZFile.openReadWrite(outputFile, Z_FILE_OPTIONS);
|
||||
var srcZFile = dstZFile.addNestedZip((ignore) -> ORIGINAL_APK_ASSET_PATH, srcApkFile, false)) {
|
||||
var srcZFile = ZFile.openReadOnly(srcApkFile)) {
|
||||
|
||||
// sign apk
|
||||
try {
|
||||
|
|
|
|||
Loading…
Reference in New Issue