input InputDispatcher::findTouchedWindowTargetsLocked查看

在input事件分发的时候,会调用到

int32_t InputDispatcher::findTouchedWindowTargetsLocked

这个地方写的比较复杂,在点击后,滑动手指,可以查看log发现,这个方法会不断的被调用。

一些点击事件被drop,也是这里处理的,

 

点击的时候,newGesture 为true

1204    bool newGesture = (maskedAction == AMOTION_EVENT_ACTION_DOWN
1205            || maskedAction == AMOTION_EVENT_ACTION_SCROLL
1206            || isHoverAction);

而滑动和up手指的时候,newGesture 为false,newGesture 影响后面的处理逻辑

1237    if (newGesture || (isSplit && maskedAction == AMOTION_EVENT_ACTION_POINTER_DOWN)) {
1238        /* Case 1: New splittable pointer going down, or need target for hover or scroll. */
1323    } else {
1324        /* Case 2: Pointer move, up, cancel or non-splittable pointer down. */
1325
1326        // If the pointer is not currently down, then ignore the event.
1327        if (! mTempTouchState.down) {
1328#if DEBUG_FOCUS
1329            ALOGD("Dropping event because the pointer is not down or we previously "
1330                    "dropped the pointer down event.");
1331#endif
1332            injectionResult = INPUT_EVENT_INJECTION_FAILED;
1333            goto Failed;
1334        }

这里mTempTouchState.down又影响到处理流程。

mTempTouchState的代码逻辑比较混乱,

可以添加log查看

mTempTouchState.down值的变化过程。

在多点点击,input事件注入的时候,mTempTouchState.down值是怎么变化的呢?

 

1513    // Update final pieces of touch state if the injector had permission.
1514    if (injectionPermission == INJECTION_PERMISSION_GRANTED) {
1515        if (!wrongDevice) {
1516            if (switchedDevice) {
1517#if DEBUG_FOCUS
1518                ALOGD("Conflicting pointer actions: Switched to a different device.");
1519#endif
1520                *outConflictingPointerActions = true;
1521            }
1522
1523            if (isHoverAction) {
1538            } else if (maskedAction == AMOTION_EVENT_ACTION_UP
1539                    || maskedAction == AMOTION_EVENT_ACTION_CANCEL) {
1540                // All pointers up or canceled.
1541                mTempTouchState.reset();

这里可以重点关注下

reset方法会把down设置为false

4519void InputDispatcher::TouchState::reset() {
4520    down = false;
4521    split = false;
4522    deviceId = -1;
4523    source = 0;
4524    displayId = -1;
4525    windows.clear();
4526}

 

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
07-07 14:44:01.144 1936 3340 W ActivityManager: Force finishing activity com.zhiying.settings/.about.LegalInformationActivity 07-07 14:44:01.152 1936 1936 E PowerManagerService: screensaver enable true 07-07 14:44:01.166 1936 1952 E memtrack: Couldn't load memtrack module 07-07 14:44:01.166 1936 1952 W android.os.Debug: failed to get memory consumption info: -1 07-07 14:44:01.215 1936 2009 W InputDispatcher: channel '5cfd4ab com.zhiying.settings/com.zhiying.settings.about.LegalInformationStartWebActivity (server)' ~ Consumer closed input channel or an error occurred. events=0x9 07-07 14:44:01.215 1936 2009 E InputDispatcher: channel '5cfd4ab com.zhiying.settings/com.zhiying.settings.about.LegalInformationStartWebActivity (server)' ~ Channel is unrecoverably broken and will be disposed! 07-07 14:44:01.215 1936 2009 W InputDispatcher: channel 'c486525 com.zhiying.settings/com.zhiying.settings.about.LegalInformationStartWebActivity (server)' ~ Consumer closed input channel or an error occurred. events=0x9 07-07 14:44:01.215 1936 2009 E InputDispatcher: channel 'c486525 com.zhiying.settings/com.zhiying.settings.about.LegalInformationStartWebActivity (server)' ~ Channel is unrecoverably broken and will be disposed! 07-07 14:44:01.216 1936 2009 W InputDispatcher: channel 'b3becb6 com.zhiying.settings/com.zhiying.settings.about.LegalInformationActivity (server)' ~ Consumer closed input channel or an error occurred. events=0x9 07-07 14:44:01.216 1936 2009 E InputDispatcher: channel 'b3becb6 com.zhiying.settings/com.zhiying.settings.about.LegalInformationActivity (server)' ~ Channel is unrecoverably broken and will be disposed! 07-07 14:44:01.216 1936 2009 W InputDispatcher: channel '1712ca6 com.zhiying.settings/com.zhiying.settings.about.SystemInfoActivity (server)' ~ Consumer closed input channel or an error occurred. events=0x9 07-07 14:44:01.216 1936 2009 E InputDispatcher: channel '1712ca6 com.zhiying.settings/com.zhiying.settings.about.SystemInfoActivity (server)' ~ Channel is unrecoverably broken and will be disposed! 07-07 14:44:01.216 1936 2009 W InputDispatcher: channel 'd7b4fb2 com.zhiying.settings/com.zhiying.settings.MainZYActivity (server)' ~ Consumer closed input channel or an error occurred. events=0x9 07-07 14:44:01.217 1936 2009 E InputDispatcher: channel 'd7b4fb2 com.zhiying.settings/com.zhiying.settings.MainZYActivity (server)' ~ Channel is unrecoverably broken and will be disposed!
07-08
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值