Remove mandatory original signature check (#185)

We are unnecessary fetching original signature even when signature
bypass level is not greater than 0. Due to which some apps which were
not signed were failing to be patched with error "get original signature
failed".
This commit is contained in:
Harshit Shah 2023-04-21 18:51:25 +05:30 committed by GitHub
parent 5d8645d201
commit 4d8bafd74f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 4 deletions

View File

@ -205,11 +205,14 @@ public class LSPatch {
throw new PatchError("Failed to register signer", e);
}
final String originalSignature = ApkSignatureHelper.getApkSignInfo(srcApkFile.getAbsolutePath());
String originalSignature = null;
if (sigbypassLevel > 0) {
originalSignature = ApkSignatureHelper.getApkSignInfo(srcApkFile.getAbsolutePath());
if (originalSignature == null || originalSignature.isEmpty()) {
throw new PatchError("get original signature failed");
}
logger.d("Original signature\n" + originalSignature);
}
// copy out manifest file from zlib
var manifestEntry = srcZFile.get(ANDROID_MANIFEST_XML);