Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a4ef9e0e authored by JW Wang's avatar JW Wang Committed by Songchun Fan
Browse files

Don't abandon child sessions (1/n)

It will throw if abandon() is called on a child session.

Bug: 211944991
Bug: 67862680
Test: to be added
Change-Id: Ib0ba9f3786dda2d3174f3ea8c65d1061a3fcb586
Merged-In: Ib0ba9f3786dda2d3174f3ea8c65d1061a3fcb586
(cherry picked from commit 8b67e7db)
parent 5e154e8d
Loading
Loading
Loading
Loading
+7 −1
Original line number Original line Diff line number Diff line
@@ -330,7 +330,13 @@ public class PackageInstallerService extends IPackageInstaller.Stub implements
                if (age >= MAX_SESSION_AGE_ON_LOW_STORAGE_MILLIS) {
                if (age >= MAX_SESSION_AGE_ON_LOW_STORAGE_MILLIS) {
                    // Aggressively close old sessions because we are running low on storage
                    // Aggressively close old sessions because we are running low on storage
                    // Their staging dirs will be removed too
                    // Their staging dirs will be removed too
                    session.abandon();
                    PackageInstallerSession root = !session.hasParentSessionId()
                            ? session : mSessions.get(session.getParentSessionId());
                    if (!root.isDestroyed() && 
                            (!root.isStaged() || (root.isStaged() && root.isStagedSessionReady()))) 
                    {
                        root.abandon();
                    }
                } else {
                } else {
                    // Session is new enough, so it deserves to be kept even on low storage
                    // Session is new enough, so it deserves to be kept even on low storage
                    unclaimedStagingDirsOnVolume.remove(session.stageDir);
                    unclaimedStagingDirsOnVolume.remove(session.stageDir);