Loading libs/input/Input.cpp +3 −0 Original line number Diff line number Diff line Loading @@ -1037,6 +1037,9 @@ std::ostream& operator<<(std::ostream& out, const MotionEvent& event) { if (event.getMetaState() != 0) { out << ", metaState=" << event.getMetaState(); } if (event.getFlags() != 0) { out << ", flags=0x" << std::hex << event.getFlags() << std::dec; } if (event.getEdgeFlags() != 0) { out << ", edgeFlags=" << event.getEdgeFlags(); } Loading services/inputflinger/dispatcher/InputDispatcher.cpp +8 −3 Original line number Diff line number Diff line Loading @@ -3422,6 +3422,9 @@ void InputDispatcher::enqueueDispatchEntryLocked(const std::shared_ptr<Connectio InputTarget::Flags::WINDOW_IS_PARTIALLY_OBSCURED)) { resolvedFlags |= AMOTION_EVENT_FLAG_WINDOW_IS_PARTIALLY_OBSCURED; } if (dispatchEntry->targetFlags.test(InputTarget::Flags::NO_FOCUS_CHANGE)) { resolvedFlags |= AMOTION_EVENT_FLAG_NO_FOCUS_CHANGE; } dispatchEntry->resolvedFlags = resolvedFlags; if (resolvedAction != motionEntry.action) { Loading Loading @@ -3496,8 +3499,7 @@ void InputDispatcher::enqueueDispatchEntryLocked(const std::shared_ptr<Connectio << "~ dropping inconsistent event: " << *dispatchEntry; return; // skip the inconsistent event } if ((resolvedMotion->flags & AMOTION_EVENT_FLAG_NO_FOCUS_CHANGE) && if ((dispatchEntry->resolvedFlags & AMOTION_EVENT_FLAG_NO_FOCUS_CHANGE) && (resolvedMotion->policyFlags & POLICY_FLAG_TRUSTED)) { // Skip reporting pointer down outside focus to the policy. break; Loading Loading @@ -5612,6 +5614,8 @@ bool InputDispatcher::transferTouchFocus(const sp<IBinder>& fromToken, const sp< if (canReceiveForegroundTouches(*toWindowHandle->getInfo())) { newTargetFlags |= InputTarget::Flags::FOREGROUND; } // Transferring touch focus using this API should not effect the focused window. newTargetFlags |= InputTarget::Flags::NO_FOCUS_CHANGE; state->addOrUpdateWindow(toWindowHandle, InputTarget::DispatchMode::AS_IS, newTargetFlags, deviceId, pointers, downTimeInTarget); Loading Loading @@ -7000,7 +7004,8 @@ void InputDispatcher::transferWallpaperTouch(ftl::Flags<InputTarget::Flags> oldT if (newWallpaper != nullptr) { nsecs_t downTimeInTarget = now(); ftl::Flags<InputTarget::Flags> wallpaperFlags = oldTargetFlags & InputTarget::Flags::SPLIT; ftl::Flags<InputTarget::Flags> wallpaperFlags = newTargetFlags; wallpaperFlags |= oldTargetFlags & InputTarget::Flags::SPLIT; wallpaperFlags |= InputTarget::Flags::WINDOW_IS_OBSCURED | InputTarget::Flags::WINDOW_IS_PARTIALLY_OBSCURED; state.addOrUpdateWindow(newWallpaper, InputTarget::DispatchMode::AS_IS, wallpaperFlags, Loading services/inputflinger/dispatcher/InputTargetFlags.h +6 −0 Original line number Diff line number Diff line Loading @@ -38,6 +38,12 @@ enum class InputTargetFlags : uint32_t { * the same UID from watching all touches. */ ZERO_COORDS = 1 << 3, /* This flag indicates that the event will not cause a focus change if it is directed to an * unfocused window, even if it an ACTION_DOWN. This is typically used to allow gestures to be * directed to an unfocused window without bringing it into focus. The motion event should be * delivered with flag AMOTION_EVENT_FLAG_NO_FOCUS_CHANGE. */ NO_FOCUS_CHANGE = 1 << 4, /* This flag indicates that the target of a MotionEvent is partly or wholly * obscured by another visible window above it. The motion event should be * delivered with flag AMOTION_EVENT_FLAG_WINDOW_IS_PARTIALLY_OBSCURED. */ Loading services/inputflinger/dispatcher/include/InputDispatcherInterface.h +4 −1 Original line number Diff line number Diff line Loading @@ -140,7 +140,9 @@ public: */ virtual void setMaximumObscuringOpacityForTouch(float opacity) = 0; /* Transfers touch focus from one window to another window. /** * Transfers touch focus from one window to another window. Transferring touch focus will not * have any effect on the focused window. * * Returns true on success. False if the window did not actually have touch focus. */ Loading @@ -149,6 +151,7 @@ public: /** * Transfer touch focus to the provided channel, no matter where the current touch is. * Transferring touch focus will not have any effect on the focused window. * * Return true on success, false if there was no on-going touch. */ Loading services/inputflinger/tests/InputDispatcher_test.cpp +66 −48 File changed.Preview size limit exceeded, changes collapsed. Show changes Loading
libs/input/Input.cpp +3 −0 Original line number Diff line number Diff line Loading @@ -1037,6 +1037,9 @@ std::ostream& operator<<(std::ostream& out, const MotionEvent& event) { if (event.getMetaState() != 0) { out << ", metaState=" << event.getMetaState(); } if (event.getFlags() != 0) { out << ", flags=0x" << std::hex << event.getFlags() << std::dec; } if (event.getEdgeFlags() != 0) { out << ", edgeFlags=" << event.getEdgeFlags(); } Loading
services/inputflinger/dispatcher/InputDispatcher.cpp +8 −3 Original line number Diff line number Diff line Loading @@ -3422,6 +3422,9 @@ void InputDispatcher::enqueueDispatchEntryLocked(const std::shared_ptr<Connectio InputTarget::Flags::WINDOW_IS_PARTIALLY_OBSCURED)) { resolvedFlags |= AMOTION_EVENT_FLAG_WINDOW_IS_PARTIALLY_OBSCURED; } if (dispatchEntry->targetFlags.test(InputTarget::Flags::NO_FOCUS_CHANGE)) { resolvedFlags |= AMOTION_EVENT_FLAG_NO_FOCUS_CHANGE; } dispatchEntry->resolvedFlags = resolvedFlags; if (resolvedAction != motionEntry.action) { Loading Loading @@ -3496,8 +3499,7 @@ void InputDispatcher::enqueueDispatchEntryLocked(const std::shared_ptr<Connectio << "~ dropping inconsistent event: " << *dispatchEntry; return; // skip the inconsistent event } if ((resolvedMotion->flags & AMOTION_EVENT_FLAG_NO_FOCUS_CHANGE) && if ((dispatchEntry->resolvedFlags & AMOTION_EVENT_FLAG_NO_FOCUS_CHANGE) && (resolvedMotion->policyFlags & POLICY_FLAG_TRUSTED)) { // Skip reporting pointer down outside focus to the policy. break; Loading Loading @@ -5612,6 +5614,8 @@ bool InputDispatcher::transferTouchFocus(const sp<IBinder>& fromToken, const sp< if (canReceiveForegroundTouches(*toWindowHandle->getInfo())) { newTargetFlags |= InputTarget::Flags::FOREGROUND; } // Transferring touch focus using this API should not effect the focused window. newTargetFlags |= InputTarget::Flags::NO_FOCUS_CHANGE; state->addOrUpdateWindow(toWindowHandle, InputTarget::DispatchMode::AS_IS, newTargetFlags, deviceId, pointers, downTimeInTarget); Loading Loading @@ -7000,7 +7004,8 @@ void InputDispatcher::transferWallpaperTouch(ftl::Flags<InputTarget::Flags> oldT if (newWallpaper != nullptr) { nsecs_t downTimeInTarget = now(); ftl::Flags<InputTarget::Flags> wallpaperFlags = oldTargetFlags & InputTarget::Flags::SPLIT; ftl::Flags<InputTarget::Flags> wallpaperFlags = newTargetFlags; wallpaperFlags |= oldTargetFlags & InputTarget::Flags::SPLIT; wallpaperFlags |= InputTarget::Flags::WINDOW_IS_OBSCURED | InputTarget::Flags::WINDOW_IS_PARTIALLY_OBSCURED; state.addOrUpdateWindow(newWallpaper, InputTarget::DispatchMode::AS_IS, wallpaperFlags, Loading
services/inputflinger/dispatcher/InputTargetFlags.h +6 −0 Original line number Diff line number Diff line Loading @@ -38,6 +38,12 @@ enum class InputTargetFlags : uint32_t { * the same UID from watching all touches. */ ZERO_COORDS = 1 << 3, /* This flag indicates that the event will not cause a focus change if it is directed to an * unfocused window, even if it an ACTION_DOWN. This is typically used to allow gestures to be * directed to an unfocused window without bringing it into focus. The motion event should be * delivered with flag AMOTION_EVENT_FLAG_NO_FOCUS_CHANGE. */ NO_FOCUS_CHANGE = 1 << 4, /* This flag indicates that the target of a MotionEvent is partly or wholly * obscured by another visible window above it. The motion event should be * delivered with flag AMOTION_EVENT_FLAG_WINDOW_IS_PARTIALLY_OBSCURED. */ Loading
services/inputflinger/dispatcher/include/InputDispatcherInterface.h +4 −1 Original line number Diff line number Diff line Loading @@ -140,7 +140,9 @@ public: */ virtual void setMaximumObscuringOpacityForTouch(float opacity) = 0; /* Transfers touch focus from one window to another window. /** * Transfers touch focus from one window to another window. Transferring touch focus will not * have any effect on the focused window. * * Returns true on success. False if the window did not actually have touch focus. */ Loading @@ -149,6 +151,7 @@ public: /** * Transfer touch focus to the provided channel, no matter where the current touch is. * Transferring touch focus will not have any effect on the focused window. * * Return true on success, false if there was no on-going touch. */ Loading
services/inputflinger/tests/InputDispatcher_test.cpp +66 −48 File changed.Preview size limit exceeded, changes collapsed. Show changes