From fa1886feea55785f413f5efcd86bccca92f26759 Mon Sep 17 00:00:00 2001 From: Gopal Krishna Shukla Date: Thu, 30 Jun 2016 11:34:21 +0530 Subject: 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 --- core/java/android/view/inputmethod/InputMethodManager.java | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/core/java/android/view/inputmethod/InputMethodManager.java b/core/java/android/view/inputmethod/InputMethodManager.java index 4013b30fce06..0b7ac88c6925 100644 --- a/core/java/android/view/inputmethod/InputMethodManager.java +++ b/core/java/android/view/inputmethod/InputMethodManager.java @@ -2053,12 +2053,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(); } } -- cgit v1.2.3-59-g8ed1b