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

Commit fa1886fe authored by Gopal Krishna Shukla's avatar Gopal Krishna Shukla Committed by Yohei Yukawa
Browse files

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
parent 9d9cf5b3
Loading
Loading
Loading
Loading
+4 −6
Original line number Original line Diff line number Diff line
@@ -2053,14 +2053,12 @@ public final class InputMethodManager {
     * have any input method subtype.
     * have any input method subtype.
     */
     */
    public InputMethodSubtype getCurrentInputMethodSubtype() {
    public InputMethodSubtype getCurrentInputMethodSubtype() {
        synchronized (mH) {
        try {
        try {
            return mService.getCurrentInputMethodSubtype();
            return mService.getCurrentInputMethodSubtype();
        } catch (RemoteException e) {
        } catch (RemoteException e) {
            throw e.rethrowFromSystemServer();
            throw e.rethrowFromSystemServer();
        }
        }
    }
    }
    }


    /**
    /**
     * Switch to a new input method subtype of the current input method.
     * Switch to a new input method subtype of the current input method.