From 3323b929ae0d58c4c249bdded7f263c5fea4bb8a Mon Sep 17 00:00:00 2001 From: ry521 Date: Thu, 19 Oct 2023 13:38:34 +0000 Subject: [PATCH 01/18] update services/source/inputinject/include/distributed_input_inject.h. Signed-off-by: ry521 --- services/source/inputinject/include/distributed_input_inject.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/services/source/inputinject/include/distributed_input_inject.h b/services/source/inputinject/include/distributed_input_inject.h index bd93c55..65b9757 100644 --- a/services/source/inputinject/include/distributed_input_inject.h +++ b/services/source/inputinject/include/distributed_input_inject.h @@ -47,6 +47,8 @@ public: int32_t RegisterInputNodeListener(sptr listener); int32_t UnregisterInputNodeListener(sptr listener); int32_t GetDhIdsByInputType(const std::string &devId, const uint32_t &inputTypes, std::vector &dhIds); + int32_t RegisterInjectEventCb(sptr callback); + int32_t UnregisterInjectEventCb(); void NotifyNodeMgrScanVirNode(const std::string &dhId); void InputDeviceEventInject(const std::shared_ptr &rawEvent); -- Gitee From 8b7975778f4b4a4dfe66de7dd1b28055d8399e2f Mon Sep 17 00:00:00 2001 From: ry521 Date: Thu, 19 Oct 2023 13:40:24 +0000 Subject: [PATCH 02/18] update services/source/inputinject/src/distributed_input_inject.cpp. Signed-off-by: ry521 --- .../inputinject/src/distributed_input_inject.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/services/source/inputinject/src/distributed_input_inject.cpp b/services/source/inputinject/src/distributed_input_inject.cpp index ea4a948..f09795d 100644 --- a/services/source/inputinject/src/distributed_input_inject.cpp +++ b/services/source/inputinject/src/distributed_input_inject.cpp @@ -256,6 +256,22 @@ int32_t DistributedInputInject::GetVirtualTouchScreenFd() return inputNodeManager_->GetVirtualTouchScreenFd(); } +int32_t DistributedInputInject::RegisterInjectEventCb(sptr callback) +{ + if (callback == nullptr) { + DHLOGE("RegisterInjectEventCb callback is null."); + return ERR_DH_INPUT_SERVER_SOURCE_MANAGER_INJECT_EVENT_CB_IS_NULL; + } + inputNodeManager_->RegisterInjectEventCb(callback); + return DH_SUCCESS; +} + +int32_t DistributedInputInject::UnregisterInjectEventCb() +{ + inputNodeManager_->UnregisterInjectEventCb(); + return DH_SUCCESS; +} + void DistributedInputInject::GetVirtualKeyboardPathsByDhIds(const std::vector &dhIds, std::vector &virKeyboardPaths, std::vector &virKeyboardDhIds) { -- Gitee From 182c34946b50ed2e4dc2b12963043512cb1913e3 Mon Sep 17 00:00:00 2001 From: ry521 Date: Thu, 19 Oct 2023 13:42:14 +0000 Subject: [PATCH 03/18] update services/source/inputinject/include/distributed_input_node_manager.h. Signed-off-by: ry521 --- .../inputinject/include/distributed_input_node_manager.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/services/source/inputinject/include/distributed_input_node_manager.h b/services/source/inputinject/include/distributed_input_node_manager.h index db423e4..84164a1 100644 --- a/services/source/inputinject/include/distributed_input_node_manager.h +++ b/services/source/inputinject/include/distributed_input_node_manager.h @@ -29,6 +29,7 @@ #include "constants_dinput.h" #include "input_hub.h" +#include "i_session_state_callback.h" #include "virtual_device.h" namespace OHOS { @@ -64,6 +65,8 @@ public: void UpdateSpecEventFirstStatus(bool status); void UpdateSpecEventState(DhIdState state); void InjectInputEvent(const std::string &dhId, const struct input_event &event); + void RegisterInjectEventCb(sptr callback); + void UnregisterInjectEventCb(); class DInputNodeManagerEventHandler : public AppExecFwk::EventHandler { public: @@ -93,6 +96,7 @@ private: bool IsVirtualDev(int fd); bool GetDevDhIdByFd(int fd, std::string &dhId, std::string &physicalPath); void SetPathForDevMap(const std::string &dhId, const std::string &devicePath); + void RunInjectEventCallback(const std::string &dhId); /* the key is dhId, and the value is virtualDevice */ std::map> virtualDeviceMap_; @@ -110,6 +114,7 @@ private: std::shared_ptr callBackHandler_; std::atomic isFirst_; DhIdState specEventState_; + sptr InjectEventCallback_; }; } // namespace DistributedInput } // namespace DistributedHardware -- Gitee From da25cc4f9a41b2fc826457976e9b85f80e5d9b4f Mon Sep 17 00:00:00 2001 From: ry521 Date: Thu, 19 Oct 2023 13:44:07 +0000 Subject: [PATCH 04/18] update services/source/inputinject/src/distributed_input_node_manager.cpp. Signed-off-by: ry521 --- .../src/distributed_input_node_manager.cpp | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/services/source/inputinject/src/distributed_input_node_manager.cpp b/services/source/inputinject/src/distributed_input_node_manager.cpp index bdde0f5..b4f0c1d 100644 --- a/services/source/inputinject/src/distributed_input_node_manager.cpp +++ b/services/source/inputinject/src/distributed_input_node_manager.cpp @@ -453,6 +453,7 @@ void DistributedInputNodeManager::InjectInputEvent(const std::string &dhId, cons VirtualDevice* device = nullptr; if (GetDevice(dhId, device) < 0) { DHLOGE("could not find the device"); + RunInjectEventCallback(dhId); return; } if (device != nullptr) { @@ -460,6 +461,27 @@ void DistributedInputNodeManager::InjectInputEvent(const std::string &dhId, cons } } +void DistributedInputNodeManager::RegisterInjectEventCb(sptr callback) +{ + DHLOGI("RegisterInjectEventCb"); + InjectEventCallback_ = callback; +} + +void DistributedInputNodeManager::UnregisterInjectEventCb() +{ + DHLOGI("UnregisterInjectEventCb"); + InjectEventCallback_ = nullptr; +} + +void DistributedInputNodeManager::RunInjectEventCallback(const std::string &dhId) +{ + DHLOGI("RunInjectEventCallback start."); + if (InjectEventCallback_ != nullptr) { + return; + } + DHLOGI("RunInjectEventCallback InjectEventCallback_ is null."); +} + void DistributedInputNodeManager::ProcessInjectEvent(const std::shared_ptr &rawEvent) { std::string dhId = rawEvent->descriptor; -- Gitee From 2f33ed3eac533f2de326057897f1bb1db6abc408 Mon Sep 17 00:00:00 2001 From: ry521 Date: Thu, 19 Oct 2023 13:45:41 +0000 Subject: [PATCH 05/18] update services/source/sourcemanager/include/distributed_input_source_manager.h. Signed-off-by: ry521 --- .../sourcemanager/include/distributed_input_source_manager.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/services/source/sourcemanager/include/distributed_input_source_manager.h b/services/source/sourcemanager/include/distributed_input_source_manager.h index dfad600..6abe119 100644 --- a/services/source/sourcemanager/include/distributed_input_source_manager.h +++ b/services/source/sourcemanager/include/distributed_input_source_manager.h @@ -186,6 +186,8 @@ public: int32_t RegisterSessionStateCb(sptr callback) override; int32_t UnregisterSessionStateCb() override; + int32_t RegisterInjectEventCb(sptr callback) override; + int32_t UnregisterInjectEventCb() override; bool CheckRegisterParam(const std::string &devId, const std::string &dhId, const std::string ¶meters, sptr callback); -- Gitee From cbd06103944615d98940cf2adfecb7b22d4ba136 Mon Sep 17 00:00:00 2001 From: ry521 Date: Thu, 19 Oct 2023 13:48:38 +0000 Subject: [PATCH 06/18] update services/source/sourcemanager/src/distributed_input_source_manager.cpp. Signed-off-by: ry521 --- .../sourcemanager/src/distributed_input_source_manager.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/services/source/sourcemanager/src/distributed_input_source_manager.cpp b/services/source/sourcemanager/src/distributed_input_source_manager.cpp index e1a8656..a8b2a5e 100644 --- a/services/source/sourcemanager/src/distributed_input_source_manager.cpp +++ b/services/source/sourcemanager/src/distributed_input_source_manager.cpp @@ -1220,11 +1220,13 @@ int32_t DistributedInputSourceManager::RegisterSessionStateCb(sptr Date: Thu, 19 Oct 2023 13:53:33 +0000 Subject: [PATCH 07/18] update services/source/inputinject/include/distributed_input_node_manager.h. Signed-off-by: ry521 --- .../inputinject/include/distributed_input_node_manager.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/services/source/inputinject/include/distributed_input_node_manager.h b/services/source/inputinject/include/distributed_input_node_manager.h index 84164a1..063f651 100644 --- a/services/source/inputinject/include/distributed_input_node_manager.h +++ b/services/source/inputinject/include/distributed_input_node_manager.h @@ -36,6 +36,7 @@ namespace OHOS { namespace DistributedHardware { namespace DistributedInput { constexpr uint32_t DINPUT_NODE_MANAGER_SCAN_ALL_NODE = 1; +constexpr uint32_t DINPUT_INJECT_EVENT_FAIL = 2; const std::string INPUT_NODE_DHID = "dhId"; class DistributedInputNodeManager { public: @@ -96,7 +97,7 @@ private: bool IsVirtualDev(int fd); bool GetDevDhIdByFd(int fd, std::string &dhId, std::string &physicalPath); void SetPathForDevMap(const std::string &dhId, const std::string &devicePath); - void RunInjectEventCallback(const std::string &dhId); + void RunInjectEventCallback(const std::string &dhId, const uint32_t injectEvent); /* the key is dhId, and the value is virtualDevice */ std::map> virtualDeviceMap_; -- Gitee From 3302dea77756777a11b7f14dad651ded9f58676b Mon Sep 17 00:00:00 2001 From: ry521 Date: Thu, 19 Oct 2023 13:57:04 +0000 Subject: [PATCH 08/18] update services/source/inputinject/src/distributed_input_node_manager.cpp. Signed-off-by: ry521 --- .../inputinject/src/distributed_input_node_manager.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/services/source/inputinject/src/distributed_input_node_manager.cpp b/services/source/inputinject/src/distributed_input_node_manager.cpp index b4f0c1d..fc011d4 100644 --- a/services/source/inputinject/src/distributed_input_node_manager.cpp +++ b/services/source/inputinject/src/distributed_input_node_manager.cpp @@ -453,7 +453,7 @@ void DistributedInputNodeManager::InjectInputEvent(const std::string &dhId, cons VirtualDevice* device = nullptr; if (GetDevice(dhId, device) < 0) { DHLOGE("could not find the device"); - RunInjectEventCallback(dhId); + RunInjectEventCallback(dhId, DINPUT_INJECT_EVENT_FAIL); return; } if (device != nullptr) { @@ -464,19 +464,20 @@ void DistributedInputNodeManager::InjectInputEvent(const std::string &dhId, cons void DistributedInputNodeManager::RegisterInjectEventCb(sptr callback) { DHLOGI("RegisterInjectEventCb"); - InjectEventCallback_ = callback; + SessionStateCallback_ = callback; } void DistributedInputNodeManager::UnregisterInjectEventCb() { DHLOGI("UnregisterInjectEventCb"); - InjectEventCallback_ = nullptr; + SessionStateCallback_ = nullptr; } void DistributedInputNodeManager::RunInjectEventCallback(const std::string &dhId) { DHLOGI("RunInjectEventCallback start."); - if (InjectEventCallback_ != nullptr) { + if (SessionStateCallback_ != nullptr) { + SessionStateCallback_->OnResult(dhId, DINPUT_INJECT_EVENT_FAIL); return; } DHLOGI("RunInjectEventCallback InjectEventCallback_ is null."); -- Gitee From 5482310cd99b756e72c933d35383a45229ab4652 Mon Sep 17 00:00:00 2001 From: ry521 Date: Thu, 19 Oct 2023 13:57:59 +0000 Subject: [PATCH 09/18] update services/transportbase/src/distributed_input_transport_base.cpp. Signed-off-by: ry521 --- services/transportbase/src/distributed_input_transport_base.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/transportbase/src/distributed_input_transport_base.cpp b/services/transportbase/src/distributed_input_transport_base.cpp index 4371130..43ce5aa 100644 --- a/services/transportbase/src/distributed_input_transport_base.cpp +++ b/services/transportbase/src/distributed_input_transport_base.cpp @@ -307,7 +307,7 @@ void DistributedInputTransportBase::RunSessionStateCallback(const std::string &r SessionStateCallback_->OnResult(remoteDevId, sessionState); return; } - DHLOGI("RunSessionStateCallback SessionStateCallback_ is null."); + DHLOGE("RunSessionStateCallback SessionStateCallback_ is null."); } int32_t DistributedInputTransportBase::CountSession(const std::string &remoteDevId) -- Gitee From 42de91c09a98b500a6ec879a42f06e55bd81b5ee Mon Sep 17 00:00:00 2001 From: ry521 Date: Thu, 19 Oct 2023 13:59:49 +0000 Subject: [PATCH 10/18] update services/source/inputinject/include/distributed_input_node_manager.h. Signed-off-by: ry521 --- .../source/inputinject/include/distributed_input_node_manager.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/source/inputinject/include/distributed_input_node_manager.h b/services/source/inputinject/include/distributed_input_node_manager.h index 063f651..ddae65d 100644 --- a/services/source/inputinject/include/distributed_input_node_manager.h +++ b/services/source/inputinject/include/distributed_input_node_manager.h @@ -115,7 +115,7 @@ private: std::shared_ptr callBackHandler_; std::atomic isFirst_; DhIdState specEventState_; - sptr InjectEventCallback_; + sptr SessionStateCallback_; }; } // namespace DistributedInput } // namespace DistributedHardware -- Gitee From 7cfa16276222b14ae6216863a3fdc3c120683258 Mon Sep 17 00:00:00 2001 From: ry521 Date: Thu, 19 Oct 2023 14:01:19 +0000 Subject: [PATCH 11/18] update common/include/dinput_errcode.h. Signed-off-by: ry521 --- common/include/dinput_errcode.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/common/include/dinput_errcode.h b/common/include/dinput_errcode.h index 8d545bd..eb7053d 100644 --- a/common/include/dinput_errcode.h +++ b/common/include/dinput_errcode.h @@ -177,6 +177,9 @@ namespace DistributedInput { constexpr int32_t ERR_DH_INPUT_CLIENT_UNREGISTER_SESSION_STATE_FAIL = -67058; constexpr int32_t ERR_DH_INPUT_SRC_STUB_REGISTER_SESSION_STATE_FAIL = -67059; constexpr int32_t ERR_DH_INPUT_SRC_STUB_UNREGISTER_SESSION_STATE_FAIL = -67060; + constexpr int32_t ERR_DH_INPUT_SRC_ENABLE_PERMISSION_CHECK_FAIL = -67061; + constexpr int32_t ERR_DH_INPUT_SRC_ACCESS_PERMISSION_CHECK_FAIL = -67062; + constexpr int32_t ERR_DH_INPUT_SINK_ENABLE_PERMISSION_CHECK_FAIL = -67063; // Hidump Helper error code constexpr int32_t ERR_DH_INPUT_HIDUMP_INVALID_ARGS = -68000; -- Gitee From 7c6f2a3e39f26e3d855702503d500764ffa6f27f Mon Sep 17 00:00:00 2001 From: ry521 Date: Thu, 19 Oct 2023 14:05:33 +0000 Subject: [PATCH 12/18] update interfaces/ipc/src/distributed_input_source_stub.cpp. Signed-off-by: ry521 --- .../ipc/src/distributed_input_source_stub.cpp | 36 +++++++++---------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/interfaces/ipc/src/distributed_input_source_stub.cpp b/interfaces/ipc/src/distributed_input_source_stub.cpp index ec8200d..8afb6b8 100644 --- a/interfaces/ipc/src/distributed_input_source_stub.cpp +++ b/interfaces/ipc/src/distributed_input_source_stub.cpp @@ -107,7 +107,7 @@ int32_t DistributedInputSourceStub::HandleInitDistributedHardware(MessageParcel { if (!HasEnableDHPermission()) { DHLOGE("The caller has no ENABLE_DISTRIBUTED_HARDWARE permission."); - return ERR_DH_INPUT_CLIENT_STOP_FAIL; + return ERR_DH_INPUT_SRC_ENABLE_PERMISSION_CHECK_FAIL; } std::unique_lock lock(operatorMutex_); if (sourceManagerInitFlag_.load()) { @@ -127,7 +127,7 @@ int32_t DistributedInputSourceStub::HandleReleaseDistributedHardware(MessageParc { if (!HasEnableDHPermission()) { DHLOGE("The caller has no ENABLE_DISTRIBUTED_HARDWARE permission."); - return ERR_DH_INPUT_CLIENT_STOP_FAIL; + return ERR_DH_INPUT_SRC_ENABLE_PERMISSION_CHECK_FAIL; } std::unique_lock lock(operatorMutex_); if (!sourceManagerInitFlag_.load()) { @@ -147,7 +147,7 @@ int32_t DistributedInputSourceStub::HandleRegisterDistributedHardware(MessagePar { if (!HasEnableDHPermission()) { DHLOGE("The caller has no ENABLE_DISTRIBUTED_HARDWARE permission."); - return ERR_DH_INPUT_CLIENT_STOP_FAIL; + return ERR_DH_INPUT_SRC_ENABLE_PERMISSION_CHECK_FAIL; } std::string devId = data.ReadString(); std::string dhId = data.ReadString(); @@ -169,7 +169,7 @@ int32_t DistributedInputSourceStub::HandleUnregisterDistributedHardware(MessageP { if (!HasEnableDHPermission()) { DHLOGE("The caller has no ENABLE_DISTRIBUTED_HARDWARE permission."); - return ERR_DH_INPUT_CLIENT_STOP_FAIL; + return ERR_DH_INPUT_SRC_ENABLE_PERMISSION_CHECK_FAIL; } std::string devId = data.ReadString(); std::string dhId = data.ReadString(); @@ -190,7 +190,7 @@ int32_t DistributedInputSourceStub::HandlePrepareRemoteInput(MessageParcel &data { if (!HasAccessDHPermission()) { DHLOGE("The caller has no ACCESS_DISTRIBUTED_HARDWARE permission."); - return ERR_DH_INPUT_CLIENT_STOP_FAIL; + return ERR_DH_INPUT_SRC_ACCESS_PERMISSION_CHECK_FAIL; } std::string deviceId = data.ReadString(); sptr callback = iface_cast(data.ReadRemoteObject()); @@ -210,7 +210,7 @@ int32_t DistributedInputSourceStub::HandleUnprepareRemoteInput(MessageParcel &da { if (!HasAccessDHPermission()) { DHLOGE("The caller has no ACCESS_DISTRIBUTED_HARDWARE permission."); - return ERR_DH_INPUT_CLIENT_STOP_FAIL; + return ERR_DH_INPUT_SRC_ACCESS_PERMISSION_CHECK_FAIL; } std::string deviceId = data.ReadString(); sptr callback = iface_cast(data.ReadRemoteObject()); @@ -230,7 +230,7 @@ int32_t DistributedInputSourceStub::HandleStartRemoteInput(MessageParcel &data, { if (!HasAccessDHPermission()) { DHLOGE("The caller has no ACCESS_DISTRIBUTED_HARDWARE permission."); - return ERR_DH_INPUT_CLIENT_STOP_FAIL; + return ERR_DH_INPUT_SRC_ACCESS_PERMISSION_CHECK_FAIL; } std::string deviceId = data.ReadString(); uint32_t inputTypes = data.ReadUint32(); @@ -251,7 +251,7 @@ int32_t DistributedInputSourceStub::HandleStopRemoteInput(MessageParcel &data, M { if (!HasAccessDHPermission()) { DHLOGE("The caller has no ACCESS_DISTRIBUTED_HARDWARE permission."); - return ERR_DH_INPUT_CLIENT_STOP_FAIL; + return ERR_DH_INPUT_SRC_ACCESS_PERMISSION_CHECK_FAIL; } std::string deviceId = data.ReadString(); uint32_t inputTypes = data.ReadUint32(); @@ -272,7 +272,7 @@ int32_t DistributedInputSourceStub::HandleStartRelayTypeRemoteInput(MessageParce { if (!HasAccessDHPermission()) { DHLOGE("The caller has no ACCESS_DISTRIBUTED_HARDWARE permission."); - return ERR_DH_INPUT_CLIENT_STOP_FAIL; + return ERR_DH_INPUT_SRC_ACCESS_PERMISSION_CHECK_FAIL; } std::string srcId = data.ReadString(); std::string sinkId = data.ReadString(); @@ -294,7 +294,7 @@ int32_t DistributedInputSourceStub::HandleStopRelayTypeRemoteInput(MessageParcel { if (!HasAccessDHPermission()) { DHLOGE("The caller has no ACCESS_DISTRIBUTED_HARDWARE permission."); - return ERR_DH_INPUT_CLIENT_STOP_FAIL; + return ERR_DH_INPUT_SRC_ACCESS_PERMISSION_CHECK_FAIL; } std::string srcId = data.ReadString(); std::string sinkId = data.ReadString(); @@ -316,7 +316,7 @@ int32_t DistributedInputSourceStub::HandlePrepareRelayRemoteInput(MessageParcel { if (!HasAccessDHPermission()) { DHLOGE("The caller has no ACCESS_DISTRIBUTED_HARDWARE permission."); - return ERR_DH_INPUT_CLIENT_STOP_FAIL; + return ERR_DH_INPUT_SRC_ACCESS_PERMISSION_CHECK_FAIL; } std::string srcId = data.ReadString(); std::string sinkId = data.ReadString(); @@ -337,7 +337,7 @@ int32_t DistributedInputSourceStub::HandleUnprepareRelayRemoteInput(MessageParce { if (!HasAccessDHPermission()) { DHLOGE("The caller has no ACCESS_DISTRIBUTED_HARDWARE permission."); - return ERR_DH_INPUT_CLIENT_STOP_FAIL; + return ERR_DH_INPUT_SRC_ACCESS_PERMISSION_CHECK_FAIL; } std::string srcId = data.ReadString(); std::string sinkId = data.ReadString(); @@ -358,7 +358,7 @@ int32_t DistributedInputSourceStub::HandleStartDhidRemoteInput(MessageParcel &da { if (!HasAccessDHPermission()) { DHLOGE("The caller has no ACCESS_DISTRIBUTED_HARDWARE permission."); - return ERR_DH_INPUT_CLIENT_STOP_FAIL; + return ERR_DH_INPUT_SRC_ACCESS_PERMISSION_CHECK_FAIL; } std::string sinkId = data.ReadString(); @@ -395,7 +395,7 @@ int32_t DistributedInputSourceStub::HandleStopDhidRemoteInput(MessageParcel &dat { if (!HasAccessDHPermission()) { DHLOGE("The caller has no ACCESS_DISTRIBUTED_HARDWARE permission."); - return ERR_DH_INPUT_CLIENT_STOP_FAIL; + return ERR_DH_INPUT_SRC_ACCESS_PERMISSION_CHECK_FAIL; } std::string sinkId = data.ReadString(); @@ -432,7 +432,7 @@ int32_t DistributedInputSourceStub::HandleStartRelayDhidRemoteInput(MessageParce { if (!HasAccessDHPermission()) { DHLOGE("The caller has no ACCESS_DISTRIBUTED_HARDWARE permission."); - return ERR_DH_INPUT_CLIENT_STOP_FAIL; + return ERR_DH_INPUT_SRC_ACCESS_PERMISSION_CHECK_FAIL; } std::string srcId = data.ReadString(); std::string sinkId = data.ReadString(); @@ -470,7 +470,7 @@ int32_t DistributedInputSourceStub::HandleStopRelayDhidRemoteInput(MessageParcel { if (!HasAccessDHPermission()) { DHLOGE("The caller has no ACCESS_DISTRIBUTED_HARDWARE permission."); - return ERR_DH_INPUT_CLIENT_STOP_FAIL; + return ERR_DH_INPUT_SRC_ACCESS_PERMISSION_CHECK_FAIL; } std::string srcId = data.ReadString(); std::string sinkId = data.ReadString(); @@ -616,7 +616,7 @@ int32_t DistributedInputSourceStub::HandleRegisterSessionStateCb(MessageParcel & { if (!HasAccessDHPermission()) { DHLOGE("The caller has no ACCESS_DISTRIBUTED_HARDWARE permission."); - return ERR_DH_INPUT_CLIENT_STOP_FAIL; + return ERR_DH_INPUT_SRC_ACCESS_PERMISSION_CHECK_FAIL; } sptr callback = iface_cast(data.ReadRemoteObject()); if (callback == nullptr) { @@ -636,7 +636,7 @@ int32_t DistributedInputSourceStub::HandleUnregisterSessionStateCb(MessageParcel { if (!HasAccessDHPermission()) { DHLOGE("The caller has no ACCESS_DISTRIBUTED_HARDWARE permission."); - return ERR_DH_INPUT_CLIENT_STOP_FAIL; + return ERR_DH_INPUT_SRC_ACCESS_PERMISSION_CHECK_FAIL; } int32_t ret = UnregisterSessionStateCb(); if (!reply.WriteInt32(ret)) { -- Gitee From 079bd6fe1299c47a9823095c04296f2c75bb0c5a Mon Sep 17 00:00:00 2001 From: ry521 Date: Thu, 19 Oct 2023 14:06:00 +0000 Subject: [PATCH 13/18] update interfaces/ipc/src/distributed_input_sink_stub.cpp. Signed-off-by: ry521 --- interfaces/ipc/src/distributed_input_sink_stub.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/interfaces/ipc/src/distributed_input_sink_stub.cpp b/interfaces/ipc/src/distributed_input_sink_stub.cpp index 300de42..819ca78 100644 --- a/interfaces/ipc/src/distributed_input_sink_stub.cpp +++ b/interfaces/ipc/src/distributed_input_sink_stub.cpp @@ -79,7 +79,7 @@ int32_t DistributedInputSinkStub::InitInner(MessageParcel &data, MessageParcel & { if (!HasEnableDHPermission()) { DHLOGE("The caller has no ENABLE_DISTRIBUTED_HARDWARE permission."); - return ERR_DH_INPUT_CLIENT_STOP_FAIL; + return ERR_DH_INPUT_SINK_ENABLE_PERMISSION_CHECK_FAIL; } DHLOGI("DistributedInputSinkStub InitInner start"); int32_t ret = Init(); @@ -94,7 +94,7 @@ int32_t DistributedInputSinkStub::ReleaseInner(MessageParcel &data, MessageParce { if (!HasEnableDHPermission()) { DHLOGE("The caller has no ENABLE_DISTRIBUTED_HARDWARE permission."); - return ERR_DH_INPUT_CLIENT_STOP_FAIL; + return ERR_DH_INPUT_SINK_ENABLE_PERMISSION_CHECK_FAIL; } int32_t ret = Release(); if (!reply.WriteInt32(ret)) { -- Gitee From 9551fe9434ceab34e92f0d491de47d1539acb4c8 Mon Sep 17 00:00:00 2001 From: ry521 Date: Fri, 20 Oct 2023 01:28:24 +0000 Subject: [PATCH 14/18] update services/source/inputinject/src/distributed_input_node_manager.cpp. Signed-off-by: ry521 --- .../source/inputinject/src/distributed_input_node_manager.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/source/inputinject/src/distributed_input_node_manager.cpp b/services/source/inputinject/src/distributed_input_node_manager.cpp index fc011d4..4f7938a 100644 --- a/services/source/inputinject/src/distributed_input_node_manager.cpp +++ b/services/source/inputinject/src/distributed_input_node_manager.cpp @@ -473,7 +473,7 @@ void DistributedInputNodeManager::UnregisterInjectEventCb() SessionStateCallback_ = nullptr; } -void DistributedInputNodeManager::RunInjectEventCallback(const std::string &dhId) +void DistributedInputNodeManager::RunInjectEventCallback(const std::string &dhId, const uint32_t injectEvent) { DHLOGI("RunInjectEventCallback start."); if (SessionStateCallback_ != nullptr) { -- Gitee From ddf058761b2264e2f77b6ceb30422829c2bbafe8 Mon Sep 17 00:00:00 2001 From: ry521 Date: Fri, 20 Oct 2023 01:30:15 +0000 Subject: [PATCH 15/18] update common/include/dinput_errcode.h. Signed-off-by: ry521 --- common/include/dinput_errcode.h | 1 + 1 file changed, 1 insertion(+) diff --git a/common/include/dinput_errcode.h b/common/include/dinput_errcode.h index eb7053d..d439913 100644 --- a/common/include/dinput_errcode.h +++ b/common/include/dinput_errcode.h @@ -110,6 +110,7 @@ namespace DistributedInput { constexpr int32_t ERR_DH_INPUT_SERVER_SOURCE_MANAGER_DH_FWK_KIT_IS_NULL = -65038; constexpr int32_t ERR_DH_INPUT_SERVER_SOURCE_MANAGER_NODE_LISTENER_CALLBACK_ERR = -65039; constexpr int32_t ERR_DH_INPUT_SERVER_SOURCE_MANAGER_SESSION_STATE_CB_IS_NULL = -65040; + constexpr int32_t ERR_DH_INPUT_SERVER_SOURCE_MANAGER_INJECT_EVENT_CB_IS_NULL = -65041; // handler error code constexpr int32_t ERR_DH_INPUT_SINK_HANDLER_INIT_SINK_SA_FAIL = -66000; -- Gitee From 40fa2e399b9736403b22932f4f43cbc00c26003f Mon Sep 17 00:00:00 2001 From: ry521 Date: Fri, 20 Oct 2023 01:51:00 +0000 Subject: [PATCH 16/18] update services/source/sourcemanager/include/distributed_input_source_manager.h. Signed-off-by: ry521 --- .../sourcemanager/include/distributed_input_source_manager.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/services/source/sourcemanager/include/distributed_input_source_manager.h b/services/source/sourcemanager/include/distributed_input_source_manager.h index 6abe119..dfad600 100644 --- a/services/source/sourcemanager/include/distributed_input_source_manager.h +++ b/services/source/sourcemanager/include/distributed_input_source_manager.h @@ -186,8 +186,6 @@ public: int32_t RegisterSessionStateCb(sptr callback) override; int32_t UnregisterSessionStateCb() override; - int32_t RegisterInjectEventCb(sptr callback) override; - int32_t UnregisterInjectEventCb() override; bool CheckRegisterParam(const std::string &devId, const std::string &dhId, const std::string ¶meters, sptr callback); -- Gitee From 5b3a98875216494b1467dc5c9f61e2471e0f2997 Mon Sep 17 00:00:00 2001 From: ry521 Date: Fri, 20 Oct 2023 02:33:40 +0000 Subject: [PATCH 17/18] update services/source/inputinject/src/distributed_input_node_manager.cpp. Signed-off-by: ry521 --- .../source/inputinject/src/distributed_input_node_manager.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/source/inputinject/src/distributed_input_node_manager.cpp b/services/source/inputinject/src/distributed_input_node_manager.cpp index 4f7938a..fc28508 100644 --- a/services/source/inputinject/src/distributed_input_node_manager.cpp +++ b/services/source/inputinject/src/distributed_input_node_manager.cpp @@ -480,7 +480,7 @@ void DistributedInputNodeManager::RunInjectEventCallback(const std::string &dhId SessionStateCallback_->OnResult(dhId, DINPUT_INJECT_EVENT_FAIL); return; } - DHLOGI("RunInjectEventCallback InjectEventCallback_ is null."); + DHLOGI("RunSessionStateCallback SessionStateCallback_ is null."); } void DistributedInputNodeManager::ProcessInjectEvent(const std::shared_ptr &rawEvent) -- Gitee From bf8ef1584cf65559dc4109cb96e7b466577b6ee1 Mon Sep 17 00:00:00 2001 From: ry521 Date: Fri, 20 Oct 2023 03:13:30 +0000 Subject: [PATCH 18/18] update services/source/inputinject/src/distributed_input_node_manager.cpp. Signed-off-by: ry521 --- .../inputinject/src/distributed_input_node_manager.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/services/source/inputinject/src/distributed_input_node_manager.cpp b/services/source/inputinject/src/distributed_input_node_manager.cpp index fc28508..28889a4 100644 --- a/services/source/inputinject/src/distributed_input_node_manager.cpp +++ b/services/source/inputinject/src/distributed_input_node_manager.cpp @@ -476,11 +476,11 @@ void DistributedInputNodeManager::UnregisterInjectEventCb() void DistributedInputNodeManager::RunInjectEventCallback(const std::string &dhId, const uint32_t injectEvent) { DHLOGI("RunInjectEventCallback start."); - if (SessionStateCallback_ != nullptr) { - SessionStateCallback_->OnResult(dhId, DINPUT_INJECT_EVENT_FAIL); + if (SessionStateCallback_ == nullptr) { + DHLOGE("RunSessionStateCallback SessionStateCallback_ is null."); return; } - DHLOGI("RunSessionStateCallback SessionStateCallback_ is null."); + SessionStateCallback_->OnResult(dhId, DINPUT_INJECT_EVENT_FAIL); } void DistributedInputNodeManager::ProcessInjectEvent(const std::shared_ptr &rawEvent) -- Gitee