diff --git a/core/java/android/util/apk/ApkSignatureVerifier.java b/core/java/android/util/apk/ApkSignatureVerifier.java index de9f55b092004..544cc1c76d4e5 100644 --- a/core/java/android/util/apk/ApkSignatureVerifier.java +++ b/core/java/android/util/apk/ApkSignatureVerifier.java @@ -397,15 +397,18 @@ public class ApkSignatureVerifier { /** * @return the verity root hash in the Signing Block. */ - public static byte[] getVerityRootHash(String apkPath) - throws IOException, SignatureNotFoundException, SecurityException { + public static byte[] getVerityRootHash(String apkPath) throws IOException, SecurityException { // first try v3 try { return ApkSignatureSchemeV3Verifier.getVerityRootHash(apkPath); } catch (SignatureNotFoundException e) { // try older version } - return ApkSignatureSchemeV2Verifier.getVerityRootHash(apkPath); + try { + return ApkSignatureSchemeV2Verifier.getVerityRootHash(apkPath); + } catch (SignatureNotFoundException e) { + return null; + } } /**