Ensure the MagThumbnail view is always inflated on the main thread.
I believe this is one cause of deadlock, in addition to going against
best practice that View inflation should only run on the main thread.
At the same time:
(1a) android.bg thread: FullScreenMagnificationController locks
A11yManagerService.mLock when calling onUserStateChanged.
(1b) AudioService thread: AudioService locks A11yManager.mLock
when checking A11yManager.isTouchExplorationEnabled
Then, at the same time:
(2a) android.bg thread: FullScreenMagnificationController inflates
MagnificationThumbnail which is waiting to lock A11yManager.mLock
in order to check A11yManager.isEnabled
(2b) AudioService thread: A11yManager.isTouchExplorationEnabled is
waiting to lock A11yManagerService.mLock in order to register the
A11yManager client.
By posting the View inflation to the system_server main thread we allow
1a to release its A11yManagerService.mLock so that 2b can proceed, releasing A11yManager.mLock (locked in 1b) so that 2a can proceed.
Bug: 287127293
Test: Log the thread ID/label of the mag thumbnail layout inflation,
ensure it is the main thread
Change-Id: Ibe2574e5c83729d749befd343299fb26e3036037
Loading
Please register or sign in to comment