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

Commit cebd1e94 authored by Jeff Brown's avatar Jeff Brown Committed by Android Git Automerger
Browse files

am 6742a0c9: am 779a4ca8: Merge "Improve robustness of package manager...

am 6742a0c9: am 779a4ca8: Merge "Improve robustness of package manager certificate collection." into froyo

Merge commit '6742a0c9' into kraken

* commit '6742a0c9':
  Improve robustness of package manager certificate collection.
parents 3622d253 6742a0c9
Loading
Loading
Loading
Loading
+17 −8
Original line number Diff line number Diff line
@@ -2507,17 +2507,26 @@ class PackageManagerService extends IPackageManager.Stub {
    private boolean collectCertificatesLI(PackageParser pp, PackageSetting ps,
            PackageParser.Package pkg, File srcFile, int parseFlags) {
        if (GET_CERTIFICATES) {
            if (ps == null || !ps.codePath.equals(srcFile)
                    || ps.getTimeStamp() != srcFile.lastModified()) {
            if (ps != null
                    && ps.codePath.equals(srcFile)
                    && ps.getTimeStamp() == srcFile.lastModified()) {
                if (ps.signatures.mSignatures != null
                        && ps.signatures.mSignatures.length != 0) {
                    // Optimization: reuse the existing cached certificates
                    // if the package appears to be unchanged.
                    pkg.mSignatures = ps.signatures.mSignatures;
                    return true;
                }
                
                Slog.w(TAG, "PackageSetting for " + ps.name + " is missing signatures.  Collecting certs again to recover them.");
            } else {
                Log.i(TAG, srcFile.toString() + " changed; collecting certs");
            }
            
            if (!pp.collectCertificates(pkg, parseFlags)) {
                mLastScanError = pp.getParseError();
                return false;
            }
            } else {
                // Lets implicitly assign existing certificates.
                pkg.mSignatures = ps.signatures.mSignatures;
            }
        }
        return true;
    }