Make sure session.abandon() will abort apex session
In this change, two races are handled to make sure that apex session is aborted correctly. 1. session.abandon() is called before marking it as ready. PackageSessionVerifier will mark the session as "ready" after the verification. Abandon() marks the session as "destroyed", marking it as ready can fail, which results in failing to call either of markStagedSessionReady() or abortStagedSession() of IApexService. PackageSessionVerifier now throws an exception when it fails to mark the session as ready so that the exception handler can ensure the active session is aborted (calling abortStagedSession()). 2. session.abandon() is called just before dispatchPendingAbandonCallback() The session (and its apex session) is marked "ready". However, the sesion is not yet added to StagingManager. Hence, even though abandon() calls StagingManager.abortCommitedSession(), StagingManager does nothing because it doesn't know the session. (Not aborted) In this change, StagingManager makes sure that the apex session is aborted. Note that these two races don't cause any severe problem now, but leave the two session data (PM sessions and APEX sessions) out of sync. This prevented adding check like ag/34097710. Bug: 425478146 Flag: EXEMPT BUGFIX Test: StagedInstallInternalTest, StagingManagerTest Change-Id: Id41c6e493e3f5e4de78b3e9d240e6222182238eb
Loading
Please register or sign in to comment