Clean up staged session data on validation failure

Bug: 173132101
Test: manual test using `adb install --staged foo.apk` multiple times
Test: manual test using `adb install-multi-package --staged foo.apk bar.apk`
Change-Id: Idd6597cd0d2dda34a8a7626b585401eeee39c31f
Merged-In: Idd6597cd0d2dda34a8a7626b585401eeee39c31f
(cherry picked from commit f54412183a)
This commit is contained in:
Mohammad Samiul Islam
2020-11-13 17:32:05 +00:00
parent 9aaffcb759
commit 58432ac699

View File

@@ -881,6 +881,12 @@ public class PackageInstallerSession extends IPackageInstallerSession.Stub {
+ mParentSessionId + " and may not be committed directly.");
}
if (!markAsCommitted(statusReceiver, forTransfer)) {
if (isStaged()) {
// cleanStageDir calls mSessionProvider to get hold of child sessions, which in turn
// needs PackageInstallerService#mSessions lock. So we should not call cleanStageDir
// while holding mLock to avoid lock inversion.
cleanStageDir();
}
return;
}
if (isMultiPackage()) {