Don't set mDestroyed for a staged session

This CL fixes the race condition in b/161647423#comment1. No matter
setStagedSessionFailed() happens before or after destroyInternal(), it
will not cause a staged session to disappear (by setting mDestroyed).

In line with b/161647423#comment8, we want to keep staged sessions
until they
1. get expired
2. abandoned before reaching the terminal state

Bug: 161647423
Test: atest StagedInstallTest StagedInstallInternalTest
Change-Id: I41b7030451086602c8439b50e4362a36007a49cb
This commit is contained in:
JW Wang
2020-07-28 15:40:27 +08:00
parent 933072bdbd
commit 4e217ed3a3

View File

@@ -3402,7 +3402,7 @@ public class PackageInstallerSession extends IPackageInstallerSession.Stub {
private void destroyInternal() {
synchronized (mLock) {
mSealed = true;
if (!params.isStaged || isStagedAndInTerminalState()) {
if (!params.isStaged) {
mDestroyed = true;
}
// Force shut down all bridges