summaryrefslogtreecommitdiffstats
path: root/cmds
diff options
context:
space:
mode:
authorDiego Torres Milano <dtmilano@gmail.com>2013-04-04 13:44:34 -0400
committerGerrit Code Review <gerrit@cyanogenmod.org>2013-05-05 21:27:37 -0700
commitc8f8aa0e4bd1a78a7f7cd9fc2fbd98a3f6087de1 (patch)
tree22edf1365d49159797b065566ac622bc19127c5e /cmds
parent5e6c92e2fffd3406f2cbaa08f744e6189afcf484 (diff)
downloadframeworks_base-c8f8aa0e4bd1a78a7f7cd9fc2fbd98a3f6087de1.zip
frameworks_base-c8f8aa0e4bd1a78a7f7cd9fc2fbd98a3f6087de1.tar.gz
frameworks_base-c8f8aa0e4bd1a78a7f7cd9fc2fbd98a3f6087de1.tar.bz2
input: added support for multiple keyevents
- Multiple keyevents can now be send from the command line: input keyevent <key code number or name> ... Sometimes invoking 'input' repeatedly does not send the events fast enough, this change solves the problem by allowing multiple key code number or names be added to the command line. Change-Id: I0d0f34bddd99e0195c9badff2f8b3e2aa9a51737
Diffstat (limited to 'cmds')
-rw-r--r--cmds/input/src/com/android/commands/input/Input.java16
1 files changed, 9 insertions, 7 deletions
diff --git a/cmds/input/src/com/android/commands/input/Input.java b/cmds/input/src/com/android/commands/input/Input.java
index a21df0d..6dc9f3d 100644
--- a/cmds/input/src/com/android/commands/input/Input.java
+++ b/cmds/input/src/com/android/commands/input/Input.java
@@ -56,12 +56,14 @@ public class Input {
return;
}
} else if (command.equals("keyevent")) {
- if (args.length == 2) {
- int keyCode = KeyEvent.keyCodeFromString(args[1]);
- if (keyCode == KeyEvent.KEYCODE_UNKNOWN) {
- keyCode = KeyEvent.keyCodeFromString("KEYCODE_" + args[1]);
+ if (args.length >= 2) {
+ for (int i=1; i < args.length; i++) {
+ int keyCode = KeyEvent.keyCodeFromString(args[i]);
+ if (keyCode == KeyEvent.KEYCODE_UNKNOWN) {
+ keyCode = KeyEvent.keyCodeFromString("KEYCODE_" + args[i]);
+ }
+ sendKeyEvent(keyCode);
}
- sendKeyEvent(keyCode);
return;
}
} else if (command.equals("tap")) {
@@ -223,7 +225,7 @@ public class Input {
DEFAULT_META_STATE, DEFAULT_PRECISION_X, DEFAULT_PRECISION_Y, DEFAULT_DEVICE_ID,
DEFAULT_EDGE_FLAGS);
event.setSource(inputSource);
- Log.i("Input", "injectMotionEvent: " + event);
+ Log.i(TAG, "injectMotionEvent: " + event);
InputManager.getInstance().injectInputEvent(event,
InputManager.INJECT_INPUT_EVENT_MODE_WAIT_FOR_FINISH);
}
@@ -235,7 +237,7 @@ public class Input {
private void showUsage() {
System.err.println("usage: input ...");
System.err.println(" input text <string>");
- System.err.println(" input keyevent <key code number or name>");
+ System.err.println(" input keyevent <key code number or name> ...");
System.err.println(" input [touchscreen|touchpad] tap <x> <y>");
System.err.println(" input [touchscreen|touchpad] swipe <x1> <y1> <x2> <y2>");
System.err.println(" input trackball press");