Don't crash the system if there is broken precondition.

Bug: 257403361
Fixes: 257403361
Test: presubmit
Change-Id: Iabd2833fd590c8c5d49aeb6f8c0b538c0e2508c6
This commit is contained in:
Alex Buynytskyy
2022-11-17 01:23:27 +00:00
parent 184933690e
commit 4575d90020

View File

@@ -3711,7 +3711,9 @@ public class PackageInstallerSession extends IPackageInstallerSession.Stub {
private boolean dispatchPendingAbandonCallback() {
final Runnable callback;
synchronized (mLock) {
Preconditions.checkState(mStageDirInUse);
if (!mStageDirInUse) {
return false;
}
mStageDirInUse = false;
callback = mPendingAbandonCallback;
mPendingAbandonCallback = null;