我是靠谱客的博主 漂亮萝莉,这篇文章主要介绍IMS:EventHub设备底层上报Input事件对象处理IMS:EventHub设备底层上报Input事件对象处理,现在分享给大家,希望可以做个参考。

IMS:EventHub设备底层上报Input事件对象处理

android11-release
IMS:EventHub 设备添加和InputDevice转化
IMS:InputReader线程获取输入事件
IMS:InputDispatcher线程分发事件
Android 知识体系


input_event 封装成 RawEvent

从IMS:InputReader线程获取输入事件 将 input_event 信息封装成 RawEvent ,而IMS:EventHub 设备添加和InputDevice转化 这里除了新增外部设备时InputDevice转化,还有getEvents读取事件input_event 并封装成 RawEvent

externalkernel-headersoriginaluapilinuxinput.h
frameworksnativeservicesinputflingerreaderincludeEventHub.h
frameworksnativeservicesinputflingerreaderEventHub.cpp

在这里插入图片描述在这里插入图片描述
InputReader::loopOnce() -> mEventHub->getEvents
在这里插入图片描述

添加NotifyArgs对象

InputReader::loopOnce() -> InputReader::processEventsLocked -> InputReader::processEventsForDeviceLocked -> device->process

frameworksnativeservicesinputflingerreaderInputDevice.cpp

在这里插入图片描述
这里InputMapper就是IMS:EventHub 设备添加和InputDevice转化新增设备(不只是外界,手机默认的物理按键和触摸屏幕也是设备)时添加对应的各种InputMapper:常见有物理按键KeyboardInputMapper、触摸点击SingleTouchInputMapper、MultiTouchInputMapper(都是继承TouchInputMapper)
在这里插入图片描述
mapper.process(rawEvent)这里就是各种事件InputMapper处理,如KeyboardInputMapper,最终添加NotifyKeyArgs
device->process -> mapper.process(rawEvent) -> KeyboardInputMapper::processKey -> getListener()->notifyKey(&args) -> QueuedInputListener::notifyKey

frameworksnativeservicesinputflingerreadermapperKeyboardInputMapper.cpp
frameworksnativeservicesinputflingerInputListener.cpp

在这里插入图片描述
在这里插入图片描述在这里插入图片描述

notify通知InputDispatcher分发

frameworksnativeservicesinputflingerreaderInputReader.cpp
frameworksnativeservicesinputflingerInputListener.cpp
frameworksnativeservicesinputflingerdispatcherInputDispatcher.cpp

loopOnce() -> mQueuedListener->flush() -> args->notify(mInnerListener) -> InputDispatcher::notify***
在这里插入图片描述在这里插入图片描述
在这里插入图片描述

剩下整体流程可查看IMS:InputReader线程获取输入事件、IMS:InputDispatcher线程分发事件

最后

以上就是漂亮萝莉最近收集整理的关于IMS:EventHub设备底层上报Input事件对象处理IMS:EventHub设备底层上报Input事件对象处理的全部内容,更多相关IMS内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(109)

评论列表共有 0 条评论

立即
投稿
返回
顶部