From 011adec1a494974102930bf65a8d2fdfa8b375b5 Mon Sep 17 00:00:00 2001 From: Khaled Abdelmohsen Date: Mon, 24 Feb 2020 16:59:21 +0000 Subject: [PATCH 1/2] Create source stamp verifier Bug: 148005911 Test: gradlew test Change-Id: I7008c9567ad5e8b63e7f6ba192d38b10c5c9a2dc Merged-In: I7008c9567ad5e8b63e7f6ba192d38b10c5c9a2dc (cherry picked from commit a3970357d65d59b70c6ccf2c5c55000cb4310953) --- .../internal/apk/ApkSigningBlockUtils.java | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/main/java/com/android/apksig/internal/apk/ApkSigningBlockUtils.java b/src/main/java/com/android/apksig/internal/apk/ApkSigningBlockUtils.java index 2330f6d..f15597b 100644 --- a/src/main/java/com/android/apksig/internal/apk/ApkSigningBlockUtils.java +++ b/src/main/java/com/android/apksig/internal/apk/ApkSigningBlockUtils.java @@ -998,6 +998,20 @@ public class ApkSigningBlockUtils { return false; } + public boolean containsWarnings() { + if (!mWarnings.isEmpty()) { + return true; + } + if (!signers.isEmpty()) { + for (SignerInfo signer : signers) { + if (signer.containsWarnings()) { + return true; + } + } + } + return false; + } + public void addError(ApkVerifier.Issue msg, Object... parameters) { mErrors.add(new ApkVerifier.IssueWithParams(msg, parameters)); } @@ -1042,6 +1056,10 @@ public class ApkSigningBlockUtils { return !mErrors.isEmpty(); } + public boolean containsWarnings() { + return !mWarnings.isEmpty(); + } + public List getErrors() { return mErrors; } -- 2.30.2