Skip to content
Commit 383b57ab authored by Kevin Chyn's avatar Kevin Chyn
Browse files

Synchronize DeviceStateController on WindowManagerGlobalLock

The existing way of synchronizing on DeviceStateController.this is
prone to deadlocks. For example, this sequence of events will result in
a deadlock.

ThreadA: 1) Acquire WindowManagerGlobalLock
         4) Acquire DeviceStateController.this

ThreadB) 2) Acquire DeviceStateController.this
         3) Acquire WindowManagerGlobalLock

Instead of using DeviceStateController.this as a lock, we should just
use the existing WindowManagerGlobalLock like the rest of WM code.
This way, since all locking is done on the same global lock, there
shouldn't be a way for this deadlock to occur anymore.

Also, put work onto WindowManagerService's handler so that
DeviceStateController's lock when invoking callbacks is short.

Fixes: 281653024
Test: presubmit
Change-Id: I3c0086856c245a01c951d295a040c93c82c8a485
parent 0f6b4e23
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