Loading services/inputflinger/dispatcher/InputDispatcher.cpp +13 −3 Original line number Diff line number Diff line Loading @@ -2303,8 +2303,13 @@ std::vector<InputTarget> InputDispatcher::findTouchedWindowTargetsLocked( pointerIds.markBit(entry.pointerProperties[pointerIndex].id); } const bool isDownOrPointerDown = maskedAction == AMOTION_EVENT_ACTION_DOWN || maskedAction == AMOTION_EVENT_ACTION_POINTER_DOWN; tempTouchState.addOrUpdateWindow(windowHandle, targetFlags, pointerIds, entry.eventTime); isDownOrPointerDown ? std::make_optional(entry.eventTime) : std::nullopt); // If this is the pointer going down and the touched window has a wallpaper // then also add the touched wallpaper windows so they are locked in for the duration Loading @@ -2312,8 +2317,7 @@ std::vector<InputTarget> InputDispatcher::findTouchedWindowTargetsLocked( // We do not collect wallpapers during HOVER_MOVE or SCROLL because the wallpaper // engine only supports touch events. We would need to add a mechanism similar // to View.onGenericMotionEvent to enable wallpapers to handle these events. if (maskedAction == AMOTION_EVENT_ACTION_DOWN || maskedAction == AMOTION_EVENT_ACTION_POINTER_DOWN) { if (isDownOrPointerDown) { if (targetFlags.test(InputTarget::Flags::FOREGROUND) && windowHandle->getInfo()->inputConfig.test( gui::WindowInfo::InputConfig::DUPLICATE_TOUCH_TO_WALLPAPER)) { Loading Loading @@ -2517,6 +2521,12 @@ std::vector<InputTarget> InputDispatcher::findTouchedWindowTargetsLocked( // Success! Output targets from the touch state. tempTouchState.clearWindowsWithoutPointers(); for (const TouchedWindow& touchedWindow : tempTouchState.windows) { if (touchedWindow.pointerIds.isEmpty() && !touchedWindow.hasHoveringPointers(entry.deviceId)) { // Windows with hovering pointers are getting persisted inside TouchState. // Do not send this event to those windows. continue; } addWindowTargetLocked(touchedWindow.windowHandle, touchedWindow.targetFlags, touchedWindow.pointerIds, touchedWindow.firstDownTimeInTarget, targets); Loading services/inputflinger/dispatcher/TouchState.cpp +3 −3 Original line number Diff line number Diff line Loading @@ -63,7 +63,7 @@ void TouchState::clearWindowsWithoutPointers() { void TouchState::addOrUpdateWindow(const sp<WindowInfoHandle>& windowHandle, ftl::Flags<InputTarget::Flags> targetFlags, BitSet32 pointerIds, std::optional<nsecs_t> eventTime) { std::optional<nsecs_t> firstDownTimeInTarget) { for (TouchedWindow& touchedWindow : windows) { // We do not compare windows by token here because two windows that share the same token // may have a different transform Loading @@ -77,7 +77,7 @@ void TouchState::addOrUpdateWindow(const sp<WindowInfoHandle>& windowHandle, // the window. touchedWindow.pointerIds.value |= pointerIds.value; if (!touchedWindow.firstDownTimeInTarget.has_value()) { touchedWindow.firstDownTimeInTarget = eventTime; touchedWindow.firstDownTimeInTarget = firstDownTimeInTarget; } return; } Loading @@ -86,7 +86,7 @@ void TouchState::addOrUpdateWindow(const sp<WindowInfoHandle>& windowHandle, touchedWindow.windowHandle = windowHandle; touchedWindow.targetFlags = targetFlags; touchedWindow.pointerIds = pointerIds; touchedWindow.firstDownTimeInTarget = eventTime; touchedWindow.firstDownTimeInTarget = firstDownTimeInTarget; windows.push_back(touchedWindow); } Loading services/inputflinger/dispatcher/TouchState.h +1 −1 Original line number Diff line number Diff line Loading @@ -47,7 +47,7 @@ struct TouchState { const sp<android::gui::WindowInfoHandle>& windowHandle); void addOrUpdateWindow(const sp<android::gui::WindowInfoHandle>& windowHandle, ftl::Flags<InputTarget::Flags> targetFlags, BitSet32 pointerIds, std::optional<nsecs_t> eventTime = std::nullopt); std::optional<nsecs_t> firstDownTimeInTarget = std::nullopt); void addHoveringPointerToWindow(const sp<android::gui::WindowInfoHandle>& windowHandle, int32_t deviceId, int32_t hoveringPointerId); void removeHoveringPointer(int32_t deviceId, int32_t hoveringPointerId); Loading services/inputflinger/dispatcher/TouchedWindow.cpp +4 −0 Original line number Diff line number Diff line Loading @@ -29,6 +29,10 @@ bool TouchedWindow::hasHoveringPointers() const { return !mHoveringPointerIdsByDevice.empty(); } bool TouchedWindow::hasHoveringPointers(int32_t deviceId) const { return mHoveringPointerIdsByDevice.find(deviceId) != mHoveringPointerIdsByDevice.end(); } void TouchedWindow::clearHoveringPointers() { mHoveringPointerIdsByDevice.clear(); } Loading services/inputflinger/dispatcher/TouchedWindow.h +1 −0 Original line number Diff line number Diff line Loading @@ -38,6 +38,7 @@ struct TouchedWindow { std::optional<nsecs_t> firstDownTimeInTarget; bool hasHoveringPointers() const; bool hasHoveringPointers(int32_t deviceId) const; bool hasHoveringPointer(int32_t deviceId, int32_t pointerId) const; void addHoveringPointer(int32_t deviceId, int32_t pointerId); Loading Loading
services/inputflinger/dispatcher/InputDispatcher.cpp +13 −3 Original line number Diff line number Diff line Loading @@ -2303,8 +2303,13 @@ std::vector<InputTarget> InputDispatcher::findTouchedWindowTargetsLocked( pointerIds.markBit(entry.pointerProperties[pointerIndex].id); } const bool isDownOrPointerDown = maskedAction == AMOTION_EVENT_ACTION_DOWN || maskedAction == AMOTION_EVENT_ACTION_POINTER_DOWN; tempTouchState.addOrUpdateWindow(windowHandle, targetFlags, pointerIds, entry.eventTime); isDownOrPointerDown ? std::make_optional(entry.eventTime) : std::nullopt); // If this is the pointer going down and the touched window has a wallpaper // then also add the touched wallpaper windows so they are locked in for the duration Loading @@ -2312,8 +2317,7 @@ std::vector<InputTarget> InputDispatcher::findTouchedWindowTargetsLocked( // We do not collect wallpapers during HOVER_MOVE or SCROLL because the wallpaper // engine only supports touch events. We would need to add a mechanism similar // to View.onGenericMotionEvent to enable wallpapers to handle these events. if (maskedAction == AMOTION_EVENT_ACTION_DOWN || maskedAction == AMOTION_EVENT_ACTION_POINTER_DOWN) { if (isDownOrPointerDown) { if (targetFlags.test(InputTarget::Flags::FOREGROUND) && windowHandle->getInfo()->inputConfig.test( gui::WindowInfo::InputConfig::DUPLICATE_TOUCH_TO_WALLPAPER)) { Loading Loading @@ -2517,6 +2521,12 @@ std::vector<InputTarget> InputDispatcher::findTouchedWindowTargetsLocked( // Success! Output targets from the touch state. tempTouchState.clearWindowsWithoutPointers(); for (const TouchedWindow& touchedWindow : tempTouchState.windows) { if (touchedWindow.pointerIds.isEmpty() && !touchedWindow.hasHoveringPointers(entry.deviceId)) { // Windows with hovering pointers are getting persisted inside TouchState. // Do not send this event to those windows. continue; } addWindowTargetLocked(touchedWindow.windowHandle, touchedWindow.targetFlags, touchedWindow.pointerIds, touchedWindow.firstDownTimeInTarget, targets); Loading
services/inputflinger/dispatcher/TouchState.cpp +3 −3 Original line number Diff line number Diff line Loading @@ -63,7 +63,7 @@ void TouchState::clearWindowsWithoutPointers() { void TouchState::addOrUpdateWindow(const sp<WindowInfoHandle>& windowHandle, ftl::Flags<InputTarget::Flags> targetFlags, BitSet32 pointerIds, std::optional<nsecs_t> eventTime) { std::optional<nsecs_t> firstDownTimeInTarget) { for (TouchedWindow& touchedWindow : windows) { // We do not compare windows by token here because two windows that share the same token // may have a different transform Loading @@ -77,7 +77,7 @@ void TouchState::addOrUpdateWindow(const sp<WindowInfoHandle>& windowHandle, // the window. touchedWindow.pointerIds.value |= pointerIds.value; if (!touchedWindow.firstDownTimeInTarget.has_value()) { touchedWindow.firstDownTimeInTarget = eventTime; touchedWindow.firstDownTimeInTarget = firstDownTimeInTarget; } return; } Loading @@ -86,7 +86,7 @@ void TouchState::addOrUpdateWindow(const sp<WindowInfoHandle>& windowHandle, touchedWindow.windowHandle = windowHandle; touchedWindow.targetFlags = targetFlags; touchedWindow.pointerIds = pointerIds; touchedWindow.firstDownTimeInTarget = eventTime; touchedWindow.firstDownTimeInTarget = firstDownTimeInTarget; windows.push_back(touchedWindow); } Loading
services/inputflinger/dispatcher/TouchState.h +1 −1 Original line number Diff line number Diff line Loading @@ -47,7 +47,7 @@ struct TouchState { const sp<android::gui::WindowInfoHandle>& windowHandle); void addOrUpdateWindow(const sp<android::gui::WindowInfoHandle>& windowHandle, ftl::Flags<InputTarget::Flags> targetFlags, BitSet32 pointerIds, std::optional<nsecs_t> eventTime = std::nullopt); std::optional<nsecs_t> firstDownTimeInTarget = std::nullopt); void addHoveringPointerToWindow(const sp<android::gui::WindowInfoHandle>& windowHandle, int32_t deviceId, int32_t hoveringPointerId); void removeHoveringPointer(int32_t deviceId, int32_t hoveringPointerId); Loading
services/inputflinger/dispatcher/TouchedWindow.cpp +4 −0 Original line number Diff line number Diff line Loading @@ -29,6 +29,10 @@ bool TouchedWindow::hasHoveringPointers() const { return !mHoveringPointerIdsByDevice.empty(); } bool TouchedWindow::hasHoveringPointers(int32_t deviceId) const { return mHoveringPointerIdsByDevice.find(deviceId) != mHoveringPointerIdsByDevice.end(); } void TouchedWindow::clearHoveringPointers() { mHoveringPointerIdsByDevice.clear(); } Loading
services/inputflinger/dispatcher/TouchedWindow.h +1 −0 Original line number Diff line number Diff line Loading @@ -38,6 +38,7 @@ struct TouchedWindow { std::optional<nsecs_t> firstDownTimeInTarget; bool hasHoveringPointers() const; bool hasHoveringPointers(int32_t deviceId) const; bool hasHoveringPointer(int32_t deviceId, int32_t pointerId) const; void addHoveringPointer(int32_t deviceId, int32_t pointerId); Loading