Skip to content
Commit 3aa1f5aa authored by Mohammad Samiul Islam's avatar Mohammad Samiul Islam
Browse files

Fix deadlock in StagingManager.getSessions() method

When we stage a session we acquire the PackageInstallerSession#mLock
first and then StagingManager#mStagedSessions lock. But in getSessions()
method, we acquire the locks in reverse order which can lead to
deadlock: we first acquire StagingManager#mStagedSessions in
getSessions() and then while checking if session is destroyed, we
acquire PackageInstallerSession#mLock in isDestroyed() method.

By moving the staged session retrieval logic to PackageInstallerService,
we avoid acquiring the StagingManager#mStagedSession lock. This avoids
deadlock.

Bug: 160113544
Test: atest StagedInstallTest
Change-Id: I7a1abf44db27d4673d43e9b0886610a5bd8b41f6
Merged-In: I7a1abf44db27d4673d43e9b0886610a5bd8b41f6
(cherry picked from commit c45b6a14)
parent 5a293b8e
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment