am 6742a0c9: am 779a4ca8: Merge "Improve robustness of package manager certificate collection." into froyo
Merge commit '6742a0c9ccb8ade97d9cdfd53f7c74a9dc04c3a0' into kraken * commit '6742a0c9ccb8ade97d9cdfd53f7c74a9dc04c3a0': Improve robustness of package manager certificate collection.
This commit is contained in:
@@ -2507,16 +2507,25 @@ class PackageManagerService extends IPackageManager.Stub {
|
|||||||
private boolean collectCertificatesLI(PackageParser pp, PackageSetting ps,
|
private boolean collectCertificatesLI(PackageParser pp, PackageSetting ps,
|
||||||
PackageParser.Package pkg, File srcFile, int parseFlags) {
|
PackageParser.Package pkg, File srcFile, int parseFlags) {
|
||||||
if (GET_CERTIFICATES) {
|
if (GET_CERTIFICATES) {
|
||||||
if (ps == null || !ps.codePath.equals(srcFile)
|
if (ps != null
|
||||||
|| ps.getTimeStamp() != srcFile.lastModified()) {
|
&& ps.codePath.equals(srcFile)
|
||||||
Log.i(TAG, srcFile.toString() + " changed; collecting certs");
|
&& ps.getTimeStamp() == srcFile.lastModified()) {
|
||||||
if (!pp.collectCertificates(pkg, parseFlags)) {
|
if (ps.signatures.mSignatures != null
|
||||||
mLastScanError = pp.getParseError();
|
&& ps.signatures.mSignatures.length != 0) {
|
||||||
return false;
|
// 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 {
|
} else {
|
||||||
// Lets implicitly assign existing certificates.
|
Log.i(TAG, srcFile.toString() + " changed; collecting certs");
|
||||||
pkg.mSignatures = ps.signatures.mSignatures;
|
}
|
||||||
|
|
||||||
|
if (!pp.collectCertificates(pkg, parseFlags)) {
|
||||||
|
mLastScanError = pp.getParseError();
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
Reference in New Issue
Block a user