Prevent interleaved verification
Committing a session twice in a row will result in interleaved
verification flows and break the internal states.
Add a field to prevent this from happening if the verification
is already in progress.
Bug: 256330705
Test: manual test
Change-Id: I7e8a2fa7333d05a226268b325338e3fac69ddae0
Merged-In: I7e8a2fa7333d05a226268b325338e3fac69ddae0
(cherry picked from commit da7d72d88b)
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user