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

Commit 4e02bc6f authored by Yohei Yukawa's avatar Yohei Yukawa
Browse files

Remove redundant synchronization blocks from IMMS

This is a groundwork for the subsequent fix. It should not change
existing behavior.

BUG: 15420379
Change-Id: I6f81ec77e748a8c7c26ffa1f5faf39684b210ae4
parent 41eca132
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) {