public final boolean onKeyDown(final int n, final KeyEvent keyEvent) { if (n == 4 || (this.g == 2 && n != 0 && !keyEvent.isSystem())) { this.onDestroy(); return true; } if (this.t != null) { return this.t.onKeyDown(n, keyEvent); } return super.onKeyDown(n, keyEvent); }
boolean translateAndSendNativeEvents(KeyEvent event) { if (mNativeImeAdapterAndroid == 0) return false; int action = event.getAction(); if (action != KeyEvent.ACTION_DOWN && action != KeyEvent.ACTION_UP) { // action == KeyEvent.ACTION_MULTIPLE // TODO(bulach): confirm the actual behavior. Apparently: // If event.getKeyCode() == KEYCODE_UNKNOWN, we can send a // composition key down (229) followed by a commit text with the // string from event.getUnicodeChars(). // Otherwise, we'd need to send an event with a // WebInputEvent::IsAutoRepeat modifier. We also need to verify when // we receive ACTION_MULTIPLE: we may receive it after an ACTION_DOWN, // and if that's the case, we'll need to review when to send the Char // event. return false; } // Begin add by TCL zhanghangzhi, mail: [email protected] if (event.getKeyCode() == KeyEvent.KEYCODE_DPAD_CENTER && (event.getFlags() & KeyEvent.FLAG_FROM_SYSTEM) != 0) { android.os.SystemProperties.set( "webviewchromium.tv_enterKeyFlag", String.valueOf(event.getFlags())); android.util.Log.e("ImeAdapter", "[ESTALENT] sys.tv_enterKeyFlag: " + event.getFlags()); } else { android.os.SystemProperties.set("webviewchromium.tv_enterKeyFlag", ""); android.util.Log.e("ImeAdapter", "[ESTALENT] clean sys.tv_enterKeyFlag"); } // End of TCL mViewEmbedder.onImeEvent(false); return nativeSendKeyEvent( mNativeImeAdapterAndroid, event, event.getAction(), getModifiers(event.getMetaState()), event.getEventTime(), event.getKeyCode(), event.isSystem(), event.getUnicodeChar()); }