Loading core/java/android/content/pm/PackageParser.java +4 −1 Original line number Diff line number Diff line Loading @@ -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); } Loading services/core/java/com/android/server/pm/PackageInstallerSession.java +3 −6 Original line number Diff line number Diff line Loading @@ -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)) { Loading Loading @@ -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); Loading Loading @@ -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<>(); Loading services/core/java/com/android/server/pm/PackageManagerException.java +7 −0 Original line number Diff line number Diff line Loading @@ -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; Loading @@ -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()); } } services/core/java/com/android/server/pm/PackageManagerService.java +2 −4 Original line number Diff line number Diff line Loading @@ -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); } } Loading @@ -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; Loading Loading
core/java/android/content/pm/PackageParser.java +4 −1 Original line number Diff line number Diff line Loading @@ -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); } Loading
services/core/java/com/android/server/pm/PackageInstallerSession.java +3 −6 Original line number Diff line number Diff line Loading @@ -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)) { Loading Loading @@ -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); Loading Loading @@ -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<>(); Loading
services/core/java/com/android/server/pm/PackageManagerException.java +7 −0 Original line number Diff line number Diff line Loading @@ -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; Loading @@ -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()); } }
services/core/java/com/android/server/pm/PackageManagerService.java +2 −4 Original line number Diff line number Diff line Loading @@ -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); } } Loading @@ -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; Loading