Loading core/java/android/view/ViewRootImpl.java +27 −10 Original line number Diff line number Diff line Loading @@ -3398,16 +3398,7 @@ public final class ViewRootImpl implements ViewParent, public final void deliver(QueuedInputEvent q) { if ((q.mFlags & QueuedInputEvent.FLAG_FINISHED) != 0) { forward(q); } else if (mView == null || !mAdded) { Slog.w(TAG, "Dropping event due to root view being removed: " + q.mEvent); finish(q, false); } else if (!mAttachInfo.mHasWindowFocus && !q.mEvent.isFromSource(InputDevice.SOURCE_CLASS_POINTER) && !isTerminalInputEvent(q.mEvent)) { // If this is a focused event and the window doesn't currently have input focus, // then drop this event. This could be an event that came back from the previous // stage but the window has lost focus in the meantime. Slog.w(TAG, "Dropping event due to no window focus: " + q.mEvent); } else if (shouldDropInputEvent(q)) { finish(q, false); } else { apply(q, onProcess(q)); Loading Loading @@ -3466,6 +3457,22 @@ public final class ViewRootImpl implements ViewParent, } } protected boolean shouldDropInputEvent(QueuedInputEvent q) { if (mView == null || !mAdded) { Slog.w(TAG, "Dropping event due to root view being removed: " + q.mEvent); return true; } else if (!mAttachInfo.mHasWindowFocus && !q.mEvent.isFromSource(InputDevice.SOURCE_CLASS_POINTER) && !isTerminalInputEvent(q.mEvent)) { // If this is a focused event and the window doesn't currently have input focus, // then drop this event. This could be an event that came back from the previous // stage but the window has lost focus in the meantime. Slog.w(TAG, "Dropping event due to no window focus: " + q.mEvent); return true; } return false; } void dump(String prefix, PrintWriter writer) { if (mNext != null) { mNext.dump(prefix, writer); Loading Loading @@ -3851,6 +3858,10 @@ public final class ViewRootImpl implements ViewParent, return FINISH_HANDLED; } if (shouldDropInputEvent(q)) { return FINISH_NOT_HANDLED; } // If the Control modifier is held, try to interpret the key as a shortcut. if (event.getAction() == KeyEvent.ACTION_DOWN && event.isCtrlPressed() Loading @@ -3859,12 +3870,18 @@ public final class ViewRootImpl implements ViewParent, if (mView.dispatchKeyShortcutEvent(event)) { return FINISH_HANDLED; } if (shouldDropInputEvent(q)) { return FINISH_NOT_HANDLED; } } // Apply the fallback event policy. if (mFallbackEventHandler.dispatchKeyEvent(event)) { return FINISH_HANDLED; } if (shouldDropInputEvent(q)) { return FINISH_NOT_HANDLED; } // Handle automatic focus changes. if (event.getAction() == KeyEvent.ACTION_DOWN) { Loading Loading
core/java/android/view/ViewRootImpl.java +27 −10 Original line number Diff line number Diff line Loading @@ -3398,16 +3398,7 @@ public final class ViewRootImpl implements ViewParent, public final void deliver(QueuedInputEvent q) { if ((q.mFlags & QueuedInputEvent.FLAG_FINISHED) != 0) { forward(q); } else if (mView == null || !mAdded) { Slog.w(TAG, "Dropping event due to root view being removed: " + q.mEvent); finish(q, false); } else if (!mAttachInfo.mHasWindowFocus && !q.mEvent.isFromSource(InputDevice.SOURCE_CLASS_POINTER) && !isTerminalInputEvent(q.mEvent)) { // If this is a focused event and the window doesn't currently have input focus, // then drop this event. This could be an event that came back from the previous // stage but the window has lost focus in the meantime. Slog.w(TAG, "Dropping event due to no window focus: " + q.mEvent); } else if (shouldDropInputEvent(q)) { finish(q, false); } else { apply(q, onProcess(q)); Loading Loading @@ -3466,6 +3457,22 @@ public final class ViewRootImpl implements ViewParent, } } protected boolean shouldDropInputEvent(QueuedInputEvent q) { if (mView == null || !mAdded) { Slog.w(TAG, "Dropping event due to root view being removed: " + q.mEvent); return true; } else if (!mAttachInfo.mHasWindowFocus && !q.mEvent.isFromSource(InputDevice.SOURCE_CLASS_POINTER) && !isTerminalInputEvent(q.mEvent)) { // If this is a focused event and the window doesn't currently have input focus, // then drop this event. This could be an event that came back from the previous // stage but the window has lost focus in the meantime. Slog.w(TAG, "Dropping event due to no window focus: " + q.mEvent); return true; } return false; } void dump(String prefix, PrintWriter writer) { if (mNext != null) { mNext.dump(prefix, writer); Loading Loading @@ -3851,6 +3858,10 @@ public final class ViewRootImpl implements ViewParent, return FINISH_HANDLED; } if (shouldDropInputEvent(q)) { return FINISH_NOT_HANDLED; } // If the Control modifier is held, try to interpret the key as a shortcut. if (event.getAction() == KeyEvent.ACTION_DOWN && event.isCtrlPressed() Loading @@ -3859,12 +3870,18 @@ public final class ViewRootImpl implements ViewParent, if (mView.dispatchKeyShortcutEvent(event)) { return FINISH_HANDLED; } if (shouldDropInputEvent(q)) { return FINISH_NOT_HANDLED; } } // Apply the fallback event policy. if (mFallbackEventHandler.dispatchKeyEvent(event)) { return FINISH_HANDLED; } if (shouldDropInputEvent(q)) { return FINISH_NOT_HANDLED; } // Handle automatic focus changes. if (event.getAction() == KeyEvent.ACTION_DOWN) { Loading