adb shell getevent
adb shell getevent -l
adb shell input keyevent keyCode (19UP 20DOWN 21LEFT 22 RIGHT 23 Enter/OK 4BACK 3HOME)
cat /proc/bus/input/devices
ls -l /sys/class/input
ls -l /dev/input/
Linux驱动层获取硬件按键事件消息将其发送Native,
EventHub会把它转换成android Framework对应event(EventHub是读取/dev/input/event*来判断是否有新事件发生,如果有通知给InputReader),这个转化是根据kl文件进行的。
kl文件通常放在/vendor/usr/keylayout, /system/usr/keylayout
WindowManangerService(WMS)分配事件到具体的某个应用来处理
蓝牙HID Host
https://blog.csdn.net/YingbinLi/article/details/127275146
https://blog.csdn.net/YingbinLi/article/details/127275040
https://blog.csdn.net/YingbinLi/article/details/127275072
https://blog.csdn.net/YingbinLi/article/details/127275098
写入到节点/dev/uhid调用过程(bta_hh_co.cc)
bta_hh_co_open
bta_hh_co_send_hid_info
bta_hh_co_data
bta_hh_co_write
关于长按时间 连按时间
/frameworks/base/core/java/android/view/ViewConfiguration.java
*
* Defines the default duration in milliseconds before a press turns into
* a long press
*/
private static final int DEFAULT_LONG_PRESS_TIMEOUT = 400;
/**
* Defines the default duration in milliseconds between the first tap's up event and the second
* tap's down event for an interaction to be considered part of the same multi-press.
*/
private static final int DEFAULT_MULTI_PRESS_TIMEOUT = 300;
/**
* Defines the time between successive key repeats in milliseconds.
*/
private static final int KEY_REPEAT_DELAY = 50;
如果按下(press, down)的时间和释放(release, up)时间超过DEFAULT_LONG_PRESS_TIMEOUT,就认为是长按, 如果再次超过了,就认为多次按(连按)。
比如press 是0.000毫秒, release是0.600毫秒,那么出现了一次长按,多次连按(0.45, 0.5,0.55,0.6)