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
Loading
Please register or sign in to comment