[ActivityManager] Prevent potential deadlock from system error dialog and InputMethodManager.
Sympton: When application crash in a special timing and system server's InputMethodManager is binding, deadlock may occur. Root Cause: Thread(1): When using InputMethodManager in system server, it will lock mH(handler) of InputMethodManager, and sometimes it will call to InputMethodManagerService::showCurrentInputLocked and will call bindService at some condition, then it will also lock ActivityManagerService. Thread(2): When an application crashed, it will lock ActivityManager when showing crash dialog, inside the dialog, it will call setEnabled of Button and lock mH of InputMethodManager.setEnable of TextView will lock IMM's handler. So the deadlock happened as the flow: (2) lock AMS -> (1)lock mH -> (2)wait mH -> (1) wait AMS Solution: Reduce nested lock of error dialog: post message to let (2) lock mH after release AMS lock. Change-Id: Id85c29406236db3b5fca9655fde1fcaf0afd1337
Loading
Please register or sign in to comment