void invokeFinishedInputEventCallback(PendingEvent p, boolean handled) { p.mHandled = handled; if (p.mHandler.getLooper().isCurrentThread()) { // Already running on the callback handler thread so we can send the // callback immediately. p.run(); } else { // Post the event to the callback handler thread. // In this case, the callback will be responsible for recycling the event. Message msg = Message.obtain(p.mHandler, p); msg.setAsynchronous(true); msg.sendToTarget(); } }
at android.view.ViewRootImpl$ViewPostImeInputStage.processKeyEvent(ViewRootImpl.java:4152) at android.view.ViewRootImpl$ViewPostImeInputStage.onProcess(ViewRootImpl.java:4114) at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:3662) at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:3715) at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:3681) at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:3807) at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:3689) at android.view.ViewRootImpl$AsyncInputStage.apply(ViewRootImpl.java:3864) at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:3662) at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:3715) at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:3681) at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:3689) at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:3662) at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:3715) at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:3681) at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:3840) at android.view.ViewRootImpl$ImeInputStage.onFinishedInputEvent(ViewRootImpl.java:4006) at android.view.inputmethod.InputMethodManager$PendingEvent.run(InputMethodManager.java:2272) at android.view.inputmethod.InputMethodManager.invokeFinishedInputEventCallback(InputMethodManager.java:1893) at android.view.inputmethod.InputMethodManager.finishedInputEvent(InputMethodManager.java:1884) at android.view.inputmethod.InputMethodManager$ImeInputEventSender.onInputEventFinished(InputMethodManager.java:2249) at android.view.InputEventSender.dispatchInputEventFinished(InputEventSender.java:141)
private int processKeyEvent(QueuedInputEvent q) { ... // Deliver the key to the view hierarchy. if (mView.dispatchKeyEvent(event)) { return FINISH_HANDLED; } ... }
@Override public boolean dispatchKeyEvent(KeyEvent event) { final int keyCode = event.getKeyCode(); final int action = event.getAction(); final boolean isDown = action == KeyEvent.ACTION_DOWN;
if (isDown && (event.getRepeatCount() == 0)) { // First handle chording of panel key: if a panel key is held // but not released, try to execute a shortcut in it. if ((mPanelChordingKey > 0) && (mPanelChordingKey != keyCode)) { boolean handled = dispatchKeyShortcutEvent(event); if (handled) { return true; } }
// If a panel is open, perform a shortcut on it without the // chorded panel key if ((mPreparedPanel != null) && mPreparedPanel.isOpen) { if (performPanelShortcut(mPreparedPanel, keyCode, event, 0)) { return true; } } }
if (!isDestroyed()) { final Callback cb = getCallback(); final boolean handled = cb != null && mFeatureId < 0 ? cb.dispatchKeyEvent(event) : super.dispatchKeyEvent(event); if (handled) { return true; } }
public boolean dispatchKeyEvent(KeyEvent event) { onUserInteraction();
// Let action bars open menus in response to the menu key prioritized over // the window handling it if (event.getKeyCode() == KeyEvent.KEYCODE_MENU && mActionBar != null && mActionBar.onMenuKeyEvent(event)) { return true; }