应用层通过 adb 命令 即可实现
adb shell dumpsys input 获取设备信息
找到 触摸屏设备信息(信息内容很多,这里只复制了要用的)
小米4
Device 6: synaptics_dsx (这个是触摸屏设备名字)
Touch Input Mapper:
Parameters:
GestureMode: spots
DeviceType: touchScreen
AssociatedDisplay: hasAssociatedDisplay=true, isExternal=false
OrientationAware: true
逍遥模拟器
Device 6: User Input
Touch Input Mapper:
Parameters:
GestureMode: spots
DeviceType: touchScreen
AssociatedDisplay: hasAssociatedDisplay=true, isExternal=false
OrientationAware: true
雷神模拟器
Device 2: input
Touch Input Mapper:
Parameters:
GestureMode: multi-touch
DeviceType: touchScreen
AssociatedDisplay: hasAssociatedDisplay=true, isExternal=false
OrientationAware: true
通过对比很容易看出共同处,然后把名字截取出来;
通过adb shell getevent -p 获取用户操作设备信息
根据上面得到的NAME 获取对应的 event int 设备节点;