Merge "Don't abandon child sessions (1/n)" into sc-v2-dev am: 24589d96ca

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/16571422

Change-Id: Ie4cd1f0771f576a8e2276016d7b8379bc63e1fe2
This commit is contained in:
Songchun Fan
2022-01-11 22:16:24 +00:00
committed by Automerger Merge Worker

View File

@@ -392,7 +392,11 @@ public class PackageInstallerService extends IPackageInstaller.Stub implements
if (age >= MAX_SESSION_AGE_ON_LOW_STORAGE_MILLIS) {
// Aggressively close old sessions because we are running low on storage
// Their staging dirs will be removed too
session.abandon();
PackageInstallerSession root = !session.hasParentSessionId()
? session : mSessions.get(session.getParentSessionId());
if (!root.isDestroyed()) {
root.abandon();
}
} else {
// Session is new enough, so it deserves to be kept even on low storage
unclaimedStagingDirsOnVolume.remove(session.stageDir);