InputChannel InputPublisher InputConsumer InputTarget

File: /home/andy/aosp13/frameworks/native/include/input

InputReader --------> InputPublisher <----------> InputChannel <--------> InputConsumer

/**
 * Native input transport.
 *
 * The InputChannel provides a mechanism for exchanging InputMessage structures across processes.
 *
 * The InputPublisher and InputConsumer each handle one end-point of an input channel.
 * The InputPublisher is used by the input dispatcher to send events to the application.
 * The InputConsumer is used by the application to receive events from the input dispatcher.
 */

InputChannel:

An input channel consists of a local unix domain socket used to send and receive
input messages across processes

InputPublisher:

Publishes input events to an input channel

publishMotionEvent()
publishKeyEvent()
publishFocusEvent()
publishDragEvent()
publishTouchModeEvent()

InputConsumer:

Consumes input events from an input channel

consume()
sendFinishedSignal()

InputEventReceiver

child class:

PointerEventDispatcher
android.view.ViewRootImpl.WindowInputEventReceiver

When to create a InputEventReceiver?

在这里插入图片描述

NativeInputEventReceiver

class NativeInputEventReceiver : public LooperCallback {
public:
    status_t finishInputEvent(uint32_t seq, bool handled);
    status_t reportTimeline(int32_t inputEventId, nsecs_t gpuCompletedTime, nsecs_t presentTime);
    status_t consumeEvents(JNIEnv* env, bool consumeBatches, nsecs_t frameTime,
            bool* outConsumedBatch);

system server call inputManager.start();

com_android_server_input_InputManagerService.cpp#nativeStart()

InputManager::start() : InputDispatcher::start() InputReader::start()

InputDispatcher::dispatchOnce

InputDispatcher::dispatchOnceInnerLocked call

dispatchKeyLocked()
dispatchMotionLocked
dispatchSensorLocked
dispatchDragLocked

findFocusedWindowTargetsLocked: find input targets.

InputDispatcher::dispatchEventLocked for each InputTarget call following :

InputDispatcher::prepareDispatchCycleLocked()
InputDispatcher::enqueueDispatchEntriesLocked     InputDispatcher::enqueueDispatchEntryLocked
InputDispatcher::startDispatchCycleLocked():    iterate  all the  events 
InputPublisher::publishTouchModeEvent()  
InputPublisher::publishDragEvent()
InputPublisher::publishMotionEvent()
InputPublisher::publishKeyEvent()
InputChannel::sendMessage()

###################################################

InputChannel::receiveMessage()
InputConsumer::consume()

call java InputEventReceiver#dispatchInputEvent()

What is InputTarget?

aosp13/frameworks/native/services/inputflinger/dispatcher/InputTarget.h

InputDispatcher::addWindowTargetLocked

InputDispatcher::setInputWindowsLocked()

  • 7
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值