應用層通過 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 設備節點;