diff --git a/common/include/white_list_util.cpp b/common/include/white_list_util.cpp index f7418bc..470a5f9 100644 --- a/common/include/white_list_util.cpp +++ b/common/include/white_list_util.cpp @@ -274,7 +274,7 @@ bool WhiteListUtil::IsNeedFilterOut(const std::string &deviceId, const BusinessE std::lock_guard lock(mutex_); if (combKeysHashMap_.empty()) { - DHLOGE("%s called, whilte list is empty!", __func__); + DHLOGE("%s called, white list is empty!", __func__); return false; } diff --git a/dfx_utils/BUILD.gn b/dfx_utils/BUILD.gn index 96fdbe3..f343f2d 100644 --- a/dfx_utils/BUILD.gn +++ b/dfx_utils/BUILD.gn @@ -59,5 +59,4 @@ ohos_shared_library("libdinput_dfx_utils") { subsystem_name = "distributedhardware" part_name = "distributed_input" - } diff --git a/dfx_utils/include/hisysevent_util.h b/dfx_utils/include/hisysevent_util.h index 5c0f0a5..d3590ba 100644 --- a/dfx_utils/include/hisysevent_util.h +++ b/dfx_utils/include/hisysevent_util.h @@ -17,6 +17,7 @@ #define OHOS_DISTRIBUTED_INPUT_HISYSEVENT_UTILS_H #include + #include "single_instance.h" #include "hisysevent.h" #include "constants_dinput.h" @@ -52,8 +53,7 @@ private: HisyseventUtil() = default; ~HisyseventUtil() = default; }; -} // namespace DistributedInput -} // namespace DistributedHardware -} // namespace OHOS - -#endif // OHOS_DISTRIBUTED_INPUT_HISYSEVENT_UTILS_H \ No newline at end of file +} // namespace DistributedInput +} // namespace DistributedHardware +} // namespace OHOS +#endif diff --git a/dfx_utils/src/hidumper.cpp b/dfx_utils/src/hidumper.cpp index ec967d9..360d052 100644 --- a/dfx_utils/src/hidumper.cpp +++ b/dfx_utils/src/hidumper.cpp @@ -175,11 +175,11 @@ int32_t HiDumper::ShowHelp(std::string &result) { DHLOGI("ShowHelp Dump."); result.append("Usage:dump [options]\n") - .append("Description:\n") - .append("-nodeinfo ") - .append("dump all input node information in the system\n") - .append("-sessioninfo ") - .append("dump all input session information in the system\n"); + .append("Description:\n") + .append("-nodeinfo ") + .append("dump all input node information in the system\n") + .append("-sessioninfo ") + .append("dump all input session information in the system\n"); return DH_SUCCESS; } @@ -220,6 +220,7 @@ void HiDumper::SetSessionStatus(const std::string& remoteDevId, const SessionSta } sessionInfos_[remoteDevId].sessionStatus_ = sessionStatus; } -} -} -} +} // namespace DistributedInput +} // namespace DistributedHardware +} // namespace OHOS + diff --git a/inputdevicehandler/include/distributed_input_handler.h b/inputdevicehandler/include/distributed_input_handler.h index 9dad11c..f22507a 100644 --- a/inputdevicehandler/include/distributed_input_handler.h +++ b/inputdevicehandler/include/distributed_input_handler.h @@ -60,8 +60,8 @@ private: void StopInputMonitorDeviceThread(); // The event queue. - static const int INPUT_DEVICR_BUFFER_SIZE = 32; - InputDeviceEvent mEventBuffer[INPUT_DEVICR_BUFFER_SIZE] = {}; + static const int INPUT_DEVICE_BUFFER_SIZE = 32; + InputDeviceEvent mEventBuffer[INPUT_DEVICE_BUFFER_SIZE] = {}; std::mutex operationMutex_; std::unique_ptr inputHub_; }; diff --git a/inputdevicehandler/src/distributed_input_handler.cpp b/inputdevicehandler/src/distributed_input_handler.cpp index d7068b8..ebb0fd9 100644 --- a/inputdevicehandler/src/distributed_input_handler.cpp +++ b/inputdevicehandler/src/distributed_input_handler.cpp @@ -166,7 +166,7 @@ void *DistributedInputHandler::CollectEventsThread(void *param) void DistributedInputHandler::StartInputMonitorDeviceThread(const std::string deviceId) { while (isCollectingEvents_) { - size_t count = inputHub_->StartCollectInputHandler(mEventBuffer, INPUT_DEVICR_BUFFER_SIZE); + size_t count = inputHub_->StartCollectInputHandler(mEventBuffer, INPUT_DEVICE_BUFFER_SIZE); if (count > 0) { DHLOGI("Count: %zu", count); for (size_t iCnt = 0; iCnt < count; iCnt++) { diff --git a/interfaces/ipc/include/dinput_sa_manager.h b/interfaces/ipc/include/dinput_sa_manager.h index 85a738c..4857bf7 100644 --- a/interfaces/ipc/include/dinput_sa_manager.h +++ b/interfaces/ipc/include/dinput_sa_manager.h @@ -30,8 +30,8 @@ namespace OHOS { namespace DistributedHardware { namespace DistributedInput { -class DinputSAManager { -DECLARE_SINGLE_INSTANCE_BASE(DinputSAManager); +class DInputSAManager { +DECLARE_SINGLE_INSTANCE_BASE(DInputSAManager); public: void Init(); bool GetDInputSourceProxy(); @@ -43,14 +43,14 @@ public: public: class SystemAbilityListener : public SystemAbilityStatusChangeStub { - public: - void OnAddSystemAbility(int32_t systemAbilityId, const std::string& deviceId) override; - void OnRemoveSystemAbility(int32_t systemAbilityId, const std::string& deviceId) override; +public: + void OnAddSystemAbility(int32_t systemAbilityId, const std::string& deviceId) override; + void OnRemoveSystemAbility(int32_t systemAbilityId, const std::string& deviceId) override; }; private: - DinputSAManager() = default; - ~DinputSAManager() = default; + DInputSAManager() = default; + ~DInputSAManager() = default; public: std::atomic dInputSourceSAOnline = false; @@ -67,5 +67,4 @@ public: } // namespace DistributedInput } // namespace DistributedHardware } // namespace OHOS - -#endif // DINPUT_SA_MANAGER_H \ No newline at end of file +#endif \ No newline at end of file diff --git a/interfaces/ipc/src/dinput_sa_manager.cpp b/interfaces/ipc/src/dinput_sa_manager.cpp index 82083e1..d16af5d 100644 --- a/interfaces/ipc/src/dinput_sa_manager.cpp +++ b/interfaces/ipc/src/dinput_sa_manager.cpp @@ -25,34 +25,33 @@ namespace OHOS { namespace DistributedHardware { namespace DistributedInput { -IMPLEMENT_SINGLE_INSTANCE(DinputSAManager); +IMPLEMENT_SINGLE_INSTANCE(DInputSAManager); -void DinputSAManager::SystemAbilityListener::OnRemoveSystemAbility(int32_t systemAbilityId, - const std::string& deviceId) +void DInputSAManager::SystemAbilityListener::OnRemoveSystemAbility(int32_t systemAbilityId, const std::string &deviceId) { if (systemAbilityId == DISTRIBUTED_HARDWARE_INPUT_SOURCE_SA_ID) { - DinputSAManager::GetInstance().dInputSourceSAOnline.store(false); - std::lock_guard lock(DinputSAManager::GetInstance().sourceMutex_); - DinputSAManager::GetInstance().dInputSourceProxy_ = nullptr; + DInputSAManager::GetInstance().dInputSourceSAOnline.store(false); + std::lock_guard lock(DInputSAManager::GetInstance().sourceMutex_); + DInputSAManager::GetInstance().dInputSourceProxy_ = nullptr; } else if (systemAbilityId == DISTRIBUTED_HARDWARE_INPUT_SINK_SA_ID) { - DinputSAManager::GetInstance().dInputSinkSAOnline.store(false); - std::lock_guard lock(DinputSAManager::GetInstance().sinkMutex_); - DinputSAManager::GetInstance().dInputSinkProxy_ = nullptr; + DInputSAManager::GetInstance().dInputSinkSAOnline.store(false); + std::lock_guard lock(DInputSAManager::GetInstance().sinkMutex_); + DInputSAManager::GetInstance().dInputSinkProxy_ = nullptr; } DHLOGI("sa %d is removed.", systemAbilityId); } -void DinputSAManager::SystemAbilityListener::OnAddSystemAbility(int32_t systemAbilityId, const std::string& deviceId) +void DInputSAManager::SystemAbilityListener::OnAddSystemAbility(int32_t systemAbilityId, const std::string &deviceId) { if (systemAbilityId == DISTRIBUTED_HARDWARE_INPUT_SOURCE_SA_ID) { - DinputSAManager::GetInstance().dInputSourceSAOnline.store(true); + DInputSAManager::GetInstance().dInputSourceSAOnline.store(true); } else if (systemAbilityId == DISTRIBUTED_HARDWARE_INPUT_SINK_SA_ID) { - DinputSAManager::GetInstance().dInputSinkSAOnline.store(true); + DInputSAManager::GetInstance().dInputSinkSAOnline.store(true); } DHLOGI("sa %d is added.", systemAbilityId); } -void DinputSAManager::Init() +void DInputSAManager::Init() { saListenerCallback = new(std::nothrow) SystemAbilityListener(); sptr systemAbilityManager = @@ -86,10 +85,10 @@ void DinputSAManager::Init() } } -bool DinputSAManager::GetDInputSourceProxy() +bool DInputSAManager::GetDInputSourceProxy() { if (!isSubscribeSrcSAChangeListener.load()) { - std::lock_guard lock(DinputSAManager::GetInstance().sourceMutex_); + std::lock_guard lock(DInputSAManager::GetInstance().sourceMutex_); if (!isSubscribeSrcSAChangeListener.load()) { sptr systemAbilityManager = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager(); @@ -110,7 +109,7 @@ bool DinputSAManager::GetDInputSourceProxy() } if (dInputSourceSAOnline.load() && !dInputSourceProxy_) { - std::lock_guard lock(DinputSAManager::GetInstance().sourceMutex_); + std::lock_guard lock(DInputSAManager::GetInstance().sourceMutex_); if (dInputSourceProxy_ != nullptr) { DHLOGI("dinput source proxy has already got."); return true; @@ -135,19 +134,19 @@ bool DinputSAManager::GetDInputSourceProxy() return false; } } - std::lock_guard lock(DinputSAManager::GetInstance().sourceMutex_); + std::lock_guard lock(DInputSAManager::GetInstance().sourceMutex_); return dInputSourceProxy_ != nullptr; } -bool DinputSAManager::HasDInputSourceProxy() +bool DInputSAManager::HasDInputSourceProxy() { - std::lock_guard lock(DinputSAManager::GetInstance().sourceMutex_); + std::lock_guard lock(DInputSAManager::GetInstance().sourceMutex_); return dInputSourceProxy_ != nullptr; } -bool DinputSAManager::SetDInputSourceProxy(const sptr &remoteObject) +bool DInputSAManager::SetDInputSourceProxy(const sptr &remoteObject) { - std::lock_guard lock(DinputSAManager::GetInstance().sourceMutex_); + std::lock_guard lock(DInputSAManager::GetInstance().sourceMutex_); dInputSourceProxy_ = iface_cast(remoteObject); if ((!dInputSourceProxy_) || (!dInputSourceProxy_->AsObject())) { @@ -157,10 +156,10 @@ bool DinputSAManager::SetDInputSourceProxy(const sptr &remoteObje return true; } -bool DinputSAManager::GetDInputSinkProxy() +bool DInputSAManager::GetDInputSinkProxy() { if (!isSubscribeSinkSAChangeListener.load()) { - std::lock_guard lock(DinputSAManager::GetInstance().sinkMutex_); + std::lock_guard lock(DInputSAManager::GetInstance().sinkMutex_); if (!isSubscribeSinkSAChangeListener.load()) { sptr systemAbilityManager = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager(); @@ -181,7 +180,7 @@ bool DinputSAManager::GetDInputSinkProxy() } if (dInputSinkSAOnline.load() && !dInputSinkProxy_) { - std::lock_guard lock(DinputSAManager::GetInstance().sinkMutex_); + std::lock_guard lock(DInputSAManager::GetInstance().sinkMutex_); if (dInputSinkProxy_ != nullptr) { DHLOGI("dinput sink proxy has already got."); return true; @@ -205,19 +204,19 @@ bool DinputSAManager::GetDInputSinkProxy() return false; } } - std::lock_guard lock(DinputSAManager::GetInstance().sinkMutex_); + std::lock_guard lock(DInputSAManager::GetInstance().sinkMutex_); return dInputSinkProxy_ != nullptr; } -bool DinputSAManager::HasDInputSinkProxy() +bool DInputSAManager::HasDInputSinkProxy() { - std::lock_guard lock(DinputSAManager::GetInstance().sinkMutex_); + std::lock_guard lock(DInputSAManager::GetInstance().sinkMutex_); return dInputSinkProxy_ != nullptr; } -bool DinputSAManager::SetDInputSinkProxy(const sptr &remoteObject) +bool DInputSAManager::SetDInputSinkProxy(const sptr &remoteObject) { - std::lock_guard lock(DinputSAManager::GetInstance().sinkMutex_); + std::lock_guard lock(DInputSAManager::GetInstance().sinkMutex_); dInputSinkProxy_ = iface_cast(remoteObject); if ((!dInputSinkProxy_) || (!dInputSinkProxy_->AsObject())) { diff --git a/interfaces/ipc/src/distributed_input_client.cpp b/interfaces/ipc/src/distributed_input_client.cpp index 21fb242..6a026d2 100644 --- a/interfaces/ipc/src/distributed_input_client.cpp +++ b/interfaces/ipc/src/distributed_input_client.cpp @@ -33,7 +33,7 @@ std::shared_ptr DistributedInputClient::instance(new Dis DistributedInputClient::DistributedInputClient() { - DinputSAManager::GetInstance().Init(); + DInputSAManager::GetInstance().Init(); } DistributedInputClient &DistributedInputClient::GetInstance() @@ -102,23 +102,23 @@ void DistributedInputClient::DelWhiteListInfosCb::OnResult(const std::string& de int32_t DistributedInputClient::InitSource() { - if (!DinputSAManager::GetInstance().GetDInputSourceProxy()) { + if (!DInputSAManager::GetInstance().GetDInputSourceProxy()) { return ERR_DH_INPUT_CLIENT_GET_SOURCE_PROXY_FAIL; } - return DinputSAManager::GetInstance().dInputSourceProxy_->Init(); + return DInputSAManager::GetInstance().dInputSourceProxy_->Init(); } int32_t DistributedInputClient::InitSink() { - if (!DinputSAManager::GetInstance().GetDInputSinkProxy()) { + if (!DInputSAManager::GetInstance().GetDInputSinkProxy()) { return ERR_DH_INPUT_CLIENT_GET_SINK_PROXY_FAIL; } - return DinputSAManager::GetInstance().dInputSinkProxy_->Init(); + return DInputSAManager::GetInstance().dInputSinkProxy_->Init(); } int32_t DistributedInputClient::ReleaseSource() { - if (!DinputSAManager::GetInstance().GetDInputSourceProxy()) { + if (!DInputSAManager::GetInstance().GetDInputSourceProxy()) { return ERR_DH_INPUT_CLIENT_GET_SOURCE_PROXY_FAIL; } @@ -129,19 +129,19 @@ int32_t DistributedInputClient::ReleaseSource() addWhiteListCallback = nullptr; delWhiteListCallback = nullptr; WhiteListUtil::GetInstance().ClearWhiteList(); - return DinputSAManager::GetInstance().dInputSourceProxy_->Release(); + return DInputSAManager::GetInstance().dInputSourceProxy_->Release(); } int32_t DistributedInputClient::ReleaseSink() { - if (!DinputSAManager::GetInstance().GetDInputSinkProxy()) { + if (!DInputSAManager::GetInstance().GetDInputSinkProxy()) { return ERR_DH_INPUT_CLIENT_GET_SINK_PROXY_FAIL; } serverType = DInputServerType::NULL_SERVER_TYPE; inputTypes_ = DInputDeviceType::NONE; sinkTypeCallback = nullptr; WhiteListUtil::GetInstance().ClearWhiteList(); - return DinputSAManager::GetInstance().dInputSinkProxy_->Release(); + return DInputSAManager::GetInstance().dInputSinkProxy_->Release(); } int32_t DistributedInputClient::RegisterDistributedHardware(const std::string& devId, const std::string& dhId, @@ -150,7 +150,7 @@ int32_t DistributedInputClient::RegisterDistributedHardware(const std::string& d DHLOGI("%s called, deviceId: %s, dhId: %s, parameters: %s", __func__, GetAnonyString(devId).c_str(), GetAnonyString(dhId).c_str(), parameters.c_str()); - if (!DinputSAManager::GetInstance().GetDInputSourceProxy()) { + if (!DInputSAManager::GetInstance().GetDInputSourceProxy()) { DHLOGE("RegisterDistributedHardware client fail"); return ERR_DH_INPUT_CLIENT_GET_SOURCE_PROXY_FAIL; } @@ -174,17 +174,16 @@ int32_t DistributedInputClient::RegisterDistributedHardware(const std::string& d dHardWareFwkRstInfos.push_back(info); } - return DinputSAManager::GetInstance().dInputSourceProxy_->RegisterDistributedHardware(devId, dhId, parameters, + return DInputSAManager::GetInstance().dInputSourceProxy_->RegisterDistributedHardware(devId, dhId, parameters, new(std::nothrow) RegisterDInputCb()); } int32_t DistributedInputClient::UnregisterDistributedHardware(const std::string& devId, const std::string& dhId, const std::shared_ptr& callback) { - DHLOGI("%s called, deviceId: %s, dhId: %s", - __func__, GetAnonyString(devId).c_str(), GetAnonyString(dhId).c_str()); + DHLOGI("%s called, deviceId: %s, dhId: %s", __func__, GetAnonyString(devId).c_str(), GetAnonyString(dhId).c_str()); - if (!DinputSAManager::GetInstance().GetDInputSourceProxy()) { + if (!DInputSAManager::GetInstance().GetDInputSourceProxy()) { DHLOGE("UnregisterDistributedHardware client fail"); return ERR_DH_INPUT_CLIENT_GET_SOURCE_PROXY_FAIL; } @@ -208,7 +207,7 @@ int32_t DistributedInputClient::UnregisterDistributedHardware(const std::string& dHardWareFwkUnRstInfos.push_back(info); } - return DinputSAManager::GetInstance().dInputSourceProxy_->UnregisterDistributedHardware(devId, dhId, + return DInputSAManager::GetInstance().dInputSourceProxy_->UnregisterDistributedHardware(devId, dhId, new(std::nothrow) UnregisterDInputCb()); } @@ -217,7 +216,7 @@ int32_t DistributedInputClient::PrepareRemoteInput( { DHLOGI("%s called, deviceId: %s", __func__, GetAnonyString(deviceId).c_str()); - if (!DinputSAManager::GetInstance().GetDInputSourceProxy()) { + if (!DInputSAManager::GetInstance().GetDInputSourceProxy()) { DHLOGE("PrepareRemoteInput client fail"); return ERR_DH_INPUT_CLIENT_GET_SOURCE_PROXY_FAIL; } @@ -227,16 +226,16 @@ int32_t DistributedInputClient::PrepareRemoteInput( } addWhiteListCallback = new(std::nothrow) AddWhiteListInfosCb(); - return DinputSAManager::GetInstance().dInputSourceProxy_->PrepareRemoteInput(deviceId, callback, + return DInputSAManager::GetInstance().dInputSourceProxy_->PrepareRemoteInput(deviceId, callback, addWhiteListCallback); } -int32_t DistributedInputClient::UnprepareRemoteInput( - const std::string& deviceId, sptr callback) +int32_t DistributedInputClient::UnprepareRemoteInput(const std::string& deviceId, + sptr callback) { DHLOGI("%s called, deviceId: %s", __func__, GetAnonyString(deviceId).c_str()); - if (!DinputSAManager::GetInstance().GetDInputSourceProxy()) { + if (!DInputSAManager::GetInstance().GetDInputSourceProxy()) { DHLOGE("PrepareRemoteInput client fail"); return ERR_DH_INPUT_CLIENT_GET_SOURCE_PROXY_FAIL; } @@ -246,7 +245,7 @@ int32_t DistributedInputClient::UnprepareRemoteInput( } delWhiteListCallback = new(std::nothrow) DelWhiteListInfosCb(); - return DinputSAManager::GetInstance().dInputSourceProxy_->UnprepareRemoteInput(deviceId, callback, + return DInputSAManager::GetInstance().dInputSourceProxy_->UnprepareRemoteInput(deviceId, callback, delWhiteListCallback); } @@ -255,7 +254,7 @@ int32_t DistributedInputClient::StartRemoteInput( { DHLOGI("%s called, deviceId: %s, inputTypes: %d", __func__, GetAnonyString(deviceId).c_str(), inputTypes); - if (!DinputSAManager::GetInstance().GetDInputSourceProxy()) { + if (!DInputSAManager::GetInstance().GetDInputSourceProxy()) { DHLOGE("StartRemoteInput client fail"); return ERR_DH_INPUT_CLIENT_GET_SOURCE_PROXY_FAIL; } @@ -267,15 +266,15 @@ int32_t DistributedInputClient::StartRemoteInput( return ERR_DH_INPUT_CLIENT_START_FAIL; } - return DinputSAManager::GetInstance().dInputSourceProxy_->StartRemoteInput(deviceId, inputTypes, callback); + return DInputSAManager::GetInstance().dInputSourceProxy_->StartRemoteInput(deviceId, inputTypes, callback); } -int32_t DistributedInputClient::StopRemoteInput( - const std::string& deviceId, const uint32_t& inputTypes, sptr callback) +int32_t DistributedInputClient::StopRemoteInput(const std::string& deviceId, const uint32_t& inputTypes, + sptr callback) { DHLOGI("%s called, deviceId: %s, inputTypes: %d", __func__, GetAnonyString(deviceId).c_str(), inputTypes); - if (!DinputSAManager::GetInstance().GetDInputSourceProxy()) { + if (!DInputSAManager::GetInstance().GetDInputSourceProxy()) { DHLOGE("StopRemoteInput client fail"); return ERR_DH_INPUT_CLIENT_GET_SOURCE_PROXY_FAIL; } @@ -287,7 +286,7 @@ int32_t DistributedInputClient::StopRemoteInput( return ERR_DH_INPUT_CLIENT_STOP_FAIL; } - return DinputSAManager::GetInstance().dInputSourceProxy_->StopRemoteInput(deviceId, inputTypes, callback); + return DInputSAManager::GetInstance().dInputSourceProxy_->StopRemoteInput(deviceId, inputTypes, callback); } bool DistributedInputClient::IsNeedFilterOut(const std::string& deviceId, const BusinessEvent& event) @@ -302,17 +301,17 @@ DInputServerType DistributedInputClient::IsStartDistributedInput(const uint32_t& int32_t retSource = 0; int32_t retSink = 0; - if (sourceTypeCallback == nullptr && DinputSAManager::GetInstance().GetDInputSourceProxy()) { + if (sourceTypeCallback == nullptr && DInputSAManager::GetInstance().GetDInputSourceProxy()) { DHLOGI("Init sourceTypeCallback"); sourceTypeCallback = new(std::nothrow) StartDInputServerCb(); - retSource = DinputSAManager::GetInstance().dInputSourceProxy_->IsStartDistributedInput(inputType, + retSource = DInputSAManager::GetInstance().dInputSourceProxy_->IsStartDistributedInput(inputType, sourceTypeCallback); } - if (sinkTypeCallback == nullptr && DinputSAManager::GetInstance().GetDInputSinkProxy()) { + if (sinkTypeCallback == nullptr && DInputSAManager::GetInstance().GetDInputSinkProxy()) { DHLOGI("Init sinkTypeCallback"); sinkTypeCallback = new(std::nothrow) StartDInputServerCb(); - retSink = DinputSAManager::GetInstance().dInputSinkProxy_->IsStartDistributedInput(inputType, sinkTypeCallback); + retSink = DInputSAManager::GetInstance().dInputSinkProxy_->IsStartDistributedInput(inputType, sinkTypeCallback); } if (static_cast(retSource) != DInputServerType::NULL_SERVER_TYPE) { @@ -349,8 +348,7 @@ bool DistributedInputClient::IsJsonData(std::string strData) const return false; } -void DistributedInputClient::AddWhiteListInfos( - const std::string &deviceId, const std::string &strJson) const +void DistributedInputClient::AddWhiteListInfos(const std::string &deviceId, const std::string &strJson) const { nlohmann::json inputData = nlohmann::json::parse(strJson); size_t jsonSize = inputData.size(); @@ -360,8 +358,7 @@ void DistributedInputClient::AddWhiteListInfos( WhiteListUtil::GetInstance().SyncWhiteList(deviceId, vecWhiteList); } -void DistributedInputClient::DelWhiteListInfos( - const std::string &deviceId) const +void DistributedInputClient::DelWhiteListInfos(const std::string &deviceId) const { WhiteListUtil::GetInstance().ClearWhiteList(deviceId); } diff --git a/interfaces/ipc/src/distributed_input_sink_stub.cpp b/interfaces/ipc/src/distributed_input_sink_stub.cpp index 0ea4372..0e1a554 100644 --- a/interfaces/ipc/src/distributed_input_sink_stub.cpp +++ b/interfaces/ipc/src/distributed_input_sink_stub.cpp @@ -40,7 +40,7 @@ int32_t DistributedInputSinkStub::OnRemoteRequest(uint32_t code, MessageParcel & case static_cast(IDistributedSinkInput::MessageCode::INIT): { int32_t ret = Init(); if (!reply.WriteInt32(ret)) { - DHLOGE("DistributedInputSourceStub init write ret failed"); + DHLOGE("DistributedInputSinkStub write ret failed"); return ERR_DH_INPUT_IPC_WRITE_TOKEN_VALID_FAIL; } break; @@ -49,7 +49,7 @@ int32_t DistributedInputSinkStub::OnRemoteRequest(uint32_t code, MessageParcel & case static_cast(IDistributedSinkInput::MessageCode::RELEASE): { int32_t ret = Release(); if (!reply.WriteInt32(ret)) { - DHLOGE("DistributedInputSourceStub release write ret failed"); + DHLOGE("DistributedInputSinkStub write ret failed"); return ERR_DH_INPUT_IPC_WRITE_TOKEN_VALID_FAIL; } break; @@ -61,7 +61,7 @@ int32_t DistributedInputSinkStub::OnRemoteRequest(uint32_t code, MessageParcel & iface_cast(data.ReadRemoteObject()); int32_t ret = IsStartDistributedInput(inputType, callback); if (!reply.WriteInt32(ret)) { - DHLOGE("DistributedInputSourceStub isStartDistributedInput write ret failed"); + DHLOGE("DistributedInputSinkStub write ret failed"); return ERR_DH_INPUT_IPC_WRITE_TOKEN_VALID_FAIL; } break; diff --git a/interfaces/ipc/src/unregister_d_input_call_back_stub.cpp b/interfaces/ipc/src/unregister_d_input_call_back_stub.cpp index 6257c9e..df879dc 100644 --- a/interfaces/ipc/src/unregister_d_input_call_back_stub.cpp +++ b/interfaces/ipc/src/unregister_d_input_call_back_stub.cpp @@ -36,7 +36,7 @@ int32_t UnregisterDInputCallbackStub::OnRemoteRequest( uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) { if (data.ReadInterfaceToken() != GetDescriptor()) { - DHLOGE("UnRegisterDInputCallbackStub read token valid failed"); + DHLOGE("UnregisterDInputCallbackStub read token valid failed"); return ERR_DH_INPUT_IPC_READ_TOKEN_VALID_FAIL; } IUnregisterDInputCallback::Message msgCode = static_cast(code); diff --git a/services/sink/sinkmanager/src/distributed_input_sink_manager.cpp b/services/sink/sinkmanager/src/distributed_input_sink_manager.cpp index 7ef2b57..57b5cae 100644 --- a/services/sink/sinkmanager/src/distributed_input_sink_manager.cpp +++ b/services/sink/sinkmanager/src/distributed_input_sink_manager.cpp @@ -368,6 +368,6 @@ int32_t DistributedInputSinkManager::Dump(int32_t fd, const std::vector lock(proxyMutex_); - if (!DinputSAManager::GetInstance().HasDInputSinkProxy()) { + if (!DInputSAManager::GetInstance().HasDInputSinkProxy()) { sptr samgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager(); if (!samgr) { DHLOGE("Failed to get system ability mgr."); @@ -54,7 +54,7 @@ int32_t DistributedInputSinkHandler::InitSink(const std::string ¶ms) } auto waitStatus = proxyConVar_.wait_for(lock, std::chrono::milliseconds(INPUT_LOAD_SA_TIMEOUT_MS), - [this]() { return (DinputSAManager::GetInstance().HasDInputSinkProxy()); }); + [this]() { return (DInputSAManager::GetInstance().HasDInputSinkProxy()); }); if (!waitStatus) { DHLOGE("dinput load sa timeout."); return ERR_DH_INPUT_SINK_HANDLER_INIT_SINK_SA_FAIL; @@ -67,7 +67,7 @@ void DistributedInputSinkHandler::FinishStartSA(const std::string ¶ms, const { DHLOGD("FinishStartSA"); std::unique_lock lock(proxyMutex_); - DinputSAManager::GetInstance().SetDInputSinkProxy(remoteObject); + DInputSAManager::GetInstance().SetDInputSinkProxy(remoteObject); DistributedInputClient::GetInstance().InitSink(); proxyConVar_.notify_all(); } diff --git a/sourcehandler/src/distributed_input_source_handler.cpp b/sourcehandler/src/distributed_input_source_handler.cpp index e96d9eb..2cf4f0b 100644 --- a/sourcehandler/src/distributed_input_source_handler.cpp +++ b/sourcehandler/src/distributed_input_source_handler.cpp @@ -35,7 +35,7 @@ int32_t DistributedInputSourceHandler::InitSource(const std::string ¶ms) { DHLOGD("InitSource"); std::unique_lock lock(proxyMutex_); - if (!DinputSAManager::GetInstance().HasDInputSourceProxy()) { + if (!DInputSAManager::GetInstance().HasDInputSourceProxy()) { sptr samgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager(); if (!samgr) { DHLOGE("Failed to get system ability mgr."); @@ -53,7 +53,7 @@ int32_t DistributedInputSourceHandler::InitSource(const std::string ¶ms) } auto waitStatus = proxyConVar_.wait_for(lock, std::chrono::milliseconds(INPUT_LOAD_SA_TIMEOUT_MS), - [this]() { return (DinputSAManager::GetInstance().HasDInputSourceProxy()); }); + [this]() { return (DInputSAManager::GetInstance().HasDInputSourceProxy()); }); if (!waitStatus) { DHLOGE("dinput load sa timeout."); return ERR_DH_INPUT_SINK_HANDLER_INIT_SOURCE_SA_FAIL; @@ -66,7 +66,7 @@ void DistributedInputSourceHandler::FinishStartSA(const std::string ¶ms, con { DHLOGD("FinishStartSA"); std::unique_lock lock(proxyMutex_); - DinputSAManager::GetInstance().SetDInputSourceProxy(remoteObject); + DInputSAManager::GetInstance().SetDInputSourceProxy(remoteObject); DistributedInputClient::GetInstance().InitSource(); proxyConVar_.notify_all(); } diff --git a/utils/BUILD.gn b/utils/BUILD.gn index 069d003..66162fd 100644 --- a/utils/BUILD.gn +++ b/utils/BUILD.gn @@ -12,8 +12,7 @@ # limitations under the License. import("//build/ohos.gni") -import( - "//foundation/distributedhardware/distributed_input/distributedinput.gni") +import("//foundation/distributedhardware/distributed_input/distributedinput.gni") ohos_shared_library("libdinput_utils") { include_dirs = [ diff --git a/utils/src/dinput_utils_tool.cpp b/utils/src/dinput_utils_tool.cpp index 13dc5b3..8f33596 100644 --- a/utils/src/dinput_utils_tool.cpp +++ b/utils/src/dinput_utils_tool.cpp @@ -26,7 +26,7 @@ namespace { DevInfo GetLocalDeviceInfo() { - DevInfo devInfo { "", "", 0 }; + DevInfo devInfo{"", "", 0}; auto info = std::make_unique(); auto ret = GetLocalNodeDeviceInfo(DINPUT_PKG_NAME.c_str(), info.get()); if (ret != 0) {