Do not eat escape key events in onKeyPreIme()

The original reason for intercepting the escape key in onKeyPreIme()
was to prevent the escape key as being treated as the Back key before
reaching onKeyDown().

This seems no long necessary, and may mess up handling the ...+1
combination for escape on the Google Pixel C keyboard (see #27).
This commit is contained in:
Fredrik Fornwall
2015-12-25 21:10:48 +01:00
parent dd38965c46
commit e006e36dd0

View File

@@ -491,9 +491,8 @@ public final class TerminalView extends View {
@Override
public boolean onKeyPreIme(int keyCode, KeyEvent event) {
if (LOG_KEY_EVENTS) Log.i(EmulatorDebug.LOG_TAG, "onKeyPreIme(keyCode=" + keyCode + ", event=" + event + ")");
if (keyCode == KeyEvent.KEYCODE_ESCAPE || (keyCode == KeyEvent.KEYCODE_BACK && mOnKeyListener.shouldBackButtonBeMappedToEscape())) {
// Handle the escape key ourselves to avoid the system from treating it as back key
// and e.g. close keyboard.
if (keyCode == KeyEvent.KEYCODE_BACK && mOnKeyListener.shouldBackButtonBeMappedToEscape()) {
// Intercept back button to treat it as escape:
switch (event.getAction()) {
case KeyEvent.ACTION_DOWN:
return onKeyDown(keyCode, event);