Loading services/inputflinger/dispatcher/InputDispatcher.cpp +7 −9 Original line number Diff line number Diff line Loading @@ -2104,7 +2104,7 @@ std::vector<TouchedWindow> InputDispatcher::findTouchedWindowTargetsLocked( const bool isFromMouse = isFromSource(entry.source, AINPUT_SOURCE_MOUSE); if (newGesture) { bool down = maskedAction == AMOTION_EVENT_ACTION_DOWN; if (switchedDevice && tempTouchState.down && !down && !isHoverAction) { if (switchedDevice && tempTouchState.isDown() && !down && !isHoverAction) { ALOGI("Dropping event because a pointer for a different device is already down " "in display %" PRId32, displayId); Loading @@ -2113,7 +2113,6 @@ std::vector<TouchedWindow> InputDispatcher::findTouchedWindowTargetsLocked( return touchedWindows; // wrong device } tempTouchState.reset(); tempTouchState.down = down; tempTouchState.deviceId = entry.deviceId; tempTouchState.source = entry.source; tempTouchState.displayId = displayId; Loading Loading @@ -2234,7 +2233,7 @@ std::vector<TouchedWindow> InputDispatcher::findTouchedWindowTargetsLocked( /* Case 2: Pointer move, up, cancel or non-splittable pointer down. */ // If the pointer is not currently down, then ignore the event. if (!tempTouchState.down) { if (!tempTouchState.isDown()) { if (DEBUG_FOCUS) { ALOGD("Dropping event because the pointer is not down or we previously " "dropped the pointer down event in display %" PRId32, Loading Loading @@ -2445,7 +2444,7 @@ Failed: if (isHoverAction) { // Started hovering, therefore no longer down. if (oldState && oldState->down) { if (oldState && oldState->isDown()) { if (DEBUG_FOCUS) { ALOGD("Conflicting pointer actions: Hover received while pointer was " "down."); Loading @@ -2465,7 +2464,7 @@ Failed: tempTouchState.reset(); } else if (maskedAction == AMOTION_EVENT_ACTION_DOWN) { // First pointer went down. if (oldState && oldState->down) { if (oldState && oldState->isDown()) { if (DEBUG_FOCUS) { ALOGD("Conflicting pointer actions: Down received while already down."); } Loading Loading @@ -5326,9 +5325,8 @@ void InputDispatcher::dumpDispatchStateLocked(std::string& dump) { dump += StringPrintf(INDENT "TouchStatesByDisplay:\n"); for (const std::pair<int32_t, TouchState>& pair : mTouchStatesByDisplay) { const TouchState& state = pair.second; dump += StringPrintf(INDENT2 "%d: down=%s, deviceId=%d, source=0x%08x\n", state.displayId, toString(state.down), state.deviceId, state.source); dump += StringPrintf(INDENT2 "%d: deviceId=%d, source=0x%08x\n", state.displayId, state.deviceId, state.source); if (!state.windows.empty()) { dump += INDENT3 "Windows:\n"; for (size_t i = 0; i < state.windows.size(); i++) { Loading Loading @@ -5688,7 +5686,7 @@ status_t InputDispatcher::pilferPointersLocked(const sp<IBinder>& token) { } auto [statePtr, windowPtr] = findTouchStateAndWindowLocked(token); if (statePtr == nullptr || windowPtr == nullptr || !statePtr->down) { if (statePtr == nullptr || windowPtr == nullptr || windowPtr->pointerIds.isEmpty()) { ALOGW("Attempted to pilfer points from a channel without any on-going pointer streams." " Ignoring."); return BAD_VALUE; Loading services/inputflinger/dispatcher/TouchState.cpp +5 −0 Original line number Diff line number Diff line Loading @@ -138,4 +138,9 @@ sp<WindowInfoHandle> TouchState::getWallpaperWindow() const { return nullptr; } bool TouchState::isDown() const { return std::any_of(windows.begin(), windows.end(), [](const TouchedWindow& window) { return !window.pointerIds.isEmpty(); }); } } // namespace android::inputdispatcher services/inputflinger/dispatcher/TouchState.h +2 −2 Original line number Diff line number Diff line Loading @@ -28,8 +28,6 @@ class WindowInfoHandle; namespace inputdispatcher { struct TouchState { bool down = false; // id of the device that is currently down, others are rejected int32_t deviceId = -1; // source of the device that is current down, others are rejected Loading Loading @@ -59,6 +57,8 @@ struct TouchState { sp<android::gui::WindowInfoHandle> getFirstForegroundWindowHandle() const; bool isSlippery() const; sp<android::gui::WindowInfoHandle> getWallpaperWindow() const; // Whether any of the windows are currently being touched bool isDown() const; }; } // namespace inputdispatcher Loading Loading
services/inputflinger/dispatcher/InputDispatcher.cpp +7 −9 Original line number Diff line number Diff line Loading @@ -2104,7 +2104,7 @@ std::vector<TouchedWindow> InputDispatcher::findTouchedWindowTargetsLocked( const bool isFromMouse = isFromSource(entry.source, AINPUT_SOURCE_MOUSE); if (newGesture) { bool down = maskedAction == AMOTION_EVENT_ACTION_DOWN; if (switchedDevice && tempTouchState.down && !down && !isHoverAction) { if (switchedDevice && tempTouchState.isDown() && !down && !isHoverAction) { ALOGI("Dropping event because a pointer for a different device is already down " "in display %" PRId32, displayId); Loading @@ -2113,7 +2113,6 @@ std::vector<TouchedWindow> InputDispatcher::findTouchedWindowTargetsLocked( return touchedWindows; // wrong device } tempTouchState.reset(); tempTouchState.down = down; tempTouchState.deviceId = entry.deviceId; tempTouchState.source = entry.source; tempTouchState.displayId = displayId; Loading Loading @@ -2234,7 +2233,7 @@ std::vector<TouchedWindow> InputDispatcher::findTouchedWindowTargetsLocked( /* Case 2: Pointer move, up, cancel or non-splittable pointer down. */ // If the pointer is not currently down, then ignore the event. if (!tempTouchState.down) { if (!tempTouchState.isDown()) { if (DEBUG_FOCUS) { ALOGD("Dropping event because the pointer is not down or we previously " "dropped the pointer down event in display %" PRId32, Loading Loading @@ -2445,7 +2444,7 @@ Failed: if (isHoverAction) { // Started hovering, therefore no longer down. if (oldState && oldState->down) { if (oldState && oldState->isDown()) { if (DEBUG_FOCUS) { ALOGD("Conflicting pointer actions: Hover received while pointer was " "down."); Loading @@ -2465,7 +2464,7 @@ Failed: tempTouchState.reset(); } else if (maskedAction == AMOTION_EVENT_ACTION_DOWN) { // First pointer went down. if (oldState && oldState->down) { if (oldState && oldState->isDown()) { if (DEBUG_FOCUS) { ALOGD("Conflicting pointer actions: Down received while already down."); } Loading Loading @@ -5326,9 +5325,8 @@ void InputDispatcher::dumpDispatchStateLocked(std::string& dump) { dump += StringPrintf(INDENT "TouchStatesByDisplay:\n"); for (const std::pair<int32_t, TouchState>& pair : mTouchStatesByDisplay) { const TouchState& state = pair.second; dump += StringPrintf(INDENT2 "%d: down=%s, deviceId=%d, source=0x%08x\n", state.displayId, toString(state.down), state.deviceId, state.source); dump += StringPrintf(INDENT2 "%d: deviceId=%d, source=0x%08x\n", state.displayId, state.deviceId, state.source); if (!state.windows.empty()) { dump += INDENT3 "Windows:\n"; for (size_t i = 0; i < state.windows.size(); i++) { Loading Loading @@ -5688,7 +5686,7 @@ status_t InputDispatcher::pilferPointersLocked(const sp<IBinder>& token) { } auto [statePtr, windowPtr] = findTouchStateAndWindowLocked(token); if (statePtr == nullptr || windowPtr == nullptr || !statePtr->down) { if (statePtr == nullptr || windowPtr == nullptr || windowPtr->pointerIds.isEmpty()) { ALOGW("Attempted to pilfer points from a channel without any on-going pointer streams." " Ignoring."); return BAD_VALUE; Loading
services/inputflinger/dispatcher/TouchState.cpp +5 −0 Original line number Diff line number Diff line Loading @@ -138,4 +138,9 @@ sp<WindowInfoHandle> TouchState::getWallpaperWindow() const { return nullptr; } bool TouchState::isDown() const { return std::any_of(windows.begin(), windows.end(), [](const TouchedWindow& window) { return !window.pointerIds.isEmpty(); }); } } // namespace android::inputdispatcher
services/inputflinger/dispatcher/TouchState.h +2 −2 Original line number Diff line number Diff line Loading @@ -28,8 +28,6 @@ class WindowInfoHandle; namespace inputdispatcher { struct TouchState { bool down = false; // id of the device that is currently down, others are rejected int32_t deviceId = -1; // source of the device that is current down, others are rejected Loading Loading @@ -59,6 +57,8 @@ struct TouchState { sp<android::gui::WindowInfoHandle> getFirstForegroundWindowHandle() const; bool isSlippery() const; sp<android::gui::WindowInfoHandle> getWallpaperWindow() const; // Whether any of the windows are currently being touched bool isDown() const; }; } // namespace inputdispatcher Loading