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

Commit 8554f62f authored by Yohei Yukawa's avatar Yohei Yukawa Committed by Android (Google) Code Review
Browse files

Merge "Remove redundant synchronization blocks from IMMS"

parents e3abed72 4e02bc6f
Loading
Loading
Loading
Loading
+28 −22
Original line number Diff line number Diff line
@@ -2085,8 +2085,9 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
        }
        synchronized (mMethodMap) {
            if (subtype != null) {
                setInputMethodWithSubtypeId(token, id, InputMethodUtils.getSubtypeIdFromHashCode(
                        mMethodMap.get(id), subtype.hashCode()));
                setInputMethodWithSubtypeIdLocked(token, id,
                        InputMethodUtils.getSubtypeIdFromHashCode(mMethodMap.get(id),
                                subtype.hashCode()));
            } else {
                setInputMethod(token, id);
            }
@@ -2173,7 +2174,7 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
                    Slog.d(TAG, "Switch to: " + lastImi.getId() + ", " + lastIme.second
                            + ", from: " + mCurMethodId + ", " + subtypeId);
                }
                setInputMethodWithSubtypeId(token, targetLastImiId, subtypeId);
                setInputMethodWithSubtypeIdLocked(token, targetLastImiId, subtypeId);
                return true;
            } else {
                return false;
@@ -2192,7 +2193,8 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
            if (nextSubtype == null) {
                return false;
            }
            setInputMethodWithSubtypeId(token, nextSubtype.mImi.getId(), nextSubtype.mSubtypeId);
            setInputMethodWithSubtypeIdLocked(token, nextSubtype.mImi.getId(),
                    nextSubtype.mSubtypeId);
            return true;
        }
    }
@@ -2317,6 +2319,11 @@ public class InputMethodManagerService extends IInputMethodManager.Stub

    private void setInputMethodWithSubtypeId(IBinder token, String id, int subtypeId) {
        synchronized (mMethodMap) {
            setInputMethodWithSubtypeIdLocked(token, id, subtypeId);
        }
    }

    private void setInputMethodWithSubtypeIdLocked(IBinder token, String id, int subtypeId) {
        if (token == null) {
            if (mContext.checkCallingOrSelfPermission(
                    android.Manifest.permission.WRITE_SECURE_SETTINGS)
@@ -2338,7 +2345,6 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
            Binder.restoreCallingIdentity(ident);
        }
    }
    }

    @Override
    public void hideMySoftInput(IBinder token, int flags) {