diff options
author | Jeff Brown <jeffbrown@google.com> | 2012-05-09 17:18:20 -0700 |
---|---|---|
committer | Jeff Brown <jeffbrown@google.com> | 2012-05-09 17:18:20 -0700 |
commit | ca13fed08bf38c2f2811b3ec3f995d0ca57ac6ac (patch) | |
tree | a9abe1bce747df20cc0eacfb2207d3b86f557415 /cmds/input | |
parent | 7873d5b3ff587ffff33dae628aaa581b099db61e (diff) | |
download | frameworks_base-ca13fed08bf38c2f2811b3ec3f995d0ca57ac6ac.zip frameworks_base-ca13fed08bf38c2f2811b3ec3f995d0ca57ac6ac.tar.gz frameworks_base-ca13fed08bf38c2f2811b3ec3f995d0ca57ac6ac.tar.bz2 |
Empower the 'input' command with keycode labels.
Change-Id: Ia077f8ee0732599cec9b04efc2f828d3d22f5bac
Diffstat (limited to 'cmds/input')
-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>"); } |