Does adb shell input text mimic soft keyboard input?

adb shell input text "sometext" 

OR

 adb shell input keyevent eventid 

simulate the actual input from the virtual / hardware keyboard, respectively?

I did not find any documentation for these teams on developer.android.com/

Is there any trusted documentation for these commands?

+5
source share
2 answers

adb shell input help produces (after a long list of input devices):

 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) 

So, it seems that the "text" is really virtual (default: touch) and keyevent for the physical (default: keyboard).

You can override the text input device - adb shell input keyboard text "foo" works fine. You cannot send raw key codes from the screen.

+2
source

There is a good description here for the "adb shell input *" commands.

There are various key codes available for the adb shell keyevent commands.

0
source

Source: https://habr.com/ru/post/1202319/


All Articles