Skip split apks when possible

When the split apks are loaded by appComponentFactory, we skip patching
them to reduce the file size.
This commit is contained in:
JingMatrix 2023-06-04 11:32:33 +02:00
parent 89b71ebe0a
commit 69438162cd
1 changed files with 12 additions and 0 deletions

View File

@ -233,6 +233,18 @@ public class LSPatch {
logger.d("original minSdkVersion: " + minSdkVersion);
}
final boolean skipSplit = apkPaths.size() > 1 && srcApkFile.getName().startsWith("split_") && appComponentFactory == null;
if (skipSplit) {
logger.i("Packing split apk...");
for (StoredEntry entry : srcZFile.entries()) {
String name = entry.getCentralDirectoryHeader().getName();
if (dstZFile.get(name) != null) continue;
if (name.startsWith("META-INF") && (name.endsWith(".SF") || name.endsWith(".MF") || name.endsWith(".RSA"))) continue;
srcZFile.addFileLink(name, name);
}
return;
}
logger.i("Patching apk...");
// modify manifest
final var config = new PatchConfig(useManager, debuggableFlag, overrideVersionCode, sigbypassLevel, originalSignature, appComponentFactory);