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

Commit 8f6c603b authored by Tadashi G. Takaoka's avatar Tadashi G. Takaoka
Browse files

Fix Keyboard.getKey as thread safe

This is a follow up of Id962e670.

Change-Id: I9e8542bff9e8faf57f934051fe612463c99ad61f
parent e9a86e2c
Loading
Loading
Loading
Loading
+12 −10
Original line number Diff line number Diff line
@@ -185,6 +185,7 @@ public class Keyboard {
        if (code == CODE_UNSPECIFIED) {
            return null;
        }
        synchronized (mKeyCache) {
            final int index = mKeyCache.indexOfKey(code);
            if (index >= 0) {
                return mKeyCache.valueAt(index);
@@ -199,6 +200,7 @@ public class Keyboard {
            mKeyCache.put(code, null);
            return null;
        }
    }

    public boolean hasKey(Key aKey) {
        if (mKeyCache.indexOfValue(aKey) >= 0) {