summaryrefslogtreecommitdiff
path: root/core/java/android/view/InputQueue.java
diff options
context:
space:
mode:
authorJeff Brown <jeffbrown@google.com>2010-11-05 15:02:16 -0700
committerJeff Brown <jeffbrown@google.com>2010-11-08 12:49:43 -0800
commit3915bb845b032dc184dba5e60970b803390ca3ed (patch)
tree198a47c1d4ada990ef04d563b5e0caaec35abc18 /core/java/android/view/InputQueue.java
parent60029771d26ca3c51288c3d92cab1d3537147acd (diff)
Tell system server whether the app handled input events.
Refactored ViewRoot, NativeActivity and related classes to tell the dispatcher whether an input event was actually handled by the application. This will be used to move more of the global default key processing into the system server instead of the application. Change-Id: If06b98b6f45c543e5ac5b1eae2b3baf9371fba28
Diffstat (limited to 'core/java/android/view/InputQueue.java')
-rw-r--r--core/java/android/view/InputQueue.java16
1 files changed, 10 insertions, 6 deletions
diff --git a/core/java/android/view/InputQueue.java b/core/java/android/view/InputQueue.java
index 9e800df1cb22..5735b6397cf0 100644
--- a/core/java/android/view/InputQueue.java
+++ b/core/java/android/view/InputQueue.java
@@ -53,7 +53,7 @@ public final class InputQueue {
private static native void nativeRegisterInputChannel(InputChannel inputChannel,
InputHandler inputHandler, MessageQueue messageQueue);
private static native void nativeUnregisterInputChannel(InputChannel inputChannel);
- private static native void nativeFinished(long finishedToken);
+ private static native void nativeFinished(long finishedToken, boolean handled);
/** @hide */
public InputQueue(InputChannel channel) {
@@ -116,18 +116,22 @@ public final class InputQueue {
@SuppressWarnings("unused")
private static void dispatchKeyEvent(InputHandler inputHandler,
KeyEvent event, long finishedToken) {
- Runnable finishedCallback = FinishedCallback.obtain(finishedToken);
+ FinishedCallback finishedCallback = FinishedCallback.obtain(finishedToken);
inputHandler.handleKey(event, finishedCallback);
}
@SuppressWarnings("unused")
private static void dispatchMotionEvent(InputHandler inputHandler,
MotionEvent event, long finishedToken) {
- Runnable finishedCallback = FinishedCallback.obtain(finishedToken);
+ FinishedCallback finishedCallback = FinishedCallback.obtain(finishedToken);
inputHandler.handleMotion(event, finishedCallback);
}
- private static class FinishedCallback implements Runnable {
+ /**
+ * A callback that must be invoked to when finished processing an event.
+ * @hide
+ */
+ public static final class FinishedCallback {
private static final boolean DEBUG_RECYCLING = false;
private static final int RECYCLE_MAX_COUNT = 4;
@@ -156,13 +160,13 @@ public final class InputQueue {
}
}
- public void run() {
+ public void finished(boolean handled) {
synchronized (sLock) {
if (mFinishedToken == -1) {
throw new IllegalStateException("Event finished callback already invoked.");
}
- nativeFinished(mFinishedToken);
+ nativeFinished(mFinishedToken, handled);
mFinishedToken = -1;
if (sRecycleCount < RECYCLE_MAX_COUNT) {