From 0274c1b0f9868c176a5f880bf43c479e88543fab Mon Sep 17 00:00:00 2001 From: Songchun Fan Date: Mon, 30 Jan 2023 14:59:11 -0800 Subject: [PATCH] [pm] properly clean up early install failures Basically a no-op, but still worth fixing to avoid confusions. Currently we don't cleanup the code path if the early install stages fail. The issue was there even before ag/19246346, so I am not sure if it's a recent regression. Most of the time, install failure is from copyApk, which means it doesn't matter if we don't clean up the code path, as it will be empty anyway. The other failure case would be if copyNativeBinariesWithOverride fails, but if it does, the verify() stage of the installation would have failed too, so we wouldn't come to this code path anyway. BUG: 259470449 Test: manual Change-Id: I378268bb39bc0d6ab8b301225720273ec100bba4 --- .../core/java/com/android/server/pm/InstallingSession.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/services/core/java/com/android/server/pm/InstallingSession.java b/services/core/java/com/android/server/pm/InstallingSession.java index 7b759e3cfadbe..43c0e050096a6 100644 --- a/services/core/java/com/android/server/pm/InstallingSession.java +++ b/services/core/java/com/android/server/pm/InstallingSession.java @@ -525,13 +525,13 @@ class InstallingSession { } private void processApkInstallRequests(boolean success, List installRequests) { - if (success) { + if (!success) { for (InstallRequest request : installRequests) { if (request.getReturnCode() != PackageManager.INSTALL_SUCCEEDED) { cleanUpForFailedInstall(request); } } - + } else { mInstallPackageHelper.installPackagesTraced(installRequests); for (InstallRequest request : installRequests) {