Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c3132513 authored by Jeff Sharkey's avatar Jeff Sharkey
Browse files

Parsing a static archive should be stateless.

When the caller hasn't specific encryption-related matching flags,
we should match both aware and unaware components.

Bug: 26508249
Change-Id: I2c35f6e00e451ba3f5fa0810223b7a3d80dee233
parent b5f07f86
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -4413,6 +4413,15 @@ public abstract class PackageManager {
        final PackageParser parser = new PackageParser();
        final File apkFile = new File(archiveFilePath);
        try {
            if ((flags & (MATCH_ENCRYPTION_UNAWARE | MATCH_ENCRYPTION_AWARE)) != 0) {
                // Caller expressed an explicit opinion about what encryption
                // aware/unaware components they want to see, so fall through and
                // give them what they want
            } else {
                // Caller expressed no opinion, so match everything
                flags |= MATCH_ENCRYPTION_AWARE_AND_UNAWARE;
            }

            PackageParser.Package pkg = parser.parseMonolithicPackage(apkFile, 0);
            if ((flags & GET_SIGNATURES) != 0) {
                parser.collectCertificates(pkg, 0);