Android input子系统

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)

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值