最終更新:2016-07-04 (月) 13:23:24 (2852d)  

Android/input
Top / Android / input

usage

  • Usage: input [<source>] <command> [<arg>...]
    
    The sources are:
          mouse
          keyboard
          joystick
          touchnavigation
          touchpad
          trackball
          stylus
          dpad
          touchscreen
          gamepad
    
    The commands and default sources are:
          text <string> (Default: touchscreen)
          keyevent [--longpress] <key code number or name> ... (Default: keyboard)
          tap <x> <y> (Default: touchscreen)
          swipe <x1> <y1> <x2> <y2> [duration(ms)] (Default: touchscreen)
          press (Default: trackball)
          roll <dx> <dy> (Default: trackball)

ソースコード

スクリプト

  • AOSP/frameworks/base/cmds/input/input
    # Script to start "input" on the device, which has a very rudimentary
    # shell.
    #
    base=/system
    export CLASSPATH=$base/framework/input.jar
    exec app_process $base/bin com.android.commands.input.Input $*

クラス

使い方

Android 4.4

  • Usage: input [<source>] <command> [<arg>...]
    
    The sources are:
    
    The commands and default sources are:
          text <string> (Default: touchscreen)
          keyevent [--longpress] <key code number or name> ... (Default: : keyboard)
          tap <x> <y> (Default: touchscreen)
          swipe <x1> <y1> <x2> <y2> [duration(ms)]  (Default: touchscreen)
          press (Default: trackball)
          roll <dx> <dy> (Default: trackball)

Android 4.3

  • usage: input ...
           input text <string>
           input keyevent <key code number or name>
           input [touchscreen|touchpad|touchnavigation] tap <x> <y>
           input [touchscreen|touchpad|touchnavigation] swipe <x1> <y1> <x2> <y2> [duration(ms)]
           input trackball press
           input trackball roll <dx> <dy>

Android 4.2

  • usage: input ...
           input text <string>
           input keyevent <key code number or name>
           input [touchscreen|touchpad] tap <x> <y>
           input [touchscreen|touchpad] swipe <x1> <y1> <x2> <y2>
           input trackball press
           input trackball roll <dx> <dy>

Android 4.1

  • usage: input ...
           input text <string>
           input keyevent <key code number or name>
           input tap <x> <y>
           input swipe <x1> <y1> <x2> <y2>

ソースコード

# Script to start "input" on the device, which has a very rudimentary
# shell.
#
base=/system
export CLASSPATH=$base/framework/input.jar
exec app_process $base/bin com.android.commands.input.Input $*

内部処理

キーイベント送信

input keyevent 3 # HOMEキー
input keyevent 4 # BACKキー
input keyevent 82 # MENUキー

関連コマンド

関連

ソースコード