Remove synchronization from getCurrentInputMethodSubtype()

getCurrentInputMethodSubtype() acquires InputManagerService.mMethodMap
within its body. There seems to be no reason for holding
InputMethodManager.mH to call getCurrentInputMethodSubtype(). Holding mH
can cause potential deadlock b/w two threads acquiring mH and mMethodMap
in different orders.

Bug: 31247871
Bug: 31273203
Bug: b.android.com/218423
Change-Id: I20cf2c20f49b1b02c0f7a18257b49d4bcc081b5d
This commit is contained in:
Gopal Krishna Shukla
2016-06-30 11:34:21 +05:30
committed by Yohei Yukawa
parent b5cc0b55e3
commit d33c07550f

View File

@@ -2056,12 +2056,10 @@ public final class InputMethodManager {
* have any input method subtype.
*/
public InputMethodSubtype getCurrentInputMethodSubtype() {
synchronized (mH) {
try {
return mService.getCurrentInputMethodSubtype();
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
try {
return mService.getCurrentInputMethodSubtype();
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
}