Prevent deadlocks during VirtualDisplay creation
When creating a VirtualDisplay for a VirtualDevice, we need to do some extra work like setting up for input injection, creating a DisplayWindowPolicyController, and grabbing a wakelock to keep the display awake. Some parts of this extra work end up calling back into the DisplayManagerService from another thread, but since we're already holding the mSyncRoot lock we sometimes get into situations where those threads get blocked trying to acquire mSyncRoot, while holding a lock that another thread ends up needing like the global window manager one, so we get deadlock. The fix in this CL is to break up the extra work the VirtualDeviceManagerService needs to do into two parts: one part that happens before the VirtualDisplay is created, and one part after. Neither of these needs mSyncRoot to be held. Fixes: 230544802 Test: atest CreateVirtualDisplayTest Change-Id: I6a6e03f816567579510b3f1ef0705375549a3c88
Loading
Please register or sign in to comment