adb shell input text "sometext"
OR
adb shell input keyevent eventid
do these simulate actual input from a virtual/ hardware keyboard respectively ?
I did not find any documentation for these commands on developer.android.com/
Is there any trusted documentation for these commands?
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 "text" is indeed for virtual (Default: touchscreen) and keyevent for physical (Default: keyboard).
You can override the text input device - adb shell input keyboard text "foo"
works just fine. You can't send raw keycodes from the screen though.