Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Skip to content
Commit d0c879bc authored by Daniel Norman's avatar Daniel Norman
Browse files

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
parent 442bbb16
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