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

Commit ad5f44a6 authored by Jeff Sharkey's avatar Jeff Sharkey Committed by Android (Google) Code Review
Browse files

Merge "Missing manifest error should be NO_CERTIFICATES." into lmp-dev

parents 8544c7da bc09755e
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -1099,9 +1099,12 @@ public class PackageParser {
                    }
                }
            }
        } catch (GeneralSecurityException | IOException | RuntimeException e) {
        } catch (GeneralSecurityException e) {
            throw new PackageParserException(INSTALL_PARSE_FAILED_CERTIFICATE_ENCODING,
                    "Failed to collect certificates from " + apkPath, e);
        } catch (IOException | RuntimeException e) {
            throw new PackageParserException(INSTALL_PARSE_FAILED_NO_CERTIFICATES,
                    "Failed to collect certificates from " + apkPath, e);
        } finally {
            closeQuietly(jarFile);
        }
+3 −6
Original line number Diff line number Diff line
@@ -579,8 +579,7 @@ public class PackageInstallerSession extends IPackageInstallerSession.Stub {
            try {
                apk = PackageParser.parseApkLite(file, PackageParser.PARSE_COLLECT_CERTIFICATES);
            } catch (PackageParserException e) {
                throw new PackageManagerException(INSTALL_FAILED_INVALID_APK,
                        "Failed to parse " + file + ": " + e);
                throw PackageManagerException.from(e);
            }

            if (!stagedSplits.add(apk.splitName)) {
@@ -646,8 +645,7 @@ public class PackageInstallerSession extends IPackageInstallerSession.Stub {
                existingBase = PackageParser.parseApkLite(new File(app.getBaseCodePath()),
                        PackageParser.PARSE_COLLECT_CERTIFICATES);
            } catch (PackageParserException e) {
                throw new PackageManagerException(INSTALL_FAILED_INVALID_APK,
                        "Failed to parse existing package " + app.getCodePath() + ": " + e);
                throw PackageManagerException.from(e);
            }

            assertApkConsistent("Existing base", existingBase);
@@ -699,8 +697,7 @@ public class PackageInstallerSession extends IPackageInstallerSession.Stub {
        try {
            baseApk = PackageParser.parseApkLite(mResolvedBaseFile, 0);
        } catch (PackageParserException e) {
            throw new PackageManagerException(INSTALL_FAILED_INVALID_APK,
                    "Failed to parse base package " + mResolvedBaseFile + ": " + e);
            throw PackageManagerException.from(e);
        }

        final List<String> splitPaths = new ArrayList<>();
+7 −0
Original line number Diff line number Diff line
@@ -16,6 +16,8 @@

package com.android.server.pm;

import android.content.pm.PackageParser.PackageParserException;

/** {@hide} */
public class PackageManagerException extends Exception {
    public final int error;
@@ -29,4 +31,9 @@ public class PackageManagerException extends Exception {
        super(detailMessage, throwable);
        this.error = error;
    }

    public static PackageManagerException from(PackageParserException e)
            throws PackageManagerException {
        throw new PackageManagerException(e.error, e.getMessage(), e.getCause());
    }
}
+2 −4
Original line number Diff line number Diff line
@@ -4162,8 +4162,7 @@ public class PackageManagerService extends IPackageManager.Stub {
            pp.collectCertificates(pkg, parseFlags);
            pp.collectManifestDigest(pkg);
        } catch (PackageParserException e) {
            throw new PackageManagerException(e.error, "Failed to collect certificates for "
                    + pkg.packageName + ": " + e.getMessage());
            throw PackageManagerException.from(e);
        }
    }
@@ -4188,8 +4187,7 @@ public class PackageManagerService extends IPackageManager.Stub {
        try {
            pkg = pp.parsePackage(scanFile, parseFlags);
        } catch (PackageParserException e) {
            throw new PackageManagerException(e.error,
                    "Failed to scan " + scanFile + ": " + e.getMessage());
            throw PackageManagerException.from(e);
        }
        PackageSetting ps = null;