问题现象:快速的交叉点击手机键盘上的两个按键,键盘上两个按键之间会显示连线
问题现象图片:
原因分析:android驱动层在使用TP的B协议上报点时,上报错误
说明:
1、android的TP点上报分A、B两个协议,目前大都使用B协议,区分A B协议的关键是B协议有ABS_MT_TRACKING_ID、ABS_MT_SLOT两个事件
2、B协议每个相关点都有唯一的ABS_MT_TRACKING_ID,加入在点击按键L,坐标值的上报规则为
a、每次触摸会上报点ABS_MT_SLOT 0 开始、ABS_MT_SLOT 1结束,如果当前获取x、y的坐标值与上一次有差异就上报,没有差异就只上报时间,不上报x y值,即本次复用上次的x y值
b、如果本次上报的点没有ABS_MT_TRACKING_ID字段,说明当前点与上一个点在同一条线上,在键盘上UI层会画出一条线,即复用上一次点的ABS_MT_TRACKING_ID值
问题复现,通过快速交叉点击按键A、L来复现问题
通过adb sheLL getevent -lt来获取坐标点
[ 16403.539058] /dev/input/event2: EV_ABS ABS_MT_SLOT 00000000 ---->按键的开始
[ 16403.539058] /dev/input/event2: EV_ABS ABS_MT_TRACKING_ID 00000229
[ 16403.539058] /dev/input/event2: EV_ABS ABS_MT_POSITION_X 00000292
[ 16403.539058] /dev/input/event2: EV_ABS ABS_MT_POSITION_Y 000004a3 ---->通过当前x y值确认是按键L
[ 16403.539058] /dev/input/event2: EV_ABS ABS_MT_TOUCH_MAJOR 0000000b
[ 16403.539058] /dev/input/event2: EV_ABS ABS_MT_PRESSURE 000003e8
[ 16403.539058] /dev/input/event2: EV_ABS ABS_MT_SLOT 00000001 ---->按键的结束
[ 16403.539058] /dev/input/event2: EV_ABS ABS_MT_TOUCH_MAJOR 00000000
[ 16403.539058] /dev/input/event2: EV_ABS ABS_MT_PRESSURE 00000000
[ 16403.539058] /dev/input/event2: EV_ABS ABS_MT_TRACKING_ID ffffffff
[ 16403.539058] /dev/input/event2: EV_SYN SYN_REPORT 00000000
[ 16403.555467] /dev/input/event2: EV_ABS ABS_MT_SLOT 00000000
[ 16403.555467] /dev/input/event2: EV_ABS ABS_MT_TOUCH_MAJOR 00000006
[ 16403.555467] /dev/input/event2: EV_SYN SYN_REPORT 00000000
[ 16403.588674] /dev/input/event2: EV_ABS ABS_MT_POSITION_X 0000027f ---->x值发生改变,y值没有变化,只上报x;由于27f与229像素点很近,当前点为按键L
[ 16403.588674] /dev/input/event2: EV_ABS ABS_MT_TOUCH_MAJOR 0000000e
[ 16403.588674] /dev/input/event2: EV_SYN SYN_REPORT 00000000
[ 16403.592238] /dev/input/event2: EV_ABS ABS_MT_POSITION_X 0000026d ---->x值发生改变,y值没有变化,只上报x;由于26d与229像素点很近,当前点为按键L
[ 16403.592238] /dev/input/event2: EV_SYN SYN_REPORT 00000000
[ 16403.605541] /dev/input/event2: EV_ABS ABS_MT_POSITION_X 00000210
[ 16403.605541] /dev/input/event2: EV_ABS ABS_MT_POSITION_Y 000004a4 ---->x y值发生改变,上报x y;由于210与229像素点很近,4a4与4a3像素点很近,当前点为按键L
[ 16403.605541] /dev/input/event2: EV_SYN SYN_REPORT 00000000
[ 16403.608557] /dev/input/event2: EV_ABS ABS_MT_POSITION_X 000001b3
[ 16403.608557] /dev/input/event2: EV_ABS ABS_MT_POSITION_Y 000004a6 ---->异常发生,当前点为按键A,但是没有重新生成一个新的ABS_MT_TRACKING_ID。x y值发生改变,上报x y;由于1b3与229像素点差异很大,4a6与4a3像素点很近,当前点为按键a,此时问题就发生了,就会在键盘上按键a与按键L之间显示一条线,这是由于tp底层误把按键a与按键L当做一个举例很近的点,以至于复用了按键L的ABS_MT_TRACKING_ID;对于按键a,底层应该重新生成一个新的ABS_MT_TRACKING_ID
[ 16403.608557] /dev/input/event2: EV_SYN SYN_REPORT 00000000
[ 16403.621768] /dev/input/event2: EV_ABS ABS_MT_POSITION_X 00000156
[ 16403.621768] /dev/input/event2: EV_ABS ABS_MT_POSITION_Y 000004a7 ---->按键a
[ 16403.621768] /dev/input/event2: EV_SYN SYN_REPORT 00000000
[ 16403.625514] /dev/input/event2: EV_ABS ABS_MT_POSITION_X 000000f9
[ 16403.625514] /dev/input/event2: EV_ABS ABS_MT_POSITION_Y 000004a8 ---->按键a
[ 16403.625514] /dev/input/event2: EV_SYN SYN_REPORT 00000000
[ 16403.638459] /dev/input/event2: EV_ABS ABS_MT_POSITION_X 000000ce ---->按键a
[ 16403.638459] /dev/input/event2: EV_SYN SYN_REPORT 00000000
[ 16403.642095] /dev/input/event2: EV_ABS ABS_MT_POSITION_X 000000a3
[ 16403.642095] /dev/input/event2: EV_ABS ABS_MT_POSITION_Y 000004a9 ---->按键a
[ 16403.642095] /dev/input/event2: EV_SYN SYN_REPORT 00000000
[ 16403.654719] /dev/input/event2: EV_ABS ABS_MT_POSITION_X 0000008f ---->按键a
[ 16403.654719] /dev/input/event2: EV_SYN SYN_REPORT 00000000
[ 16403.658492] /dev/input/event2: EV_ABS ABS_MT_POSITION_X 0000007c
[ 16403.658492] /dev/input/event2: EV_ABS ABS_MT_POSITION_Y 000004aa ---->按键a
[ 16403.658492] /dev/input/event2: EV_SYN SYN_REPORT 00000000
[ 16403.671351] /dev/input/event2: EV_ABS ABS_MT_POSITION_X 00000074 ---->按键a
[ 16403.671351] /dev/input/event2: EV_SYN SYN_REPORT 00000000
[ 16403.674974] /dev/input/event2: EV_ABS ABS_MT_POSITION_X 0000006c
[ 16403.674974] /dev/input/event2: EV_ABS ABS_MT_POSITION_Y 000004ab ---->按键a
[ 16403.674974] /dev/input/event2: EV_SYN SYN_REPORT 00000000
[ 16403.687883] /dev/input/event2: EV_ABS ABS_MT_POSITION_X 00000067 ---->按键a
[ 16403.687883] /dev/input/event2: EV_SYN SYN_REPORT 00000000
[ 16403.691960] /dev/input/event2: EV_ABS ABS_MT_POSITION_X 00000063
[ 16403.691960] /dev/input/event2: EV_ABS ABS_MT_POSITION_Y 000004ac ---->按键a
[ 16403.691960] /dev/input/event2: EV_SYN SYN_REPORT 00000000
[ 16403.704346] /dev/input/event2: EV_ABS ABS_MT_POSITION_X 0000005f ---->按键a
[ 16403.704346] /dev/input/event2: EV_ABS ABS_MT_TOUCH_MAJOR 0000000c
[ 16403.704346] /dev/input/event2: EV_SYN SYN_REPORT 00000000
[ 16403.707889] /dev/input/event2: EV_ABS ABS_MT_POSITION_X 0000005c ---->按键a
[ 16403.707889] /dev/input/event2: EV_SYN SYN_REPORT 00000000
[ 16403.721125] /dev/input/event2: EV_ABS ABS_MT_POSITION_X 00000058 ---->按键a
[ 16403.721125] /dev/input/event2: EV_ABS ABS_MT_TOUCH_MAJOR 00000008
[ 16403.721125] /dev/input/event2: EV_SYN SYN_REPORT 00000000
[ 16403.724682] /dev/input/event2: EV_ABS ABS_MT_POSITION_X 00000055 ---->按键a
[ 16403.724682] /dev/input/event2: EV_SYN SYN_REPORT 00000000
[ 16403.737316] /dev/input/event2: EV_ABS ABS_MT_POSITION_X 00000052 ---->按键a
[ 16403.737316] /dev/input/event2: EV_ABS ABS_MT_TOUCH_MAJOR 0000000d
[ 16403.737316] /dev/input/event2: EV_SYN SYN_REPORT 00000000
[ 16403.741324] /dev/input/event2: EV_ABS ABS_MT_POSITION_X 0000004f ---->按键a
[ 16403.741324] /dev/input/event2: EV_SYN SYN_REPORT 00000000
[ 16403.753984] /dev/input/event2: EV_ABS ABS_MT_POSITION_X 0000004c ---->按键a
[ 16403.753984] /dev/input/event2: EV_SYN SYN_REPORT 00000000
[ 16403.757661] /dev/input/event2: EV_ABS ABS_MT_POSITION_X 00000049 ---->按键a
[ 16403.757661] /dev/input/event2: EV_SYN SYN_REPORT 00000000
[ 16403.770340] /dev/input/event2: EV_ABS ABS_MT_SLOT 00000001
[ 16403.770340] /dev/input/event2: EV_ABS ABS_MT_TRACKING_ID 0000022a
[ 16403.770340] /dev/input/event2: EV_ABS ABS_MT_POSITION_X 0000028d
[ 16403.770340] /dev/input/event2: EV_ABS ABS_MT_POSITION_Y 000004ab ---->按键L
[ 16403.770340] /dev/input/event2: EV_ABS ABS_MT_TOUCH_MAJOR 0000000c
[ 16403.770340] /dev/input/event2: EV_ABS ABS_MT_PRESSURE 000003e8
以上坐标点资源文件https://download.csdn.net/download/chen245250566/12503089