From a92ed9eb8424479be7af751443e22422ee9dc28f Mon Sep 17 00:00:00 2001 From: z-hf Date: Thu, 22 May 2025 22:04:19 +0800 Subject: [PATCH 1/4] fix bug Signed-off-by: z-hf --- .../include/input_manager_impl.h | 1 + .../event_handler/src/input_manager_impl.cpp | 5 ++++ frameworks/proxy/events/src/input_manager.cpp | 5 ++++ .../proxy/events/test/input_manager_test.cpp | 14 +++++++++++ .../innerkits/proxy/include/input_manager.h | 9 ++++++++ .../include/i_multimodal_input_connect.h | 1 + .../multimodal_input_connect_manager.h | 1 + .../include/multimodal_input_connect_proxy.h | 1 + .../include/multimodal_input_connect_stub.h | 1 + .../multimodalinput_ipc_interface_code.h | 1 + .../src/multimodal_input_connect_manager.cpp | 7 ++++++ .../src/multimodal_input_connect_proxy.cpp | 23 +++++++++++++++++++ .../src/multimodal_input_connect_stub.cpp | 22 ++++++++++++++++++ .../test/mock_multimodal_input_connect_stub.h | 1 + .../multimodal_input_connect_stub_ex_test.cpp | 4 ++++ service/module_loader/include/mmi_service.h | 1 + service/module_loader/src/mmi_service.cpp | 15 ++++++++++++ .../include/mouse_event_normalize.h | 1 + .../include/mouse_transform_processor.h | 2 ++ .../src/mouse_event_normalize.cpp | 13 +++++++++++ .../src/mouse_transform_processor.cpp | 13 +++++++++++ 21 files changed, 141 insertions(+) diff --git a/frameworks/proxy/event_handler/include/input_manager_impl.h b/frameworks/proxy/event_handler/include/input_manager_impl.h index 2f73a31533..77ca7fadc3 100644 --- a/frameworks/proxy/event_handler/include/input_manager_impl.h +++ b/frameworks/proxy/event_handler/include/input_manager_impl.h @@ -92,6 +92,7 @@ public: int32_t SetInputDeviceConsumer(const std::vector& deviceName, std::shared_ptr consumer); void OnDeviceConsumerEvent(std::shared_ptr pointerEvent); + int32_t SetMouseAccelerateMotionSwitch(int32_t deviceId, bool enable); #ifdef OHOS_BUILD_ENABLE_KEYBOARD void OnKeyEvent(std::shared_ptr keyEvent); diff --git a/frameworks/proxy/event_handler/src/input_manager_impl.cpp b/frameworks/proxy/event_handler/src/input_manager_impl.cpp index 3441999ff8..1d09640bb6 100644 --- a/frameworks/proxy/event_handler/src/input_manager_impl.cpp +++ b/frameworks/proxy/event_handler/src/input_manager_impl.cpp @@ -2890,5 +2890,10 @@ int32_t InputManagerImpl::SwitchTouchTracking(bool touchTracking) } return MULTIMODAL_INPUT_CONNECT_MGR->SwitchTouchTracking(touchTracking); } + +int32_t InputManagerImpl::SetMouseAccelerateMotionSwitch(int32_t deviceId, bool enable) +{ + return MULTIMODAL_INPUT_CONNECT_MGR->SetMouseAccelerateMotionSwitch(deviceId, enable); +} } // namespace MMI } // namespace OHOS \ No newline at end of file diff --git a/frameworks/proxy/events/src/input_manager.cpp b/frameworks/proxy/events/src/input_manager.cpp index 36aef0dbda..5f26ddba2f 100644 --- a/frameworks/proxy/events/src/input_manager.cpp +++ b/frameworks/proxy/events/src/input_manager.cpp @@ -941,5 +941,10 @@ int32_t InputManager::SwitchTouchTracking(bool touchTracking) { return InputMgrImpl.SwitchTouchTracking(touchTracking); } + +int32_t InputManager::SetMouseAccelerateMotionSwitch(int32_t deviceId, bool enable) +{ + return InputMgrImpl.SetMouseAccelerateMotionSwitch(deviceId, enable); +} } // namespace MMI } // namespace OHOS diff --git a/frameworks/proxy/events/test/input_manager_test.cpp b/frameworks/proxy/events/test/input_manager_test.cpp index 882a29d074..2ccf8b402d 100644 --- a/frameworks/proxy/events/test/input_manager_test.cpp +++ b/frameworks/proxy/events/test/input_manager_test.cpp @@ -5493,6 +5493,20 @@ HWTEST_F(InputManagerTest, InputManagerTest_SubscribeKeyEvent_024, TestSize.Leve #endif // OHOS_BUILD_ENABLE_KEYBOARD } +/* + * @tc.name: InputManagerTest_SetMouseAccelerateMotionSwitch + * @tc.desc: SetMouseAccelerateMotionSwitch + * @tc.type: FUNC + * @tc.require: + */ +HWTEST_F(InputManagerTest, InputManagerTest_SetMouseAccelerateMotionSwitch, TestSize.Level1) +{ + CALL_TEST_DEBUG; + int32_t deviceId = 0; + std::shared_ptr inputManager = std::make_shared(); + ASSERT_NO_FATAL_FAILURE(inputManager->SetMouseAccelerateMotionSwitch(deviceId, true)); +} + /* * @tc.name: InputManagerTest_AddPreMonitor_001 * @tc.desc: AddPreMonitor. diff --git a/interfaces/native/innerkits/proxy/include/input_manager.h b/interfaces/native/innerkits/proxy/include/input_manager.h index 571324193e..5b3fd5c10d 100644 --- a/interfaces/native/innerkits/proxy/include/input_manager.h +++ b/interfaces/native/innerkits/proxy/include/input_manager.h @@ -1221,6 +1221,15 @@ public: int32_t SwitchTouchTracking(bool touchTracking); + /** + * @brief Enables or disables the mouse acceleration feature. + * @param deviceId The identifier of the input device. + * @param enable A boolean value; true to enable acceleration, false to disable it. + * @return Returns 0 on success, or a non-zero error code on failure. + * @since 20 + */ + int32_t SetMouseAccelerateMotionSwitch(int32_t deviceId, bool enable); + private: InputManager() = default; DISALLOW_COPY_AND_MOVE(InputManager); diff --git a/service/connect_manager/include/i_multimodal_input_connect.h b/service/connect_manager/include/i_multimodal_input_connect.h index e41b001b74..5b09c2d3f1 100644 --- a/service/connect_manager/include/i_multimodal_input_connect.h +++ b/service/connect_manager/include/i_multimodal_input_connect.h @@ -193,6 +193,7 @@ public: virtual int32_t SubscribeInputActive(int32_t subscribeId, int64_t interval) = 0; virtual int32_t UnsubscribeInputActive(int32_t subscribeId) = 0; virtual int32_t SwitchTouchTracking(bool touchTracking) = 0; + virtual int32_t SetMouseAccelerateMotionSwitch(int32_t deviceId, bool enable) = 0; }; } // namespace MMI } // namespace OHOS diff --git a/service/connect_manager/include/multimodal_input_connect_manager.h b/service/connect_manager/include/multimodal_input_connect_manager.h index bb3bbcfc9d..20cb8a53c9 100644 --- a/service/connect_manager/include/multimodal_input_connect_manager.h +++ b/service/connect_manager/include/multimodal_input_connect_manager.h @@ -181,6 +181,7 @@ public: 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); private: MultimodalInputConnectManager() = default; diff --git a/service/connect_manager/include/multimodal_input_connect_proxy.h b/service/connect_manager/include/multimodal_input_connect_proxy.h index c1e0b79ac7..e8b32b46b0 100644 --- a/service/connect_manager/include/multimodal_input_connect_proxy.h +++ b/service/connect_manager/include/multimodal_input_connect_proxy.h @@ -179,6 +179,7 @@ public: int32_t SubscribeInputActive(int32_t subscribeId, int64_t interval) override; int32_t UnsubscribeInputActive(int32_t subscribeId) override; int32_t SwitchTouchTracking(bool touchTracking) override; + int32_t SetMouseAccelerateMotionSwitch(int32_t deviceId, bool enable) override; private: static inline BrokerDelegator delegator_; diff --git a/service/connect_manager/include/multimodal_input_connect_stub.h b/service/connect_manager/include/multimodal_input_connect_stub.h index 4faf1259d7..3fbf4d47e4 100644 --- a/service/connect_manager/include/multimodal_input_connect_stub.h +++ b/service/connect_manager/include/multimodal_input_connect_stub.h @@ -218,6 +218,7 @@ protected: int32_t StubSubscribeInputActive(MessageParcel& data, MessageParcel& reply); int32_t StubUnsubscribeInputActive(MessageParcel& data, MessageParcel& reply); int32_t StubSwitchTouchTracking(MessageParcel& data, MessageParcel& reply); + int32_t StubSetMouseAccelerateMotionSwitch(MessageParcel& data, MessageParcel& reply); private: int32_t VerifyTouchPadSetting(void); diff --git a/service/connect_manager/include/multimodalinput_ipc_interface_code.h b/service/connect_manager/include/multimodalinput_ipc_interface_code.h index 27362afef2..e6177c75e5 100644 --- a/service/connect_manager/include/multimodalinput_ipc_interface_code.h +++ b/service/connect_manager/include/multimodalinput_ipc_interface_code.h @@ -144,6 +144,7 @@ enum class MultimodalinputConnectInterfaceCode { REMOVE_DEVICE_CONSUMER = 129, SUBSCRIBE_INPUT_ACTIVE = 130, UNSUBSCRIBE_INPUT_ACTIVE = 131, + SET_MOUSE_ACCELERATE_MOTION_SWITCH = 132, #ifdef OHOS_BUILD_ENABLE_VKEYBOARD CREATE_VKEYBOARD_DEVICE = 153, #endif // OHOS_BUILD_ENABLE_VKEYBOARD diff --git a/service/connect_manager/src/multimodal_input_connect_manager.cpp b/service/connect_manager/src/multimodal_input_connect_manager.cpp index b4fa7be331..6de223b36d 100644 --- a/service/connect_manager/src/multimodal_input_connect_manager.cpp +++ b/service/connect_manager/src/multimodal_input_connect_manager.cpp @@ -1123,5 +1123,12 @@ int32_t MultimodalInputConnectManager::SwitchTouchTracking(bool touchTracking) CHKPR(multimodalInputConnectService_, INVALID_HANDLER_ID); return multimodalInputConnectService_->SwitchTouchTracking(touchTracking); } + +int32_t MultimodalInputConnectManager::SetMouseAccelerateMotionSwitch(int32_t deviceId, bool enable) +{ + std::lock_guard guard(lock_); + CHKPR(multimodalInputConnectService_, INVALID_HANDLER_ID); + return multimodalInputConnectService_->SetMouseAccelerateMotionSwitch(deviceId, enable); +} } // namespace MMI } // namespace OHOS diff --git a/service/connect_manager/src/multimodal_input_connect_proxy.cpp b/service/connect_manager/src/multimodal_input_connect_proxy.cpp index bc72a58e73..4f96a7c51d 100644 --- a/service/connect_manager/src/multimodal_input_connect_proxy.cpp +++ b/service/connect_manager/src/multimodal_input_connect_proxy.cpp @@ -3193,5 +3193,28 @@ int32_t MultimodalInputConnectProxy::SwitchTouchTracking(bool touchTracking) } return ret; } + +int32_t MultimodalInputConnectProxy::SetMouseAccelerateMotionSwitch(int32_t deviceId, bool enable) +{ + CALL_DEBUG_ENTER; + MessageParcel data; + if (!data.WriteInterfaceToken(MultimodalInputConnectProxy::GetDescriptor())) { + MMI_HILOGE("Failed to write descriptor"); + return ERR_INVALID_VALUE; + } + WRITEINT32(data, deviceId, ERR_INVALID_VALUE); + WRITEBOOL(data, enable, ERR_INVALID_VALUE); + MessageParcel reply; + MessageOption option; + sptr remote = Remote(); + CHKPR(remote, RET_ERR); + int32_t ret = remote->SendRequest( + static_cast(MultimodalinputConnectInterfaceCode::SET_MOUSE_ACCELERATE_MOTION_SWITCH), + data, reply, option); + if (ret != RET_OK) { + MMI_HILOGE("Send request fail, ret:%{public}d", ret); + } + return ret; +} } // namespace MMI } // namespace OHOS diff --git a/service/connect_manager/src/multimodal_input_connect_stub.cpp b/service/connect_manager/src/multimodal_input_connect_stub.cpp index 8e8f411b4b..0397b12d47 100644 --- a/service/connect_manager/src/multimodal_input_connect_stub.cpp +++ b/service/connect_manager/src/multimodal_input_connect_stub.cpp @@ -504,6 +504,9 @@ int32_t MultimodalInputConnectStub::OnRemoteRequest(uint32_t code, MessageParcel case static_cast(MultimodalinputConnectInterfaceCode::LAUNCH_AI_SCREEN_ABILITY): ret = StubLaunchAiScreenAbility(data, reply); break; + case static_cast(MultimodalinputConnectInterfaceCode::SET_MOUSE_ACCELERATE_MOTION_SWITCH): + ret = StubSetMouseAccelerateMotionSwitch(data, reply); + break; #ifdef OHOS_BUILD_ENABLE_KEY_PRESSED_HANDLER case static_cast(MultimodalinputConnectInterfaceCode::SUBSCRIBE_KEY_MONITOR): ret = StubSubscribeKeyMonitor(data, reply); @@ -3764,5 +3767,24 @@ int32_t MultimodalInputConnectStub::StubSwitchTouchTracking(MessageParcel& data, SwitchTouchTracking(touchTracking); return RET_OK; } + +int32_t MultimodalInputConnectStub::StubSetMouseAccelerateMotionSwitch(MessageParcel &data, MessageParcel &reply) +{ + CALL_DEBUG_ENTER; + if (!PER_HELPER->RequestFromShell()) { + MMI_HILOGE("Verify Request From Shell failed"); + return ERROR_NO_PERMISSION; + } + bool enable = true; + int32_t deviceId { -1 }; + READINT32(data, deviceId, IPC_PROXY_DEAD_OBJECT_ERR); + READBOOL(data, enable, IPC_PROXY_DEAD_OBJECT_ERR); + int32_t ret = SetMouseAccelerateMotionSwitch(deviceId, enable); + if (ret != RET_OK) { + MMI_HILOGE("Call SetMouseAccelerateMotionSwitch failed, ret:%{public}d", ret); + return ret; + } + return RET_OK; +} } // namespace MMI } // namespace OHOS 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 22ebd61a21..01aa99abb7 100644 --- a/service/connect_manager/test/mock_multimodal_input_connect_stub.h +++ b/service/connect_manager/test/mock_multimodal_input_connect_stub.h @@ -206,6 +206,7 @@ public: 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)); }; } // namespace MMI } // namespace OHOS 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 1a85e0d941..37e79246a3 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 @@ -402,6 +402,10 @@ public: int32_t SwitchTouchTracking(bool touchTracking) override { return RET_OK; } + int32_t SetMouseAccelerateMotionSwitch(int32_t deviceId, bool enable) override + { + return RET_OK; + }; std::atomic state_ = ServiceRunningState::STATE_NOT_START; int32_t rows_ = 0; int32_t size_ = 0; diff --git a/service/module_loader/include/mmi_service.h b/service/module_loader/include/mmi_service.h index 2d64a2e56f..06e6e92833 100644 --- a/service/module_loader/include/mmi_service.h +++ b/service/module_loader/include/mmi_service.h @@ -213,6 +213,7 @@ public: int32_t SubscribeInputActive(int32_t subscribeId, int64_t interval) override; int32_t UnsubscribeInputActive(int32_t subscribeId) override; int32_t SwitchTouchTracking(bool touchTracking) override; + int32_t SetMouseAccelerateMotionSwitch(int32_t deviceId, bool enable) override; protected: void OnConnected(SessionPtr s) override; diff --git a/service/module_loader/src/mmi_service.cpp b/service/module_loader/src/mmi_service.cpp index 215585f47c..dbafadfef0 100644 --- a/service/module_loader/src/mmi_service.cpp +++ b/service/module_loader/src/mmi_service.cpp @@ -3997,5 +3997,20 @@ void MMIService::OnRemoveAccessibility() MMI_HILOGE("PostSyncTask-SwitchTouchTracking fail, error:%{public}d", ret); } } + +int32_t MMIService::SetMouseAccelerateMotionSwitch(int32_t deviceId, bool enable) +{ + CALL_INFO_TRACE; + int32_t ret = delegateTasks_.PostSyncTask( + [deviceId, enable] { + return MouseEventHdr->SetMouseAccelerateMotionSwitch(deviceId, enable); + } + ); + if (ret != RET_OK) { + MMI_HILOGE("Set accelerate motion switch failed, return:%{public}d", ret); + return ret; + } + return RET_OK; +} } // namespace MMI } // namespace OHOS diff --git a/service/mouse_event_normalize/include/mouse_event_normalize.h b/service/mouse_event_normalize/include/mouse_event_normalize.h index 13ac56c602..7dbbea2f10 100644 --- a/service/mouse_event_normalize/include/mouse_event_normalize.h +++ b/service/mouse_event_normalize/include/mouse_event_normalize.h @@ -56,6 +56,7 @@ public: int32_t SetTouchpadPointerSpeed(int32_t speed) const; void GetTouchpadPointerSpeed(int32_t &speed) const; void GetTouchpadCDG(TouchpadCDG &touchpadCDG) const; + int32_t SetMouseAccelerateMotionSwitch(int32_t deviceId, bool enable); private: std::shared_ptr GetProcessor(int32_t deviceId) const; diff --git a/service/mouse_event_normalize/include/mouse_transform_processor.h b/service/mouse_event_normalize/include/mouse_transform_processor.h index 08a05b5102..ab61fa1b83 100644 --- a/service/mouse_event_normalize/include/mouse_transform_processor.h +++ b/service/mouse_event_normalize/include/mouse_transform_processor.h @@ -106,6 +106,7 @@ public: void HandleFilterMouseEvent(Offset* offset); bool CheckFilterMouseEvent(struct libinput_event *event); #endif // OHOS_BUILD_MOUSE_REPORTING_RATE + int32_t SetMouseAccelerateMotionSwitch(bool enable); private: int32_t HandleMotionInner(struct libinput_event_pointer* data, struct libinput_event *event); @@ -204,6 +205,7 @@ private: return TimerMgr->ResetTimer(timerId); } }; + bool enableMouseAleaccelerateBool_ { true }; #ifdef OHOS_BUILD_MOUSE_REPORTING_RATE struct FilterInsertionPoint filterInsertionPoint_; #endif // OHOS_BUILD_MOUSE_REPORTING_RATE diff --git a/service/mouse_event_normalize/src/mouse_event_normalize.cpp b/service/mouse_event_normalize/src/mouse_event_normalize.cpp index ddcd63f949..642dcf71c2 100644 --- a/service/mouse_event_normalize/src/mouse_event_normalize.cpp +++ b/service/mouse_event_normalize/src/mouse_event_normalize.cpp @@ -265,5 +265,18 @@ bool MouseEventNormalize::CheckFilterMouseEvent(struct libinput_event *event) return processor->CheckFilterMouseEvent(event); } #endif // OHOS_BUILD_MOUSE_REPORTING_RATE + +int32_t MouseEventNormalize::SetMouseAccelerateMotionSwitch(int32_t deviceId, bool enable) +{ + std::shared_ptr processor { nullptr }; + if (auto it = processors_.find(deviceId); it != processors_.end()) { + processor = it->second; + } else { + processor = std::make_shared(deviceId); + [[ maybe_unused ]] auto [tIter, isOk] = processors_.emplace(deviceId, processor); + } + processor->SetMouseAccelerateMotionSwitch(enable); + return RET_OK; +} } // namespace MMI } // namespace OHOS diff --git a/service/mouse_event_normalize/src/mouse_transform_processor.cpp b/service/mouse_event_normalize/src/mouse_transform_processor.cpp index 63df771010..8374d685f6 100644 --- a/service/mouse_event_normalize/src/mouse_transform_processor.cpp +++ b/service/mouse_event_normalize/src/mouse_transform_processor.cpp @@ -209,6 +209,12 @@ int32_t MouseTransformProcessor::UpdateMouseMoveLocation(const DisplayInfo* disp HandleFilterMouseEvent(&offset); CalculateOffset(displayInfo, offset); #endif // OHOS_BUILD_MOUSE_REPORTING_RATE + if (!enableMouseAleaccelerateBool_) { + abs_x += offset.dx; + abs_y += offset.dy; + ret = RET_OK; + return ret; + } if (displayInfo->ppi > static_cast(CONST_DOUBLE_ZERO)) { double displaySize = sqrt(pow(displayInfo->width, CONST_TWO) + pow(displayInfo->height, CONST_TWO)); double diagonalMm = sqrt(pow(displayInfo->physicalWidth, CONST_TWO) @@ -1529,6 +1535,13 @@ void MouseTransformProcessor::GetConfigDataFromDatabase(std::string &key, int32_ value = PREFERENCES_MGR->GetIntValue(key, defaultValue); } +int32_t MouseTransformProcessor::SetMouseAccelerateMotionSwitch(bool enable) +{ + enableMouseAleaccelerateBool_ = enable; + MMI_HILOGI("Set accelerate motion switch is %{public}d", enableMouseAleaccelerateBool_); + return RET_OK; +} + #ifdef OHOS_BUILD_MOUSE_REPORTING_RATE void MouseTransformProcessor::HandleFilterMouseEvent(Offset* offset) { -- Gitee From ff536902d139d1c826578668116b092e046c3b5c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E6=B5=B7=E5=B3=B0?= Date: Fri, 23 May 2025 03:29:02 +0000 Subject: [PATCH 2/4] update interfaces/native/innerkits/proxy/include/input_manager.h. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 张海峰 --- interfaces/native/innerkits/proxy/include/input_manager.h | 1 + 1 file changed, 1 insertion(+) diff --git a/interfaces/native/innerkits/proxy/include/input_manager.h b/interfaces/native/innerkits/proxy/include/input_manager.h index 5b3fd5c10d..4c5bc2dee2 100644 --- a/interfaces/native/innerkits/proxy/include/input_manager.h +++ b/interfaces/native/innerkits/proxy/include/input_manager.h @@ -1223,6 +1223,7 @@ public: /** * @brief Enables or disables the mouse acceleration feature. + * @note Only users with specific shell permissions are allowed to call this interface. * @param deviceId The identifier of the input device. * @param enable A boolean value; true to enable acceleration, false to disable it. * @return Returns 0 on success, or a non-zero error code on failure. -- Gitee From d1afe859bd5416c3d16078ba997b05545c321a59 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E6=B5=B7=E5=B3=B0?= Date: Fri, 23 May 2025 03:30:46 +0000 Subject: [PATCH 3/4] update service/mouse_event_normalize/src/mouse_event_normalize.cpp. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 张海峰 --- service/mouse_event_normalize/src/mouse_event_normalize.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/service/mouse_event_normalize/src/mouse_event_normalize.cpp b/service/mouse_event_normalize/src/mouse_event_normalize.cpp index 642dcf71c2..b0e9dffd61 100644 --- a/service/mouse_event_normalize/src/mouse_event_normalize.cpp +++ b/service/mouse_event_normalize/src/mouse_event_normalize.cpp @@ -275,6 +275,7 @@ int32_t MouseEventNormalize::SetMouseAccelerateMotionSwitch(int32_t deviceId, bo processor = std::make_shared(deviceId); [[ maybe_unused ]] auto [tIter, isOk] = processors_.emplace(deviceId, processor); } + CHKPR(processor, RET_ERR); processor->SetMouseAccelerateMotionSwitch(enable); return RET_OK; } -- Gitee From c643b3948b930ba67e4d0ff62fa497de42375e30 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E6=B5=B7=E5=B3=B0?= Date: Fri, 23 May 2025 03:31:41 +0000 Subject: [PATCH 4/4] update service/mouse_event_normalize/src/mouse_transform_processor.cpp. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 张海峰 --- service/mouse_event_normalize/src/mouse_transform_processor.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/service/mouse_event_normalize/src/mouse_transform_processor.cpp b/service/mouse_event_normalize/src/mouse_transform_processor.cpp index 8374d685f6..c0291e6b72 100644 --- a/service/mouse_event_normalize/src/mouse_transform_processor.cpp +++ b/service/mouse_event_normalize/src/mouse_transform_processor.cpp @@ -213,6 +213,7 @@ int32_t MouseTransformProcessor::UpdateMouseMoveLocation(const DisplayInfo* disp abs_x += offset.dx; abs_y += offset.dy; ret = RET_OK; + MMI_HILOGD("Skip mouse acceleration motion"); return ret; } if (displayInfo->ppi > static_cast(CONST_DOUBLE_ZERO)) { -- Gitee