WMS实战:输入事件分发与Surface管理
一、输入事件分发系统
1.1 输入系统架构
Android的输入系统是一个复杂的多进程架构,从硬件设备到应用View经历多个层次。
输入系统层次架构:
[硬件层]
Touchscreen / Keyboard / Mouse
↓
[内核层] /dev/input/eventX
↓
[Native层]
EventHub → InputReader → InputClassifier
↓
InputDispatcher (system_server进程)
↓ (通过InputChannel)
[Java层]
InputManagerService → WindowManagerService
↓
InputMonitor → 查找目标窗口
↓ (Binder + Socket)
[应用进程]
ViewRootImpl.WindowInputEventReceiver
↓
ViewRootImpl.deliverInputEvent()
↓
DecorView.dispatchTouchEvent()
↓
Activity.dispatchTouchEvent()
↓
View树事件分发
关键组件:







