From 961c7efbb0e06ce5f54a4ca23aeb6b5b4764408a Mon Sep 17 00:00:00 2001 From: Nikita Ioffe Date: Thu, 2 Apr 2020 22:17:19 +0100 Subject: [PATCH] Improve exception in validate{Apex,Apk}InstallLocked * Mention session id; * Mention stageDir; This won't help with b/152793689, but should help debugging similar issues in the future. Test: builds Bug: 152793689 Change-Id: Ie6ac43764ae082a4805941fafb07bd841e422630 --- .../com/android/server/pm/PackageInstallerSession.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/services/core/java/com/android/server/pm/PackageInstallerSession.java b/services/core/java/com/android/server/pm/PackageInstallerSession.java index 1248ec01e0206..f07fa501d3a8e 100644 --- a/services/core/java/com/android/server/pm/PackageInstallerSession.java +++ b/services/core/java/com/android/server/pm/PackageInstallerSession.java @@ -1830,7 +1830,9 @@ public class PackageInstallerSession extends IPackageInstallerSession.Stub { throws PackageManagerException { final List addedFiles = getAddedApksLocked(); if (addedFiles.isEmpty()) { - throw new PackageManagerException(INSTALL_FAILED_INVALID_APK, "No packages staged"); + throw new PackageManagerException(INSTALL_FAILED_INVALID_APK, + String.format("Session: %d. No packages staged in %s", sessionId, + stageDir.getAbsolutePath())); } if (ArrayUtils.size(addedFiles) > 1) { @@ -1921,7 +1923,9 @@ public class PackageInstallerSession extends IPackageInstallerSession.Stub { final List addedFiles = getAddedApksLocked(); if (addedFiles.isEmpty() && removeSplitList.size() == 0) { - throw new PackageManagerException(INSTALL_FAILED_INVALID_APK, "No packages staged"); + throw new PackageManagerException(INSTALL_FAILED_INVALID_APK, + String.format("Session: %d. No packages staged in %s", sessionId, + stageDir.getAbsolutePath())); } // Verify that all staged packages are internally consistent