Merge "Fix Keyboard.getKey as thread safe"
commit
7aeb7ef1ab
|
@ -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) {
|
||||
|
|
Loading…
Reference in New Issue