diff --git a/frameworks/proxy/event_handler/include/input_manager_impl.h b/frameworks/proxy/event_handler/include/input_manager_impl.h index 456ae1da03b414365675697951e1af656cf85156..58b3646eceb8eea92836c88eddcfc0976e4a31b8 100644 --- a/frameworks/proxy/event_handler/include/input_manager_impl.h +++ b/frameworks/proxy/event_handler/include/input_manager_impl.h @@ -255,7 +255,6 @@ public: int32_t GetMaxMultiTouchPointNum(int32_t &pointNum); int32_t SubscribeInputActive(std::shared_ptr inputEventConsumer, int64_t interval); void UnsubscribeInputActive(int32_t subscribeId); - int32_t SwitchTouchTracking(bool touchTracking); int32_t QueryPointerRecord(int32_t count, std::vector> &pointerList); private: diff --git a/frameworks/proxy/event_handler/src/input_manager_impl.cpp b/frameworks/proxy/event_handler/src/input_manager_impl.cpp index 83817aa67b43c734d399bb5ab677761847477abe..dc63d844ab26341f1a235a62890e38eae6557b0e 100644 --- a/frameworks/proxy/event_handler/src/input_manager_impl.cpp +++ b/frameworks/proxy/event_handler/src/input_manager_impl.cpp @@ -2917,16 +2917,6 @@ void InputManagerImpl::UnsubscribeInputActive(int32_t subscribeId) INPUT_ACTIVE_SUBSCRIBE_MGR.UnsubscribeInputActive(subscribeId); } -int32_t InputManagerImpl::SwitchTouchTracking(bool touchTracking) -{ - CALL_INFO_TRACE; - if ((PRODUCT_TYPE != "phone") && (PRODUCT_TYPE != "tablet")) { - MMI_HILOGW("Does not support touch-tracking on %{public}s", PRODUCT_TYPE.c_str()); - return CAPABILITY_NOT_SUPPORTED; - } - return MULTIMODAL_INPUT_CONNECT_MGR->SwitchTouchTracking(touchTracking); -} - int32_t InputManagerImpl::SetMouseAccelerateMotionSwitch(int32_t deviceId, bool enable) { return MULTIMODAL_INPUT_CONNECT_MGR->SetMouseAccelerateMotionSwitch(deviceId, enable); diff --git a/frameworks/proxy/events/src/input_manager.cpp b/frameworks/proxy/events/src/input_manager.cpp index 1b27751f678e480034808a794669eee3d44a3c48..6951ba5339a0eb63ebe56e2b57bd97153717281f 100644 --- a/frameworks/proxy/events/src/input_manager.cpp +++ b/frameworks/proxy/events/src/input_manager.cpp @@ -970,11 +970,6 @@ void InputManager::UnsubscribeInputActive(int32_t subscribeId) InputMgrImpl.UnsubscribeInputActive(subscribeId); } -int32_t InputManager::SwitchTouchTracking(bool touchTracking) -{ - return InputMgrImpl.SwitchTouchTracking(touchTracking); -} - int32_t InputManager::SetMouseAccelerateMotionSwitch(int32_t deviceId, bool enable) { return InputMgrImpl.SetMouseAccelerateMotionSwitch(deviceId, enable); diff --git a/frameworks/proxy/events/test/input_manager_test.cpp b/frameworks/proxy/events/test/input_manager_test.cpp index 54351086bba86c0c1fc648a32863cbff1ed55732..8dcc5dcfad662543e755a9bba37566a6e1ab6914 100644 --- a/frameworks/proxy/events/test/input_manager_test.cpp +++ b/frameworks/proxy/events/test/input_manager_test.cpp @@ -5967,25 +5967,6 @@ HWTEST_F(InputManagerTest, InputManagerTest_subscribeInputActive, TestSize.Level ASSERT_NO_FATAL_FAILURE(InputManager::GetInstance()->UnsubscribeInputActive(subscriberId)); } -/** - * @tc.name: InputManagerTest_SwitchTouchTracking_001 - * @tc.desc: SwitchTouchTracking called - * @tc.type: FUNC - * @tc.require: - */ -HWTEST_F(InputManagerTest, InputManagerTest_SwitchTouchTracking_001, TestSize.Level1) -{ - CALL_TEST_DEBUG; - std::string PRODUCT_TYPE = system::GetParameter("const.product.devicetype", "unknown"); - bool switchFlag = true; - int32_t ret = InputManager::GetInstance()->SwitchTouchTracking(switchFlag); - if ((PRODUCT_TYPE != "phone") && (PRODUCT_TYPE != "tablet")) { - EXPECT_EQ(ret, CAPABILITY_NOT_SUPPORTED); - } else { - EXPECT_NE(ret, CAPABILITY_NOT_SUPPORTED); - } -} - /* * @tc.name: InputManagerTest_QueryPointerRecord_001 * @tc.desc: QueryPointerRecord diff --git a/interfaces/native/innerkits/proxy/include/input_manager.h b/interfaces/native/innerkits/proxy/include/input_manager.h index bb501bbe5fef7d4323269ce30a1960a691cca5c4..765590b11e40e4ba96c2d6d7e008915b6ac76d43 100644 --- a/interfaces/native/innerkits/proxy/include/input_manager.h +++ b/interfaces/native/innerkits/proxy/include/input_manager.h @@ -1229,8 +1229,6 @@ public: */ void UnsubscribeInputActive(int32_t subscribeId); - int32_t SwitchTouchTracking(bool touchTracking); - /** * @brief Enables or disables the mouse acceleration feature. * @note Only users with specific shell permissions are allowed to call this interface. diff --git a/service/connect_manager/IMultimodalInputConnect.idl b/service/connect_manager/IMultimodalInputConnect.idl index 85a173173cec202200ea183a6a8fde6f61042ecd..cd0cbc9381f56f0b14732652de33095e7aa8cdeb 100644 --- a/service/connect_manager/IMultimodalInputConnect.idl +++ b/service/connect_manager/IMultimodalInputConnect.idl @@ -179,7 +179,6 @@ interface OHOS.MMI.IMultimodalInputConnect { void ClearInputDeviceConsumer([in] String[] deviceNames); void SubscribeInputActive([in] int subscribeId, [in] long interval); void UnsubscribeInputActive([in] int subscribeId); - void SwitchTouchTracking([in] boolean touchTracking); void SetMouseAccelerateMotionSwitch([in] int deviceId, [in] boolean enable); void SwitchScreenCapturePermission([in] unsigned int permissionType, [in] boolean enable); void ClearMouseHideFlag([in] int eventId); diff --git a/service/connect_manager/include/multimodal_input_connect_manager.h b/service/connect_manager/include/multimodal_input_connect_manager.h index 42d65ebf923bf13b06b22fbfc8de765d55725a5f..dcbcfa32f97ee4fc66b38e58bb24c14a4f122faa 100644 --- a/service/connect_manager/include/multimodal_input_connect_manager.h +++ b/service/connect_manager/include/multimodal_input_connect_manager.h @@ -190,7 +190,6 @@ public: int32_t ClearInputDeviceConsumer(const std::vector& deviceNames); int32_t SubscribeInputActive(int32_t subscribeId, int64_t interval); int32_t UnsubscribeInputActive(int32_t subscribeId); - int32_t SwitchTouchTracking(bool touchTracking); int32_t SetMouseAccelerateMotionSwitch(int32_t deviceId, bool enable); int32_t SwitchScreenCapturePermission(uint32_t permissionType, bool enable); int32_t ClearMouseHideFlag(int32_t eventId); diff --git a/service/connect_manager/src/multimodal_input_connect_manager.cpp b/service/connect_manager/src/multimodal_input_connect_manager.cpp index 934cab7a4b0d8c41efdf8f13ba508212b26767bb..51e103f24e050fcc050324a3fbcc2cf3b05a8bf2 100644 --- a/service/connect_manager/src/multimodal_input_connect_manager.cpp +++ b/service/connect_manager/src/multimodal_input_connect_manager.cpp @@ -1198,13 +1198,6 @@ int32_t MultimodalInputConnectManager::UnsubscribeInputActive(int32_t subscribeI return multimodalInputConnectService->UnsubscribeInputActive(subscribeId); } -int32_t MultimodalInputConnectManager::SwitchTouchTracking(bool touchTracking) -{ - std::lock_guard guard(lock_); - CHKPR(multimodalInputConnectService_, INVALID_HANDLER_ID); - return multimodalInputConnectService_->SwitchTouchTracking(touchTracking); -} - int32_t MultimodalInputConnectManager::SetMouseAccelerateMotionSwitch(int32_t deviceId, bool enable) { std::lock_guard guard(lock_); diff --git a/service/connect_manager/test/mock_multimodal_input_connect_stub.h b/service/connect_manager/test/mock_multimodal_input_connect_stub.h index 4621b60e0a40c1566da5c509c69c02b7ac786b21..8ecc0c1d4a7dfa356eeb50dc137d859438e0b252 100644 --- a/service/connect_manager/test/mock_multimodal_input_connect_stub.h +++ b/service/connect_manager/test/mock_multimodal_input_connect_stub.h @@ -205,7 +205,6 @@ public: MOCK_METHOD(bool, IsRunning, (), (const override)); MOCK_METHOD(int32_t, SetInputDeviceConsumer, (const std::vector& deviceNames), (override)); MOCK_METHOD(int32_t, ClearInputDeviceConsumer, (const std::vector& deviceNames), (override)); - MOCK_METHOD(int32_t, SwitchTouchTracking, (bool touchTracking), (override)); MOCK_METHOD(int32_t, SetMouseAccelerateMotionSwitch, (int32_t deviceId, bool enable), (override)); MOCK_METHOD(int32_t, SwitchScreenCapturePermission, (uint32_t permissionType, bool enable), (override)); }; diff --git a/service/connect_manager/test/multimodal_input_connect_stub_ex_test.cpp b/service/connect_manager/test/multimodal_input_connect_stub_ex_test.cpp index d7d7980125482aca330bef2abc379f9bc0a97f4a..78e227706b9bf3f3093074dc6813d2b2b397fbfa 100644 --- a/service/connect_manager/test/multimodal_input_connect_stub_ex_test.cpp +++ b/service/connect_manager/test/multimodal_input_connect_stub_ex_test.cpp @@ -400,8 +400,6 @@ public: return RET_OK; }; - int32_t SwitchTouchTracking(bool touchTracking) override { return RET_OK; } - int32_t SetMouseAccelerateMotionSwitch(int32_t deviceId, bool enable) override { return RET_OK; diff --git a/service/message_handle/include/server_msg_handler.h b/service/message_handle/include/server_msg_handler.h index 38809573ed042ec6d8c81ee1ddf58a092c6e6777..56b12151863e880e5be06e2520871e3f9a64ee23 100644 --- a/service/message_handle/include/server_msg_handler.h +++ b/service/message_handle/include/server_msg_handler.h @@ -129,7 +129,6 @@ public: bool AddInjectNotice(const InjectNoticeInfo& noticeInfo); int32_t OnTransferBinderClientSrv(const sptr &binderClientObject, int32_t pid); int32_t RegisterWindowStateErrorCallback(SessionPtr sess, NetPacket &pkt); - int32_t SwitchTouchTracking(bool touchTracking); protected: int32_t OnRegisterMsgHandler(SessionPtr sess, NetPacket& pkt); diff --git a/service/message_handle/src/server_msg_handler.cpp b/service/message_handle/src/server_msg_handler.cpp index cd214089667fe0fe7c8ff1b08f8a66407229110c..4d0c6f8fc0d9bb9725d18a31b0ff5008ca3db387 100644 --- a/service/message_handle/src/server_msg_handler.cpp +++ b/service/message_handle/src/server_msg_handler.cpp @@ -877,16 +877,6 @@ int32_t ServerMsgHandler::RegisterWindowStateErrorCallback(SessionPtr sess, NetP return RET_OK; } -int32_t ServerMsgHandler::SwitchTouchTracking(bool touchTracking) -{ - if ((PRODUCT_TYPE != "phone") && (PRODUCT_TYPE != "tablet")) { - MMI_HILOGW("Does not support touch-tracking on %{public}s", PRODUCT_TYPE.c_str()); - return CAPABILITY_NOT_SUPPORTED; - } - WIN_MGR->SwitchTouchTracking(touchTracking); - return RET_OK; -} - #ifdef OHOS_BUILD_ENABLE_SECURITY_COMPONENT int32_t ServerMsgHandler::OnEnhanceConfig(SessionPtr sess, NetPacket &pkt) { diff --git a/service/message_handle/test/server_msg_handler_test.cpp b/service/message_handle/test/server_msg_handler_test.cpp index df2bb1c85e1b8d0f4272a2dfda1e5d3123e63266..05df4d32a4190d932b60efea9e9b9da765474293 100644 --- a/service/message_handle/test/server_msg_handler_test.cpp +++ b/service/message_handle/test/server_msg_handler_test.cpp @@ -3040,21 +3040,5 @@ HWTEST_F(ServerMsgHandlerTest, ServerMsgHandlerTest_FixTargetWindowId_008, TestS handler.nativeTargetWindowIds_[0] = -1; ASSERT_NO_FATAL_FAILURE(handler.FixTargetWindowId(pointerEvent, action, true)); } - -/** -@tc.name: ServerMsgHandlerTest_SwitchTouchTracking -@tc.desc: Test SwitchTouchTracking -@tc.type: FUNC -@tc.require: -*/ -HWTEST_F(ServerMsgHandlerTest, ServerMsgHandlerTest_SwitchTouchTracking, TestSize.Level1) -{ - CALL_TEST_DEBUG; - ServerMsgHandler handler; - bool touchTracking = true; - ASSERT_NO_FATAL_FAILURE(handler.SwitchTouchTracking(touchTracking)); - touchTracking = false; - ASSERT_NO_FATAL_FAILURE(handler.SwitchTouchTracking(touchTracking)); -} } // namespace MMI } // namespace OHOS diff --git a/service/module_loader/include/mmi_service.h b/service/module_loader/include/mmi_service.h index 05c355fcec2609a4e62cf7c05d62366c8ba19399..0b80f2bc71429d2f9dcd88ac54a3c1971b117284 100644 --- a/service/module_loader/include/mmi_service.h +++ b/service/module_loader/include/mmi_service.h @@ -190,7 +190,6 @@ public: void OnAddResSchedSystemAbility(int32_t systemAbilityId, const std::string &deviceId); #endif // OHOS_RSS_CLIENT void OnAddSystemAbility(int32_t systemAbilityId, const std::string& deviceId) override; - void OnRemoveSystemAbility(int32_t systemAbilityId, const std::string& deviceId) override; ErrCode HasIrEmitter(bool &hasIrEmitter) override; ErrCode GetInfraredFrequencies(std::vector& frequencies) override; ErrCode TransmitInfrared(int64_t number, const std::vector& pattern) override; @@ -244,7 +243,6 @@ public: ErrCode GetMaxMultiTouchPointNum(int32_t &pointNum) override; ErrCode SubscribeInputActive(int32_t subscribeId, int64_t interval) override; ErrCode UnsubscribeInputActive(int32_t subscribeId) override; - ErrCode SwitchTouchTracking(bool touchTracking) override; ErrCode SetMouseAccelerateMotionSwitch(int32_t deviceId, bool enable) override; ErrCode SwitchScreenCapturePermission(uint32_t permissionType, bool enable) override; ErrCode ClearMouseHideFlag(int32_t eventId) override; @@ -350,7 +348,6 @@ private: #if defined(OHOS_BUILD_ENABLE_TOUCH) && defined(OHOS_BUILD_ENABLE_MONITOR) void SetupTouchGestureHandler(); #endif // defined(OHOS_BUILD_ENABLE_TOUCH) && defined(OHOS_BUILD_ENABLE_MONITOR) - void OnRemoveAccessibility(); std::atomic state_ = ServiceRunningState::STATE_NOT_START; int32_t mmiFd_ { -1 }; diff --git a/service/module_loader/src/mmi_service.cpp b/service/module_loader/src/mmi_service.cpp index e096351576dc456776f27d2bfe2842cbd0265835..c2f3364c449f6aefe830182572aad47c768e8203 100644 --- a/service/module_loader/src/mmi_service.cpp +++ b/service/module_loader/src/mmi_service.cpp @@ -2327,13 +2327,6 @@ void MMIService::OnAddSystemAbility(int32_t systemAbilityId, const std::string & #endif } -void MMIService::OnRemoveSystemAbility(int32_t systemAbilityId, const std::string& deviceId) -{ - if (systemAbilityId == ACCESSIBILITY_MANAGER_SERVICE_ID) { - OnRemoveAccessibility(); - } -} - #if defined(OHOS_BUILD_ENABLE_MONITOR) && defined(PLAYER_FRAMEWORK_EXISTS) void MMIService::ScreenCaptureCallback(int32_t pid, bool isStart) { @@ -5231,43 +5224,6 @@ ErrCode MMIService::UnsubscribeInputActive(int32_t subscribeId) return RET_OK; } -ErrCode MMIService::SwitchTouchTracking(bool touchTracking) -{ - constexpr int32_t accessibilityUid { 1103 }; - int32_t callingUid = GetCallingUid(); - if ((callingUid != accessibilityUid) || !PER_HELPER->VerifySystemApp()) { - MMI_HILOGE("Verify system APP failed"); - return PERMISSION_DENIED; - } - if (touchTracking) { - if (!AddSystemAbilityListener(ACCESSIBILITY_MANAGER_SERVICE_ID)) { - MMI_HILOGE("AddSystemAbilityListener(%{public}d) fail", ACCESSIBILITY_MANAGER_SERVICE_ID); - } - } else { - if (!RemoveSystemAbilityListener(ACCESSIBILITY_MANAGER_SERVICE_ID)) { - MMI_HILOGE("RemoveSystemAbilityListener(%{public}d) fail", ACCESSIBILITY_MANAGER_SERVICE_ID); - } - } - auto ret = delegateTasks_.PostSyncTask([this, touchTracking] { - return sMsgHandler_.SwitchTouchTracking(touchTracking); - }); - if (ret != RET_OK) { - MMI_HILOGE("PostSyncTask-SwitchTouchTracking fail, error:%{public}d", ret); - } - return ret; -} - -void MMIService::OnRemoveAccessibility() -{ - auto ret = delegateTasks_.PostSyncTask([this] { - MMI_HILOGI("Reset touch-tracking on removal of Accessibility"); - return sMsgHandler_.SwitchTouchTracking(false); - }); - if (ret != RET_OK) { - MMI_HILOGE("PostSyncTask-SwitchTouchTracking fail, error:%{public}d", ret); - } -} - ErrCode MMIService::SetMouseAccelerateMotionSwitch(int32_t deviceId, bool enable) { CALL_INFO_TRACE; diff --git a/service/window_manager/include/i_input_windows_manager.h b/service/window_manager/include/i_input_windows_manager.h index 32081a1c2ac4a9cf884d7d3df5b00ce0704e562b..b76670e6fdebaac9c736892d83c271c043990aa5 100644 --- a/service/window_manager/include/i_input_windows_manager.h +++ b/service/window_manager/include/i_input_windows_manager.h @@ -183,7 +183,6 @@ public: #endif // OHOS_BUILD_ENABLE_TOUCH virtual std::pair CalcDrawCoordinate(const DisplayInfo& displayInfo, PointerEvent::PointerItem pointerItem) = 0; - virtual void SwitchTouchTracking(bool touchTracking) = 0; static std::shared_ptr GetInstance(); static void DestroyInstance(); diff --git a/service/window_manager/include/input_windows_manager.h b/service/window_manager/include/input_windows_manager.h index f73a192407d61634622a14607ae2a78f6eaa7c9c..90203df2f96bb135d6fdc1707485c6dc5f3f9129 100644 --- a/service/window_manager/include/input_windows_manager.h +++ b/service/window_manager/include/input_windows_manager.h @@ -225,7 +225,6 @@ public: std::pair CalcDrawCoordinate(const DisplayInfo& displayInfo, PointerEvent::PointerItem pointerItem); #endif // OHOS_BUILD_ENABLE_TOUCH - void SwitchTouchTracking(bool touchTracking); #ifdef OHOS_BUILD_ENABLE_VKEYBOARD bool IsPointInsideGuideWindow(double x, double y); bool IsMouseInCastWindow(); @@ -547,7 +546,6 @@ private: std::shared_ptr lastPointerEventforGesture_ { nullptr }; #endif // OHOS_BUILD_ENABLE_TOUCH bool IsFoldable_ { false }; - bool touchTracking_ { false }; int32_t timerId_ { -1 }; int32_t lastDpi_ { 0 }; std::map lastDpiMap_; diff --git a/service/window_manager/src/input_windows_manager.cpp b/service/window_manager/src/input_windows_manager.cpp index a37afd0c597a74ed82fea9426217de372946490c..bd1f9e0b98bb090748b894d95bf00e707aa11be8 100644 --- a/service/window_manager/src/input_windows_manager.cpp +++ b/service/window_manager/src/input_windows_manager.cpp @@ -7292,21 +7292,12 @@ bool InputWindowsManager::IsAccessibilityEventWithZorderInjected(std::shared_ptr return false; } -void InputWindowsManager::SwitchTouchTracking(bool touchTracking) -{ - MMI_HILOGI("Switch touch tracking:%{public}d", touchTracking); - touchTracking_ = touchTracking; -} - bool InputWindowsManager::NeedTouchTracking(PointerEvent &event) const { - if (!touchTracking_) { - return false; - } - if (event.HasFlag(InputEvent::EVENT_FLAG_ACCESSIBILITY)) { + if (!event.HasFlag(InputEvent::EVENT_FLAG_ACCESSIBILITY)) { return false; } - if (event.GetPointerAction() != PointerEvent::POINTER_ACTION_MOVE) { + if (event.GetPointerAction() != PointerEvent::POINTER_ACTION_HOVER_MOVE) { return false; } return (event.GetPointerCount() == SINGLE_TOUCH); @@ -7327,7 +7318,7 @@ void InputWindowsManager::ProcessTouchTracking(std::shared_ptr eve } pointerItem.SetPressed(false); event->UpdatePointerItem(event->GetPointerId(), pointerItem); - event->SetPointerAction(PointerEvent::POINTER_ACTION_CANCEL); + event->SetPointerAction(PointerEvent::POINTER_ACTION_HOVER_CANCEL); auto normalizeHandler = InputHandler->GetEventNormalizeHandler(); CHKPV(normalizeHandler); @@ -7335,7 +7326,7 @@ void InputWindowsManager::ProcessTouchTracking(std::shared_ptr eve pointerItem.SetPressed(true); event->UpdatePointerItem(event->GetPointerId(), pointerItem); - event->SetPointerAction(PointerEvent::POINTER_ACTION_DOWN); + event->SetPointerAction(PointerEvent::POINTER_ACTION_HOVER_ENTER); } int32_t InputWindowsManager::ClearMouseHideFlag(int32_t eventId) diff --git a/service/window_manager/test/input_windows_manager_one_test.cpp b/service/window_manager/test/input_windows_manager_one_test.cpp index 6fb1d222599551185c4306cf7f83e69c0670d67e..a3c410d26acd678c51e9cd6394938401d1ff33eb 100644 --- a/service/window_manager/test/input_windows_manager_one_test.cpp +++ b/service/window_manager/test/input_windows_manager_one_test.cpp @@ -1964,8 +1964,7 @@ HWTEST_F(InputWindowsManagerOneTest, InputWindowsManagerOneTest_ProcessTouchTrac pointerItem.SetDisplayYPos(0.0); WindowInfo targetWindow; targetWindow.id = 1; - pointerEvent->SetPointerAction(PointerEvent::POINTER_ACTION_MOVE); - inputWindowsManager->touchTracking_ = true; + pointerEvent->SetPointerAction(PointerEvent::POINTER_ACTION_HOVER_MOVE); pointerEvent->targetWindowId_ = 1; pointerEvent->pointers_.clear(); pointerItem.SetPointerId(1); diff --git a/test/facility/mock/include/input_windows_manager_mock.h b/test/facility/mock/include/input_windows_manager_mock.h index ca8bde22f7d51b7751feb57bad0915276ca81eff..7d8f28895e35e615e78470860f2a1a41e7a023cb 100644 --- a/test/facility/mock/include/input_windows_manager_mock.h +++ b/test/facility/mock/include/input_windows_manager_mock.h @@ -149,7 +149,6 @@ public: #ifdef OHOS_BUILD_ENABLE_TOUCH MOCK_METHOD(std::shared_ptr, GetLastPointerEventForGesture, ()); #endif // OHOS_BUILD_ENABLE_TOUCH - void SwitchTouchTracking(bool touchTracking) override {} static std::shared_ptr GetInstance(); static void ReleaseInstance();