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
This commit is contained in:
@@ -380,6 +380,14 @@ public class PackageInstallerSession extends IPackageInstallerSession.Stub {
|
|||||||
@GuardedBy("mLock")
|
@GuardedBy("mLock")
|
||||||
private boolean mStageDirInUse = false;
|
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}) */
|
/** Permissions have been accepted by the user (see {@link #setPermissionsResult}) */
|
||||||
@GuardedBy("mLock")
|
@GuardedBy("mLock")
|
||||||
private boolean mPermissionsManuallyAccepted = false;
|
private boolean mPermissionsManuallyAccepted = false;
|
||||||
@@ -2201,6 +2209,12 @@ public class PackageInstallerSession extends IPackageInstallerSession.Stub {
|
|||||||
activate();
|
activate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (mVerificationInProgress) {
|
||||||
|
Slog.w(TAG, "Verification is already in progress for session " + sessionId);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
mVerificationInProgress = true;
|
||||||
|
|
||||||
if (params.isStaged) {
|
if (params.isStaged) {
|
||||||
mStagedSession.verifySession();
|
mStagedSession.verifySession();
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user