am d5e869ce
: Merge "Track handled events to consistently return handled status (C1)"
* commit 'd5e869ced838454ede1d813d6a289fafc31b0665': Track handled events to consistently return handled status (C1)
This commit is contained in:
commit
db31867678
1 changed files with 12 additions and 1 deletions
|
@ -82,6 +82,7 @@ import java.io.FileDescriptor;
|
|||
import java.io.PrintWriter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Locale;
|
||||
import java.util.TreeSet;
|
||||
|
||||
/**
|
||||
* Input method implementation for Qwerty'ish keyboard.
|
||||
|
@ -167,6 +168,7 @@ public final class LatinIME extends InputMethodService implements KeyboardAction
|
|||
private int mDeleteCount;
|
||||
private long mLastKeyTime;
|
||||
private int mActionId;
|
||||
private TreeSet<Long> mCurrentlyPressedHardwareKeys = CollectionUtils.newTreeSet();
|
||||
|
||||
// Member variables for remembering the current device orientation.
|
||||
private int mDisplayOrientation;
|
||||
|
@ -721,6 +723,7 @@ public final class LatinIME extends InputMethodService implements KeyboardAction
|
|||
resetComposingState(true /* alsoResetLastComposedWord */);
|
||||
mDeleteCount = 0;
|
||||
mSpaceState = SPACE_STATE_NONE;
|
||||
mCurrentlyPressedHardwareKeys.clear();
|
||||
|
||||
if (mSuggestionStripView != null) {
|
||||
// This will set the punctuation suggestions if next word suggestion is off;
|
||||
|
@ -2429,12 +2432,20 @@ public final class LatinIME extends InputMethodService implements KeyboardAction
|
|||
// onHardwareKeyEvent, like onKeyDown returns true if it handled the event, false if
|
||||
// it doesn't know what to do with it and leave it to the application. For example,
|
||||
// hardware key events for adjusting the screen's brightness are passed as is.
|
||||
if (mEventInterpreter.onHardwareKeyEvent(event)) return true;
|
||||
if (mEventInterpreter.onHardwareKeyEvent(event)) {
|
||||
final long keyIdentifier = event.getDeviceId() << 32 + event.getKeyCode();
|
||||
mCurrentlyPressedHardwareKeys.add(keyIdentifier);
|
||||
return true;
|
||||
}
|
||||
return super.onKeyDown(keyCode, event);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onKeyUp(final int keyCode, final KeyEvent event) {
|
||||
final long keyIdentifier = event.getDeviceId() << 32 + event.getKeyCode();
|
||||
if (mCurrentlyPressedHardwareKeys.remove(keyIdentifier)) {
|
||||
return true;
|
||||
}
|
||||
return super.onKeyUp(keyCode, event);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue