Merge "Prevent interleaved verification" into tm-qpr-dev

This commit is contained in:
Chun-Wei Wang
2022-11-22 12:28:40 +00:00
committed by Android (Google) Code Review

View File

@@ -366,6 +366,14 @@ public class PackageInstallerSession extends IPackageInstallerSession.Stub {
@GuardedBy("mLock")
private boolean mStageDirInUse = false;
/**
* True if the verification is already in progress. This is used to prevent running
* verification again while one is already in progress which will break internal states.
*
* Worker thread only.
*/
private boolean mVerificationInProgress = false;
/** Permissions have been accepted by the user (see {@link #setPermissionsResult}) */
@GuardedBy("mLock")
private boolean mPermissionsManuallyAccepted = false;
@@ -2136,6 +2144,12 @@ public class PackageInstallerSession extends IPackageInstallerSession.Stub {
return;
}
if (mVerificationInProgress) {
Slog.w(TAG, "Verification is already in progress for session " + sessionId);
return;
}
mVerificationInProgress = true;
if (params.isStaged) {
mStagedSession.verifySession();
} else {