summaryrefslogtreecommitdiffstats
path: root/services/java/com/android/server/WindowManagerService.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 /services/java/com/android/server/WindowManagerService.java
parent60029771d26ca3c51288c3d92cab1d3537147acd (diff)
downloadframeworks_base-3915bb845b032dc184dba5e60970b803390ca3ed.zip
frameworks_base-3915bb845b032dc184dba5e60970b803390ca3ed.tar.gz
frameworks_base-3915bb845b032dc184dba5e60970b803390ca3ed.tar.bz2
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 'services/java/com/android/server/WindowManagerService.java')
-rw-r--r--services/java/com/android/server/WindowManagerService.java28
1 files changed, 21 insertions, 7 deletions
diff --git a/services/java/com/android/server/WindowManagerService.java b/services/java/com/android/server/WindowManagerService.java
index c74a27c..1c92da9 100644
--- a/services/java/com/android/server/WindowManagerService.java
+++ b/services/java/com/android/server/WindowManagerService.java
@@ -824,13 +824,15 @@ public class WindowManagerService extends IWindowManager.Stub
DragState mDragState = null;
private final InputHandler mDragInputHandler = new BaseInputHandler() {
@Override
- public void handleMotion(MotionEvent event, Runnable finishedCallback) {
- boolean endDrag = false;
- final float newX = event.getRawX();
- final float newY = event.getRawY();
-
+ public void handleMotion(MotionEvent event, InputQueue.FinishedCallback finishedCallback) {
+ boolean handled = false;
try {
- if (mDragState != null) {
+ if ((event.getSource() & InputDevice.SOURCE_CLASS_POINTER) != 0
+ && mDragState != null) {
+ boolean endDrag = false;
+ final float newX = event.getRawX();
+ final float newY = event.getRawY();
+
switch (event.getAction()) {
case MotionEvent.ACTION_DOWN: {
if (DEBUG_DRAG) {
@@ -866,11 +868,13 @@ public class WindowManagerService extends IWindowManager.Stub
mDragState.endDragLw();
}
}
+
+ handled = true;
}
} catch (Exception e) {
Slog.e(TAG, "Exception caught by drag handleMotion", e);
} finally {
- finishedCallback.run();
+ finishedCallback.finished(handled);
}
}
};
@@ -5781,6 +5785,16 @@ public class WindowManagerService extends IWindowManager.Stub
keyCode, scanCode, metaState, repeatCount, policyFlags);
}
+ /* Provides an opportunity for the window manager policy to process a key that
+ * the application did not handle. */
+ public boolean dispatchUnhandledKey(InputChannel focus,
+ int action, int flags, int keyCode, int scanCode, int metaState, int repeatCount,
+ int policyFlags) {
+ WindowState windowState = getWindowStateForInputChannel(focus);
+ return mPolicy.dispatchUnhandledKey(windowState, action, flags,
+ keyCode, scanCode, metaState, repeatCount, policyFlags);
+ }
+
/* Called when the current input focus changes.
* Layer assignment is assumed to be complete by the time this is called.
*/