diff options
author | Jeff Brown <jeffbrown@google.com> | 2012-05-09 17:35:28 -0700 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2012-05-09 17:35:28 -0700 |
commit | 995cb9739a04e7fe20c0a86c400db706b12cb221 (patch) | |
tree | 9c4ccaa5078ccd3891dd0f90a536cfbd326c9806 /cmds | |
parent | b3e9ee23795e6c7c4bc2c0a7e776b7ee34e8f08e (diff) | |
parent | ca13fed08bf38c2f2811b3ec3f995d0ca57ac6ac (diff) | |
download | frameworks_base-995cb9739a04e7fe20c0a86c400db706b12cb221.zip frameworks_base-995cb9739a04e7fe20c0a86c400db706b12cb221.tar.gz frameworks_base-995cb9739a04e7fe20c0a86c400db706b12cb221.tar.bz2 |
Merge "Empower the 'input' command with keycode labels." into jb-dev
Diffstat (limited to 'cmds')
-rwxr-xr-x | cmds/input/src/com/android/commands/input/Input.java | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/cmds/input/src/com/android/commands/input/Input.java b/cmds/input/src/com/android/commands/input/Input.java index fcf3c7e..341f30f 100755 --- a/cmds/input/src/com/android/commands/input/Input.java +++ b/cmds/input/src/com/android/commands/input/Input.java @@ -17,8 +17,6 @@ package com.android.commands.input; import android.hardware.input.InputManager; -import android.os.RemoteException; -import android.os.ServiceManager; import android.os.SystemClock; import android.util.Log; import android.view.InputDevice; @@ -59,7 +57,11 @@ public class Input { } } else if (command.equals("keyevent")) { if (args.length == 2) { - sendKeyEvent(Integer.parseInt(args[1])); + int keyCode = KeyEvent.keyCodeFromString(args[1]); + if (keyCode == KeyEvent.KEYCODE_UNKNOWN) { + keyCode = KeyEvent.keyCodeFromString("KEYCODE_" + args[1]); + } + sendKeyEvent(keyCode); return; } } else if (command.equals("tap")) { @@ -163,7 +165,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>"); + System.err.println(" input keyevent <key code number or name>"); System.err.println(" input tap <x> <y>"); System.err.println(" input swipe <x1> <y1> <x2> <y2>"); } |