diff options
author | Jeff Brown <jeffbrown@google.com> | 2010-09-27 14:52:15 -0700 |
---|---|---|
committer | Jeff Brown <jeffbrown@google.com> | 2010-09-27 16:10:17 -0700 |
commit | e65041225ec0bbc3d67a3b70cdc6d598a5760043 (patch) | |
tree | 8eb92db22f21de0a2843aa39b9988d15e00233d9 /services/java | |
parent | 464fb74e28b6d76d5e741abcdbb714eea2d9b4d1 (diff) | |
download | frameworks_base-e65041225ec0bbc3d67a3b70cdc6d598a5760043.zip frameworks_base-e65041225ec0bbc3d67a3b70cdc6d598a5760043.tar.gz frameworks_base-e65041225ec0bbc3d67a3b70cdc6d598a5760043.tar.bz2 |
Add support for transferring touch focus.
Prerequisite for drag and drop.
Change-Id: Iedbe93ed0f3e1c4083130fe66b4ba06d416afce0
Diffstat (limited to 'services/java')
-rw-r--r-- | services/java/com/android/server/InputManager.java | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/services/java/com/android/server/InputManager.java b/services/java/com/android/server/InputManager.java index 29ca9a4..fe306b3 100644 --- a/services/java/com/android/server/InputManager.java +++ b/services/java/com/android/server/InputManager.java @@ -77,6 +77,8 @@ public class InputManager { private static native InputDevice nativeGetInputDevice(int deviceId); private static native void nativeGetInputConfiguration(Configuration configuration); private static native int[] nativeGetInputDeviceIds(); + private static native boolean nativeTransferTouchFocus(InputChannel fromChannel, + InputChannel toChannel); private static native String nativeDump(); // Input event injection constants defined in InputDispatcher.h. @@ -320,6 +322,29 @@ public class InputManager { nativeSetInputDispatchMode(enabled, frozen); } + /** + * Atomically transfers touch focus from one window to another as identified by + * their input channels. It is possible for multiple windows to have + * touch focus if they support split touch dispatch + * {@link android.view.WindowManager.LayoutParams#FLAG_SPLIT_TOUCH} but this + * method only transfers touch focus of the specified window without affecting + * other windows that may also have touch focus at the same time. + * @param fromChannel The channel of a window that currently has touch focus. + * @param toChannel The channel of the window that should receive touch focus in + * place of the first. + * @return True if the transfer was successful. False if the window with the + * specified channel did not actually have touch focus at the time of the request. + */ + public boolean transferTouchFocus(InputChannel fromChannel, InputChannel toChannel) { + if (fromChannel == null) { + throw new IllegalArgumentException("fromChannel must not be null."); + } + if (toChannel == null) { + throw new IllegalArgumentException("toChannel must not be null."); + } + return nativeTransferTouchFocus(fromChannel, toChannel); + } + public void dump(PrintWriter pw) { String dumpStr = nativeDump(); if (dumpStr != null) { |