Each key press is described by a sequence of key events. A key press starts with a key event with ACTION_DOWN. If the key is held sufficiently long that it repeats, then the initial down is followed additional key events with ACTION_DOWN and a non-zero value for getRepeatCount(). The last key event is aACTION_UP for the key up. If the key press is canceled, the key up event will have the FLAG_CANCELED flag set.
Key events are generally accompanied by a key code (getKeyCode()), scan code (getScanCode()) and meta state (getMetaState()). Key code constants are defined in this class. Scan code constants are raw device-specific codes obtained from the OS and so are not generally meaningful to applications unless interpreted using the KeyCharacterMap. Meta states describe the pressed state of key modifiers such as META_SHIFT_ON or META_ALT_ON.
Key codes typically correspond one-to-one with individual keys on an input device. Many keys and key combinations serve quite different functions on different input devices so care must be taken when interpreting them. Always use the KeyCharacterMap associated with the input device when mapping keys to characters. Be aware that there may be multiple key input devices active at the same time and each will have its own key character map.
Key codes (numbers)
KEYCODE_0 Key code constant: '0' key.
KEYCODE_1 Key code constant: '1' key.
KEYCODE_2 Key code constant: '2' key.
KEYCODE_3 Key code constant: '3' key.
KEYCODE_4 Key code constant: '4' key.
KEYCODE_5 Key code constant: '5' key.
KEYCODE_6 Key code constant: '6' key.
KEYCODE_7 Key code constant: '7' key.
KEYCODE_8 Key code constant: '8' key.
KEYCODE_9 Key code constant: '9' key.
More key codes
adb.exe shell am start -a android.intent.action.VIEW tel:1
Start-Sleep -Seconds 5
adb shell input keyevent KEYCODE_2
adb shell input keyevent KEYCODE_3
adb shell input keyevent KEYCODE_4
adb shell input keyevent KEYCODE_ENTER