diff --git a/interfaces/native/innerkits/proxy/include/window_info.h b/interfaces/native/innerkits/proxy/include/window_info.h index 3f0a8d3b05567ae6e6b6583a75554ff63138ce31..636f3e3ff4bbb0b8af022c365a640a110bd90130 100644 --- a/interfaces/native/innerkits/proxy/include/window_info.h +++ b/interfaces/native/innerkits/proxy/include/window_info.h @@ -216,7 +216,14 @@ struct WindowInfo { * * @since 12 */ - static constexpr uint32_t FLAG_BIT_HANDWRITING = 2; + static constexpr uint32_t FLAG_BIT_HANDWRITING = 1 << 1; + + /** + * exclude inject event window + * + * @since 14 + */ + static constexpr uint32_t FLAG_BIT_EXCLUDE_INJECT_EVENT = 1 << 2; /** * Globally unique identifier of the window diff --git a/service/window_manager/include/input_windows_manager.h b/service/window_manager/include/input_windows_manager.h index 12b90e0d1af7641a3a3fbd8fa652d58bb414b257..b17e06fb99aecbfe17c0635086c07c7495c085e4 100644 --- a/service/window_manager/include/input_windows_manager.h +++ b/service/window_manager/include/input_windows_manager.h @@ -302,6 +302,7 @@ void UpdateDisplayXYInOneHandMode(double& physicalX, double& physicalY, const Di #ifdef OHOS_BUILD_ENABLE_TOUCH bool SkipAnnotationWindow(uint32_t flag, int32_t toolType); + bool SkipExcludeInjectEventWindow(uint32_t windowFlag, bool isInjectEvent); bool SkipNavigationWindow(WindowInputType windowType, int32_t toolType); void HandleGestureInjection(bool gestureInject); int32_t UpdateTouchScreenTarget(std::shared_ptr pointerEvent); diff --git a/service/window_manager/src/input_windows_manager.cpp b/service/window_manager/src/input_windows_manager.cpp index 7052270cd51d3ccd5459dd9272a0e55e90f9b8e2..3c19fcb1564fc05f9c5b66be5bda60e0730652d6 100644 --- a/service/window_manager/src/input_windows_manager.cpp +++ b/service/window_manager/src/input_windows_manager.cpp @@ -3157,6 +3157,12 @@ bool InputWindowsManager::SkipAnnotationWindow(uint32_t flag, int32_t toolType) toolType == PointerEvent::TOOL_TYPE_FINGER); } +bool InputWindowsManager::SkipExcludeInjectEventWindow(uint32_t windowFlag, bool isInjectEvent) +{ + return isInjectEvent && + (windowFlag & WindowInfo::FLAG_BIT_EXCLUDE_INJECT_EVENT) == WindowInfo::FLAG_BIT_EXCLUDE_INJECT_EVENT; +} + bool InputWindowsManager::SkipNavigationWindow(WindowInputType windowType, int32_t toolType) { MMI_HILOGD("windowType:%{public}d, toolType:%{public}d", static_cast(windowType), toolType); @@ -3480,6 +3486,10 @@ int32_t InputWindowsManager::UpdateTouchScreenTarget(std::shared_ptrHasFlag(InputEvent::EVENT_FLAG_SIMULATE))) { + winMap.insert({item.id, item}); + continue; + } if (SkipAnnotationWindow(item.flags, pointerItem.GetToolType())) { winMap.insert({item.id, item}); continue; diff --git a/service/window_manager/test/input_windows_manager_test.cpp b/service/window_manager/test/input_windows_manager_test.cpp index 1ab6f52e91769b16526536335cb22717480ed265..00948d62d60effae84fa2ec2c6cbabeb8afd1df3 100644 --- a/service/window_manager/test/input_windows_manager_test.cpp +++ b/service/window_manager/test/input_windows_manager_test.cpp @@ -1806,6 +1806,33 @@ HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_SkipAnnotationWindow_0 EXPECT_FALSE(result); } +/** + * @tc.name: InputWindowsManagerTest_SkipExcludeInjectEventWindow_001 + * @tc.desc: This test verifies the functionality of determining whether to draw the pointer + * @tc.type: FUNC + * @tc.require: + */ +HWTEST_F(InputWindowsManagerTest, InputWindowsManagerTest_SkipExcludeInjectEventWindow_001, TestSize.Level1) +{ + CALL_TEST_DEBUG; + uint32_t flag = WindowInfo::FLAG_BIT_EXCLUDE_INJECT_EVENT; + bool isInjectEvent = true; + bool result = WIN_MGR->SkipExcludeInjectEventWindow(flag, isInjectEvent); + EXPECT_TRUE(result); + flag = WindowInfo::FLAG_BIT_EXCLUDE_INJECT_EVENT; + isInjectEvent = false; + result = WIN_MGR->SkipExcludeInjectEventWindow(flag, isInjectEvent); + EXPECT_FALSE(result); + flag = 0; + isInjectEvent = true; + result = WIN_MGR->SkipExcludeInjectEventWindow(flag, isInjectEvent); + EXPECT_FALSE(result); + flag = 0; + isInjectEvent = false; + result = WIN_MGR->SkipExcludeInjectEventWindow(flag, isInjectEvent); + EXPECT_FALSE(result); +} + /** * @tc.name: InputWindowsManagerTest_UpdateTouchScreenTarget_001 * @tc.desc: This test verifies the functionality of updating the touch screen target