diff --git a/av_transport/av_trans_control_center/inner_kits/include/av_trans_control_center_callback.h b/av_transport/av_trans_control_center/inner_kits/include/av_trans_control_center_callback.h index 8ec6257cacc2d8fa375f0dafe050adc95da056aa..521da97b89c93aea51b8cc7beb6997be0e26e27c 100644 --- a/av_transport/av_trans_control_center/inner_kits/include/av_trans_control_center_callback.h +++ b/av_transport/av_trans_control_center/inner_kits/include/av_trans_control_center_callback.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Huawei Device Co., Ltd. + * Copyright (c) 2022-2025 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -23,14 +23,14 @@ namespace OHOS { namespace DistributedHardware { -class AVTransControlCenterCallback : public AVTransControlCenterCallbackStub { +class AVTransControlCenterCallback : public AvTransControlCenterCallbackStub { public: AVTransControlCenterCallback() = default; ~AVTransControlCenterCallback() override = default; - int32_t SetParameter(AVTransTag tag, const std::string &value) override; - int32_t SetSharedMemory(const AVTransSharedMemory &memory) override; - int32_t Notify(const AVTransEvent &event) override; + int32_t SetParameter(uint32_t tag, const std::string &value) override; + int32_t SetSharedMemory(const AVTransSharedMemoryExt& memory) override; + int32_t Notify(const AVTransEventExt& event) override; void SetSenderEngine(const std::shared_ptr &sender); void SetReceiverEngine(const std::shared_ptr &receiver); diff --git a/av_transport/av_trans_control_center/inner_kits/include/av_trans_control_center_callback_stub.h b/av_transport/av_trans_control_center/inner_kits/include/av_trans_control_center_callback_stub.h deleted file mode 100644 index 5732732886299097156a600ab30bd91cb0575e91..0000000000000000000000000000000000000000 --- a/av_transport/av_trans_control_center/inner_kits/include/av_trans_control_center_callback_stub.h +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (c) 2021 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef OHOS_AV_TRANS_CONTROL_CENTER_CALLBACK_STUB_H -#define OHOS_AV_TRANS_CONTROL_CENTER_CALLBACK_STUB_H - -#include "iremote_stub.h" -#include "iav_trans_control_center_callback.h" - -namespace OHOS { -namespace DistributedHardware { -class AVTransControlCenterCallbackStub : public IRemoteStub { -public: - AVTransControlCenterCallbackStub(); - virtual ~AVTransControlCenterCallbackStub() override; - int32_t OnRemoteRequest(uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) override; - -private: - int32_t SetParameterInner(MessageParcel &data, MessageParcel &reply); - int32_t SetSharedMemoryInner(MessageParcel &data, MessageParcel &reply); - int32_t NotifyInner(MessageParcel &data, MessageParcel &reply); - -private: - DISALLOW_COPY_AND_MOVE(AVTransControlCenterCallbackStub); -}; -} // namespace DistributedHardware -} // namespace OHOS -#endif // OHOS_AV_TRANS_CONTROL_CENTER_CALLBACK_STUB_H diff --git a/av_transport/av_trans_control_center/inner_kits/src/av_trans_control_center_callback.cpp b/av_transport/av_trans_control_center/inner_kits/src/av_trans_control_center_callback.cpp index 832d0079e282e33ac63261f19cabff660315e51b..7fb896fed8738afb4be4abfd27515d388c8f51ec 100644 --- a/av_transport/av_trans_control_center/inner_kits/src/av_trans_control_center_callback.cpp +++ b/av_transport/av_trans_control_center/inner_kits/src/av_trans_control_center_callback.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Huawei Device Co., Ltd. + * Copyright (c) 2022-2025 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -20,36 +20,42 @@ namespace OHOS { namespace DistributedHardware { -int32_t AVTransControlCenterCallback::SetParameter(AVTransTag tag, const std::string &value) +int32_t AVTransControlCenterCallback::SetParameter(uint32_t tag, const std::string &value) { - if ((tag == AVTransTag::START_AV_SYNC) || (tag == AVTransTag::STOP_AV_SYNC) || - (tag == AVTransTag::TIME_SYNC_RESULT)) { + if ((static_cast(tag) == AVTransTag::START_AV_SYNC) || + (static_cast(tag) == AVTransTag::STOP_AV_SYNC) || + (static_cast(tag) == AVTransTag::TIME_SYNC_RESULT)) { std::shared_ptr rcvEngine = receiverEngine_.lock(); if (rcvEngine != nullptr) { - rcvEngine->SetParameter(tag, value); + rcvEngine->SetParameter(static_cast(tag), value); } } return DH_AVT_SUCCESS; } -int32_t AVTransControlCenterCallback::SetSharedMemory(const AVTransSharedMemory &memory) +int32_t AVTransControlCenterCallback::SetSharedMemory(const AVTransSharedMemoryExt &memory) { DHLOGW("AVTransControlCenterCallback::SetSharedMemory enter."); + AVTransSharedMemory memoryTrans; + memoryTrans.size = memory.size; + memoryTrans.fd = memory.fd; + memoryTrans.name = memory.name; + std::shared_ptr sendEngine = senderEngine_.lock(); if (sendEngine != nullptr) { - sendEngine->SetParameter(AVTransTag::SHARED_MEMORY_FD, MarshalSharedMemory(memory)); + sendEngine->SetParameter(AVTransTag::SHARED_MEMORY_FD, MarshalSharedMemory(memoryTrans)); } std::shared_ptr rcvEngine = receiverEngine_.lock(); if (rcvEngine != nullptr) { - rcvEngine->SetParameter(AVTransTag::SHARED_MEMORY_FD, MarshalSharedMemory(memory)); + rcvEngine->SetParameter(AVTransTag::SHARED_MEMORY_FD, MarshalSharedMemory(memoryTrans)); } return DH_AVT_SUCCESS; } -int32_t AVTransControlCenterCallback::Notify(const AVTransEvent& event) +int32_t AVTransControlCenterCallback::Notify(const AVTransEventExt& event) { DHLOGW("AVTransControlCenterCallback::Notify enter."); return DH_AVT_SUCCESS; diff --git a/av_transport/av_trans_control_center/inner_kits/src/av_trans_control_center_callback_stub.cpp b/av_transport/av_trans_control_center/inner_kits/src/av_trans_control_center_callback_stub.cpp deleted file mode 100644 index 696bfb12e560ea5221cf78f8190672283a9f6e00..0000000000000000000000000000000000000000 --- a/av_transport/av_trans_control_center/inner_kits/src/av_trans_control_center_callback_stub.cpp +++ /dev/null @@ -1,94 +0,0 @@ -/* - * Copyright (c) 2022 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "av_trans_control_center_callback_stub.h" - -#include "av_trans_errno.h" -#include "distributed_hardware_log.h" - -namespace OHOS { -namespace DistributedHardware { -AVTransControlCenterCallbackStub::AVTransControlCenterCallbackStub() -{ -} - -AVTransControlCenterCallbackStub::~AVTransControlCenterCallbackStub() -{ -} - -int32_t AVTransControlCenterCallbackStub::OnRemoteRequest(uint32_t code, - MessageParcel &data, MessageParcel &reply, MessageOption &option) -{ - (void)option; - if (data.ReadInterfaceToken() != GetDescriptor()) { - DHLOGE("Read valid token failed"); - return ERR_INVALID_DATA; - } - switch (code) { - case (uint32_t)IAVTransControlCenterCallback::Message::SET_PARAMETER: { - return SetParameterInner(data, reply); - } - case (uint32_t)IAVTransControlCenterCallback::Message::SET_SHARED_MEMORY: { - return SetSharedMemoryInner(data, reply); - } - case (uint32_t)IAVTransControlCenterCallback::Message::NOTIFY_AV_EVENT: { - return NotifyInner(data, reply); - } - default: - return IPCObjectStub::OnRemoteRequest(code, data, reply, option); - } - - return NO_ERROR; -} - -int32_t AVTransControlCenterCallbackStub::SetParameterInner(MessageParcel &data, MessageParcel &reply) -{ - uint32_t transTag = data.ReadUint32(); - std::string tagValue = data.ReadString(); - int32_t ret = SetParameter((AVTransTag)transTag, tagValue); - if (!reply.WriteInt32(ret)) { - DHLOGE("Write ret code failed"); - return ERR_DH_AVT_SERVICE_WRITE_INFO_FAIL; - } - return NO_ERROR; -} - -int32_t AVTransControlCenterCallbackStub::SetSharedMemoryInner(MessageParcel &data, MessageParcel &reply) -{ - int32_t fd = data.ReadFileDescriptor(); - int32_t size = data.ReadInt32(); - std::string name = data.ReadString(); - int32_t ret = SetSharedMemory(AVTransSharedMemory{ fd, size, name }); - if (!reply.WriteInt32(ret)) { - DHLOGE("Write ret code failed"); - return ERR_DH_AVT_SERVICE_WRITE_INFO_FAIL; - } - return NO_ERROR; -} - -int32_t AVTransControlCenterCallbackStub::NotifyInner(MessageParcel &data, MessageParcel &reply) -{ - uint32_t type = data.ReadUint32(); - std::string content = data.ReadString(); - std::string peerDevId = data.ReadString(); - int32_t ret = Notify(AVTransEvent{(EventType)type, content, peerDevId}); - if (!reply.WriteInt32(ret)) { - DHLOGE("Write ret code failed"); - return ERR_DH_AVT_SERVICE_WRITE_INFO_FAIL; - } - return NO_ERROR; -} -} // namespace DistributedHardware -} // namespace OHOS \ No newline at end of file diff --git a/av_transport/av_trans_control_center/services/include/av_trans_control_center.h b/av_transport/av_trans_control_center/services/include/av_trans_control_center.h index 4f97415cc21772d82726d974a40d157944d0c012..8d31239e3493800009749b0f78be651277184356 100644 --- a/av_transport/av_trans_control_center/services/include/av_trans_control_center.h +++ b/av_transport/av_trans_control_center/services/include/av_trans_control_center.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023 Huawei Device Co., Ltd. + * Copyright (c) 2023-2025 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -35,7 +35,7 @@ public: int32_t ReleaseAVCenter(int32_t engineId); int32_t CreateControlChannel(int32_t engineId, const std::string &peerDevId); int32_t NotifyAVCenter(int32_t engineId, const AVTransEvent &event); - int32_t RegisterCtlCenterCallback(int32_t engineId, const sptr &callback); + int32_t RegisterCtlCenterCallback(int32_t engineId, const sptr &callback); // interfaces from ISoftbusChannelListener void OnChannelEvent(const AVTransEvent &event) override; @@ -64,7 +64,7 @@ private: std::vector connectedDevIds_; std::map engine2DevIdMap_; - std::map> callbackMap_; + std::map> callbackMap_; }; } } diff --git a/av_transport/av_trans_control_center/services/include/ipc/av_trans_control_center_callback_proxy.h b/av_transport/av_trans_control_center/services/include/ipc/av_trans_control_center_callback_proxy.h deleted file mode 100644 index 9b657f4bf9fe2b9519341e652be97dec2913a12a..0000000000000000000000000000000000000000 --- a/av_transport/av_trans_control_center/services/include/ipc/av_trans_control_center_callback_proxy.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (c) 2021 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef OHOS_AV_TRANS_CONTROL_CENTER_CALLBACK_PROXY_H -#define OHOS_AV_TRANS_CONTROL_CENTER_CALLBACK_PROXY_H - -#include - -#include "iremote_proxy.h" -#include "refbase.h" -#include "iav_trans_control_center_callback.h" - -namespace OHOS { -namespace DistributedHardware { -class AVTransControlCenterCallbackProxy : public IRemoteProxy { -public: - explicit AVTransControlCenterCallbackProxy(const sptr &impl) - : IRemoteProxy(impl) - { - } - virtual ~AVTransControlCenterCallbackProxy() {} - - int32_t SetParameter(AVTransTag tag, const std::string &value) override; - int32_t SetSharedMemory(const AVTransSharedMemory &memory) override; - int32_t Notify(const AVTransEvent &event) override; - -private: - static inline BrokerDelegator delegator_; -}; -} // namespace DistributedHardware -} // namespace OHOS -#endif // OHOS_AV_TRANS_CONTROL_CENTER_CALLBACK_PROXY_H diff --git a/av_transport/av_trans_control_center/services/src/av_trans_control_center.cpp b/av_transport/av_trans_control_center/services/src/av_trans_control_center.cpp index 525791ad9efee5a8ffe983c0d838a3139dbec24a..5a888269d153db151f03d6e8a77edf08ef9364f1 100644 --- a/av_transport/av_trans_control_center/services/src/av_trans_control_center.cpp +++ b/av_transport/av_trans_control_center/services/src/av_trans_control_center.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023-2024 Huawei Device Co., Ltd. + * Copyright (c) 2023-2025 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -17,6 +17,7 @@ #include "anonymous_string.h" #include "av_trans_log.h" +#include "av_trans_errno.h" namespace OHOS { namespace DistributedHardware { @@ -202,7 +203,7 @@ int32_t AVTransControlCenter::NotifyAVCenter(int32_t engineId, const AVTransEven } int32_t AVTransControlCenter::RegisterCtlCenterCallback(int32_t engineId, - const sptr &callback) + const sptr &callback) { TRUE_RETURN_V_MSG_E(IsInvalidEngineId(engineId), ERR_DH_AVT_INVALID_PARAM_VALUE, "Invalid input engine id = %{public}d", engineId); @@ -232,7 +233,7 @@ void AVTransControlCenter::SetParam2Engines(AVTransTag tag, const std::string &v std::lock_guard lock(callbackMutex_); for (auto iter = callbackMap_.begin(); iter != callbackMap_.end(); iter++) { if (iter->second != nullptr) { - iter->second->SetParameter(tag, value); + iter->second->SetParameter(static_cast(tag), value); } } } @@ -242,7 +243,7 @@ void AVTransControlCenter::SetParam2Engines(const AVTransSharedMemory &memory) std::lock_guard lock(callbackMutex_); for (auto iter = callbackMap_.begin(); iter != callbackMap_.end(); iter++) { if (iter->second != nullptr) { - iter->second->SetSharedMemory(memory); + iter->second->SetSharedMemory(AVTransSharedMemoryExt(memory)); } } } diff --git a/av_transport/av_trans_control_center/services/src/ipc/av_trans_control_center_callback_proxy.cpp b/av_transport/av_trans_control_center/services/src/ipc/av_trans_control_center_callback_proxy.cpp deleted file mode 100644 index 7a6268f73da34023ceff81ad2c36776c796bb77b..0000000000000000000000000000000000000000 --- a/av_transport/av_trans_control_center/services/src/ipc/av_trans_control_center_callback_proxy.cpp +++ /dev/null @@ -1,141 +0,0 @@ -/* - * Copyright (c) 2022 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "av_trans_control_center_callback_proxy.h" - -#include -#include "parcel.h" - -#include "av_trans_constants.h" -#include "av_trans_errno.h" -#include "av_trans_log.h" -#include "av_trans_types.h" - -namespace OHOS { -namespace DistributedHardware { -#undef DH_LOG_TAG -#define DH_LOG_TAG "AVTransControlCenterCallbackProxy" - -int32_t AVTransControlCenterCallbackProxy::SetParameter(AVTransTag tag, const std::string& value) -{ - sptr remote = Remote(); - if (remote == nullptr) { - AVTRANS_LOGE("remote service is null"); - return ERR_DH_AVT_SERVICE_REMOTE_IS_NULL; - } - - MessageParcel data; - MessageParcel reply; - MessageOption option; - - if (!data.WriteInterfaceToken(GetDescriptor())) { - AVTRANS_LOGE("WriteInterfaceToken fail!"); - return ERR_DH_AVT_SERVICE_WRITE_TOKEN_FAIL; - } - if (!data.WriteUint32((uint32_t)tag)) { - AVTRANS_LOGE("Write tag failed"); - return ERR_DH_AVT_SERVICE_WRITE_INFO_FAIL; - } - if (!data.WriteString(value)) { - AVTRANS_LOGE("Write value failed"); - return ERR_DH_AVT_SERVICE_WRITE_INFO_FAIL; - } - int32_t ret = remote->SendRequest((uint32_t)IAVTransControlCenterCallback::Message::SET_PARAMETER, - data, reply, option); - if (ret != NO_ERROR) { - AVTRANS_LOGE("Send Request failed, ret: %{public}d", ret); - return ERR_DH_AVT_SERVICE_IPC_SEND_REQUEST_FAIL; - } - - return reply.ReadInt32(); -} - -int32_t AVTransControlCenterCallbackProxy::SetSharedMemory(const AVTransSharedMemory &memory) -{ - sptr remote = Remote(); - if (remote == nullptr) { - AVTRANS_LOGE("remote service is null"); - return ERR_DH_AVT_SERVICE_REMOTE_IS_NULL; - } - - MessageParcel data; - MessageParcel reply; - MessageOption option; - - if (!data.WriteInterfaceToken(GetDescriptor())) { - AVTRANS_LOGE("WriteInterfaceToken fail!"); - return ERR_DH_AVT_SERVICE_WRITE_TOKEN_FAIL; - } - if (!data.WriteFileDescriptor(memory.fd)) { - AVTRANS_LOGE("Write memory fd failed"); - return ERR_DH_AVT_SERVICE_WRITE_INFO_FAIL; - } - if (!data.WriteInt32(memory.size)) { - AVTRANS_LOGE("Write memory size failed"); - return ERR_DH_AVT_SERVICE_WRITE_INFO_FAIL; - } - if (!data.WriteString(memory.name)) { - AVTRANS_LOGE("Write memory name failed"); - return ERR_DH_AVT_SERVICE_WRITE_INFO_FAIL; - } - int32_t ret = remote->SendRequest((uint32_t)IAVTransControlCenterCallback::Message::SET_SHARED_MEMORY, - data, reply, option); - if (ret != NO_ERROR) { - AVTRANS_LOGE("Send Request failed, ret: %{public}d", ret); - return ERR_DH_AVT_SERVICE_IPC_SEND_REQUEST_FAIL; - } - - return reply.ReadInt32(); -} - -int32_t AVTransControlCenterCallbackProxy::Notify(const AVTransEvent& event) -{ - sptr remote = Remote(); - if (remote == nullptr) { - AVTRANS_LOGE("remote service is null"); - return ERR_DH_AVT_SERVICE_REMOTE_IS_NULL; - } - - MessageParcel data; - MessageParcel reply; - MessageOption option; - - if (!data.WriteInterfaceToken(GetDescriptor())) { - AVTRANS_LOGE("WriteInterfaceToken fail!"); - return ERR_DH_AVT_SERVICE_WRITE_TOKEN_FAIL; - } - if (!data.WriteUint32((uint32_t)event.type)) { - AVTRANS_LOGE("Write event type failed"); - return ERR_DH_AVT_SERVICE_WRITE_INFO_FAIL; - } - if (!data.WriteString(event.content)) { - AVTRANS_LOGE("Write event content failed"); - return ERR_DH_AVT_SERVICE_WRITE_INFO_FAIL; - } - if (!data.WriteString(event.peerDevId)) { - AVTRANS_LOGE("Write event peerDevId failed"); - return ERR_DH_AVT_SERVICE_WRITE_INFO_FAIL; - } - int32_t ret = remote->SendRequest((uint32_t)IAVTransControlCenterCallback::Message::NOTIFY_AV_EVENT, - data, reply, option); - if (ret != NO_ERROR) { - AVTRANS_LOGE("Send Request failed, ret: %{public}d", ret); - return ERR_DH_AVT_SERVICE_IPC_SEND_REQUEST_FAIL; - } - - return reply.ReadInt32(); -} -} // namespace DistributedHardware -} // namespace OHOS \ No newline at end of file diff --git a/av_transport/av_trans_control_center/test/fuzztest/avtranscallbacknotify_fuzzer/BUILD.gn b/av_transport/av_trans_control_center/test/fuzztest/avtranscallbacknotify_fuzzer/BUILD.gn index b9a4c6ab1156b42637fb2455bcac1544bcef82eb..51edaa07cdd4209548f8d565e032fef313387afc 100644 --- a/av_transport/av_trans_control_center/test/fuzztest/avtranscallbacknotify_fuzzer/BUILD.gn +++ b/av_transport/av_trans_control_center/test/fuzztest/avtranscallbacknotify_fuzzer/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2024 Huawei Device Co., Ltd. +# Copyright (c) 2024-2025 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at @@ -40,7 +40,10 @@ ohos_fuzztest("AVTransCallbackNotifyFuzzTest") { sources = [ "avtranscallbacknotify_fuzzer.cpp" ] - deps = [ "${dh_fwk_sdk_path}:libdhfwk_sdk" ] + deps = [ + "${dh_fwk_sdk_path}:dhfwk_idl_hardware_head", + "${dh_fwk_sdk_path}:libdhfwk_sdk", + ] defines = [ "HI_LOG_ENABLE", @@ -54,6 +57,7 @@ ohos_fuzztest("AVTransCallbackNotifyFuzzTest") { "ipc:ipc_core", "safwk:system_ability_fwk", "samgr:samgr_proxy", + "hilog:libhilog", ] } diff --git a/av_transport/av_trans_control_center/test/fuzztest/avtranscallbacknotify_fuzzer/avtranscallbacknotify_fuzzer.cpp b/av_transport/av_trans_control_center/test/fuzztest/avtranscallbacknotify_fuzzer/avtranscallbacknotify_fuzzer.cpp index 50336f17c7c906895a6b692b4b766f25f1ca6894..65131eee02d390dde3d1605f80564ca77fce0fc3 100644 --- a/av_transport/av_trans_control_center/test/fuzztest/avtranscallbacknotify_fuzzer/avtranscallbacknotify_fuzzer.cpp +++ b/av_transport/av_trans_control_center/test/fuzztest/avtranscallbacknotify_fuzzer/avtranscallbacknotify_fuzzer.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024 Huawei Device Co., Ltd. + * Copyright (c) 2024-2025 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -30,11 +30,12 @@ void AVTransCallbackNotifyFuzzTest(const uint8_t *data, size_t size) std::string content(reinterpret_cast(data), size); std::string peerDevId(reinterpret_cast(data), size); AVTransEvent event = AVTransEvent{ type, content, peerDevId }; + AVTransEventExt eventExt = AVTransEventExt(event); sptr controlCenterCallback(new (std::nothrow) AVTransControlCenterCallback()); if (controlCenterCallback == nullptr) { return; } - controlCenterCallback->Notify(event); + controlCenterCallback->Notify(eventExt); } } // namespace DistributedHardware } // namespace OHOS diff --git a/av_transport/av_trans_control_center/test/fuzztest/avtranscallbacksetparameter_fuzzer/BUILD.gn b/av_transport/av_trans_control_center/test/fuzztest/avtranscallbacksetparameter_fuzzer/BUILD.gn index 63c488d7e0c646b057af3f8afcee3d282aac2179..d3ba3dd90ce8bdcc7cf565f662b0bdd032b9c31e 100644 --- a/av_transport/av_trans_control_center/test/fuzztest/avtranscallbacksetparameter_fuzzer/BUILD.gn +++ b/av_transport/av_trans_control_center/test/fuzztest/avtranscallbacksetparameter_fuzzer/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2024 Huawei Device Co., Ltd. +# Copyright (c) 2024-2025 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at @@ -40,7 +40,10 @@ ohos_fuzztest("AVTransCallbackSetParameterFuzzTest") { sources = [ "avtranscallbacksetparameter_fuzzer.cpp" ] - deps = [ "${dh_fwk_sdk_path}:libdhfwk_sdk" ] + deps = [ + "${dh_fwk_sdk_path}:dhfwk_idl_hardware_head", + "${dh_fwk_sdk_path}:libdhfwk_sdk", + ] defines = [ "HI_LOG_ENABLE", @@ -54,6 +57,7 @@ ohos_fuzztest("AVTransCallbackSetParameterFuzzTest") { "ipc:ipc_core", "safwk:system_ability_fwk", "samgr:samgr_proxy", + "hilog:libhilog", ] } diff --git a/av_transport/av_trans_control_center/test/fuzztest/avtranscallbacksetparameter_fuzzer/avtranscallbacksetparameter_fuzzer.cpp b/av_transport/av_trans_control_center/test/fuzztest/avtranscallbacksetparameter_fuzzer/avtranscallbacksetparameter_fuzzer.cpp index 7ab4a3a976c39541072b94d725408a95d031b14f..5d753f84e8d6d9f0ff48e53b5662c7740936ab74 100644 --- a/av_transport/av_trans_control_center/test/fuzztest/avtranscallbacksetparameter_fuzzer/avtranscallbacksetparameter_fuzzer.cpp +++ b/av_transport/av_trans_control_center/test/fuzztest/avtranscallbacksetparameter_fuzzer/avtranscallbacksetparameter_fuzzer.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024 Huawei Device Co., Ltd. + * Copyright (c) 2024-2025 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -32,7 +32,7 @@ void AVTransCallbackSetParameterFuzzTest(const uint8_t *data, size_t size) if (controlCenterCallback == nullptr) { return; } - controlCenterCallback->SetParameter(tag, value); + controlCenterCallback->SetParameter((uint32_t)tag, value); } } // namespace DistributedHardware } // namespace OHOS diff --git a/av_transport/av_trans_control_center/test/fuzztest/avtranscallbacksetsharedmemory_fuzzer/BUILD.gn b/av_transport/av_trans_control_center/test/fuzztest/avtranscallbacksetsharedmemory_fuzzer/BUILD.gn index 9f17b28cd7a4c5f6eb34ffe3935e9d23e569b3a8..92aa39a0c986b88d4159dee9409f8dacd0547aa4 100644 --- a/av_transport/av_trans_control_center/test/fuzztest/avtranscallbacksetsharedmemory_fuzzer/BUILD.gn +++ b/av_transport/av_trans_control_center/test/fuzztest/avtranscallbacksetsharedmemory_fuzzer/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2024 Huawei Device Co., Ltd. +# Copyright (c) 2024-2025 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at @@ -39,8 +39,10 @@ ohos_fuzztest("AVTransCallbackSetSharedMemoryFuzzTest") { sources = [ "avtranscallbacksetsharedmemory_fuzzer.cpp" ] - deps = [ "${dh_fwk_sdk_path}:libdhfwk_sdk" ] - + deps = [ + "${dh_fwk_sdk_path}:dhfwk_idl_hardware_head", + "${dh_fwk_sdk_path}:libdhfwk_sdk", + ] defines = [ "HI_LOG_ENABLE", "DH_LOG_TAG=\"AVTransCallbackSetSharedMemoryFuzzTest\"", @@ -53,6 +55,7 @@ ohos_fuzztest("AVTransCallbackSetSharedMemoryFuzzTest") { "ipc:ipc_core", "safwk:system_ability_fwk", "samgr:samgr_proxy", + "hilog:libhilog", ] } diff --git a/av_transport/av_trans_control_center/test/fuzztest/avtranscallbacksetsharedmemory_fuzzer/avtranscallbacksetsharedmemory_fuzzer.cpp b/av_transport/av_trans_control_center/test/fuzztest/avtranscallbacksetsharedmemory_fuzzer/avtranscallbacksetsharedmemory_fuzzer.cpp index 66c5c5ef7bde2d019629b01a7d621f13d7f11693..d4cd7c426cc5906084cfa4531ce48636ade7a1b0 100644 --- a/av_transport/av_trans_control_center/test/fuzztest/avtranscallbacksetsharedmemory_fuzzer/avtranscallbacksetsharedmemory_fuzzer.cpp +++ b/av_transport/av_trans_control_center/test/fuzztest/avtranscallbacksetsharedmemory_fuzzer/avtranscallbacksetsharedmemory_fuzzer.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024 Huawei Device Co., Ltd. + * Copyright (c) 2024-2025 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -31,11 +31,12 @@ void AVTransCallbackSetSharedMemoryFuzzTest(const uint8_t *data, size_t size) int32_t len = fdp.ConsumeIntegral(); std::string name(reinterpret_cast(data), size); AVTransSharedMemory memory = AVTransSharedMemory{ fd, len, name }; + AVTransSharedMemoryExt memoryExt = AVTransSharedMemoryExt(memory); sptr controlCenterCallback(new (std::nothrow) AVTransControlCenterCallback()); if (controlCenterCallback == nullptr) { return; } - controlCenterCallback->SetSharedMemory(memory); + controlCenterCallback->SetSharedMemory(memoryExt); } } // namespace DistributedHardware } // namespace OHOS diff --git a/av_transport/av_trans_control_center/test/fuzztest/avtransstubonremoterequest_fuzzer/BUILD.gn b/av_transport/av_trans_control_center/test/fuzztest/avtransstubonremoterequest_fuzzer/BUILD.gn index 6ce4af8e73146f1cb9c9524e9b94168f9f5ddad5..3eb21c8e535e489fa9dc2c153b768ff7beb25aba 100644 --- a/av_transport/av_trans_control_center/test/fuzztest/avtransstubonremoterequest_fuzzer/BUILD.gn +++ b/av_transport/av_trans_control_center/test/fuzztest/avtransstubonremoterequest_fuzzer/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2024 Huawei Device Co., Ltd. +# Copyright (c) 2024-2025 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at @@ -40,7 +40,10 @@ ohos_fuzztest("AVTransStubOnRemoteRequestFuzzTest") { sources = [ "avtransstubonremoterequest_fuzzer.cpp" ] - deps = [ "${dh_fwk_sdk_path}:libdhfwk_sdk" ] + deps = [ + "${dh_fwk_sdk_path}:dhfwk_idl_hardware_head", + "${dh_fwk_sdk_path}:libdhfwk_sdk", + ] defines = [ "HI_LOG_ENABLE", @@ -54,6 +57,7 @@ ohos_fuzztest("AVTransStubOnRemoteRequestFuzzTest") { "ipc:ipc_core", "safwk:system_ability_fwk", "samgr:samgr_proxy", + "hilog:libhilog", ] } diff --git a/av_transport/av_trans_control_center/test/fuzztest/avtransstubonremoterequest_fuzzer/avtransstubonremoterequest_fuzzer.cpp b/av_transport/av_trans_control_center/test/fuzztest/avtransstubonremoterequest_fuzzer/avtransstubonremoterequest_fuzzer.cpp index 984fa7a60034e1709e44efc99ac6acf2d853ed9c..33f196af8f4bbb93c0a1fe3db74d4f348955b27d 100644 --- a/av_transport/av_trans_control_center/test/fuzztest/avtransstubonremoterequest_fuzzer/avtransstubonremoterequest_fuzzer.cpp +++ b/av_transport/av_trans_control_center/test/fuzztest/avtransstubonremoterequest_fuzzer/avtransstubonremoterequest_fuzzer.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024 Huawei Device Co., Ltd. + * Copyright (c) 2024-2025 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -47,18 +47,18 @@ void AVTransStubOnRemoteRequestFuzzTest(const uint8_t *data, size_t size) MessageOption option; pdata.WriteInterfaceToken(AVTransControlCenterCallback::GetDescriptor()); uint32_t code = *(reinterpret_cast(data)) % DC_MESSAGE_SIZE; - if (code == (uint32_t)IAVTransControlCenterCallback::Message::SET_PARAMETER) { + if (code == (uint32_t)IAvTransControlCenterCallbackIpcCode::COMMAND_SET_PARAMETER) { uint32_t tag = *(reinterpret_cast(data)); std::string value(reinterpret_cast(data), size); pdata.WriteUint32(tag); pdata.WriteString(value); - } else if (code == (uint32_t)IAVTransControlCenterCallback::Message::SET_SHARED_MEMORY) { + } else if (code == (uint32_t)IAvTransControlCenterCallbackIpcCode::COMMAND_SET_SHARED_MEMORY) { FuzzedDataProvider fdp(data, size); int32_t len = fdp.ConsumeIntegral(); std::string name(reinterpret_cast(data), size); pdata.WriteInt32(len); pdata.WriteString(name); - } else if (code == (uint32_t)IAVTransControlCenterCallback::Message::NOTIFY_AV_EVENT) { + } else if (code == (uint32_t)IAvTransControlCenterCallbackIpcCode::COMMAND_NOTIFY) { uint32_t type = *(reinterpret_cast(data)); std::string content(reinterpret_cast(data), size); std::string devId(reinterpret_cast(data), size); diff --git a/av_transport/av_trans_control_center/test/unittest/BUILD.gn b/av_transport/av_trans_control_center/test/unittest/BUILD.gn index 42b720d8f3970ef0677717b370151df85956f1ea..2fbde394ac028074e52e4cbff3d900119423f111 100644 --- a/av_transport/av_trans_control_center/test/unittest/BUILD.gn +++ b/av_transport/av_trans_control_center/test/unittest/BUILD.gn @@ -48,6 +48,7 @@ ohos_unittest("AvTransControlCenterTest") { configs = [ ":module_private_config" ] deps = [ + "${dh_fwk_sdk_path}:dhfwk_idl_hardware_head", "${dh_fwk_sdk_path}:libdhfwk_sdk", "${dh_fwk_services_path}/distributedhardwarefwkservice:distributedhardwarefwksvr", ] @@ -67,6 +68,7 @@ ohos_unittest("AvTransControlCenterTest") { "c_utils:utils", "dsoftbus:softbus_client", "ipc:ipc_core", + "hilog:libhilog", ] cflags = [ diff --git a/av_transport/av_trans_control_center/test/unittest/inner_kits/av_trans_control_center_callback_stub_test.cpp b/av_transport/av_trans_control_center/test/unittest/inner_kits/av_trans_control_center_callback_stub_test.cpp index 9095fae3b215a0a6836d5ad7c1f95d353f3bd750..28487560baa27cdefb074afba8a016bb805eb6ff 100644 --- a/av_transport/av_trans_control_center/test/unittest/inner_kits/av_trans_control_center_callback_stub_test.cpp +++ b/av_transport/av_trans_control_center/test/unittest/inner_kits/av_trans_control_center_callback_stub_test.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023 Huawei Device Co., Ltd. + * Copyright (c) 2023-2025 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -37,20 +37,20 @@ void AVTransControlCenterCallbackStubTest::TearDown() } int32_t AVTransControlCenterCallbackStubTest::TestControlCenterCallbackStub::SetParameter( - AVTransTag tag, const std::string &value) + uint32_t tag, const std::string &value) { (void) tag; (void) value; return DH_AVT_SUCCESS; } int32_t AVTransControlCenterCallbackStubTest::TestControlCenterCallbackStub::SetSharedMemory( - const AVTransSharedMemory &memory) + const AVTransSharedMemoryExt &memory) { (void) memory; return DH_AVT_SUCCESS; } int32_t AVTransControlCenterCallbackStubTest::TestControlCenterCallbackStub::Notify( - const AVTransEvent &event) + const AVTransEventExt &event) { (void) event; return DH_AVT_SUCCESS; @@ -65,11 +65,11 @@ int32_t AVTransControlCenterCallbackStubTest::TestControlCenterCallbackStub::Not HWTEST_F(AVTransControlCenterCallbackStubTest, set_parameter_001, TestSize.Level0) { sptr CallbackStubPtr(new TestControlCenterCallbackStub()); - AVTransControlCenterCallbackProxy callbackProxy(CallbackStubPtr); + AvTransControlCenterCallbackProxy callbackProxy(CallbackStubPtr); AVTransTag tag = AVTransTag::STOP_AV_SYNC; std::string value = "value"; - int32_t ret = callbackProxy.SetParameter(tag, value); + int32_t ret = callbackProxy.SetParameter((uint32_t)tag, value); EXPECT_EQ(NO_ERROR, ret); } @@ -82,9 +82,9 @@ HWTEST_F(AVTransControlCenterCallbackStubTest, set_parameter_001, TestSize.Level HWTEST_F(AVTransControlCenterCallbackStubTest, set_shared_memory_001, TestSize.Level1) { sptr CallbackStubPtr(new TestControlCenterCallbackStub()); - AVTransControlCenterCallbackProxy callbackProxy(CallbackStubPtr); + AvTransControlCenterCallbackProxy callbackProxy(CallbackStubPtr); - AVTransSharedMemory memory; + AVTransSharedMemoryExt memory; memory.name = "AVTransSharedMemory"; int32_t ret = callbackProxy.SetSharedMemory(memory); EXPECT_EQ(NO_ERROR, ret); @@ -99,9 +99,9 @@ HWTEST_F(AVTransControlCenterCallbackStubTest, set_shared_memory_001, TestSize.L HWTEST_F(AVTransControlCenterCallbackStubTest, notify_001, TestSize.Level0) { sptr CallbackStubPtr(new TestControlCenterCallbackStub()); - AVTransControlCenterCallbackProxy callbackProxy(CallbackStubPtr); + AvTransControlCenterCallbackProxy callbackProxy(CallbackStubPtr); - AVTransEvent event; + AVTransEventExt event; event.content = "content"; int32_t ret = callbackProxy.Notify(event); EXPECT_EQ(NO_ERROR, ret); diff --git a/av_transport/av_trans_control_center/test/unittest/inner_kits/av_trans_control_center_callback_stub_test.h b/av_transport/av_trans_control_center/test/unittest/inner_kits/av_trans_control_center_callback_stub_test.h index 7bbbaf0dd51ef75ce90bf2d6bfd9a5cebc26a4d4..ba736d437ab5cb4c8cac7afd9e7d35f166cbe215 100644 --- a/av_transport/av_trans_control_center/test/unittest/inner_kits/av_trans_control_center_callback_stub_test.h +++ b/av_transport/av_trans_control_center/test/unittest/inner_kits/av_trans_control_center_callback_stub_test.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023 Huawei Device Co., Ltd. + * Copyright (c) 2023-2025 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -28,13 +28,13 @@ public: void SetUp(); void TearDown(); - class TestControlCenterCallbackStub : public OHOS::DistributedHardware::AVTransControlCenterCallbackStub { + class TestControlCenterCallbackStub : public OHOS::DistributedHardware::AvTransControlCenterCallbackStub { public: TestControlCenterCallbackStub() = default; virtual ~TestControlCenterCallbackStub() = default; - int32_t SetParameter(AVTransTag tag, const std::string &value) override; - int32_t SetSharedMemory(const AVTransSharedMemory &memory) override; - int32_t Notify(const AVTransEvent &event) override; + int32_t SetParameter(uint32_t tag, const std::string &value) override; + int32_t SetSharedMemory(const AVTransSharedMemoryExt &memory) override; + int32_t Notify(const AVTransEventExt &event) override; }; }; } // namespace DistributedHardware diff --git a/av_transport/av_trans_control_center/test/unittest/inner_kits/av_trans_control_center_callback_test.cpp b/av_transport/av_trans_control_center/test/unittest/inner_kits/av_trans_control_center_callback_test.cpp index 3cf337251fe877527652f7f25c6d8534f79c4d9f..d02eff92d31768866cfc8920d8715744609dbae0 100644 --- a/av_transport/av_trans_control_center/test/unittest/inner_kits/av_trans_control_center_callback_test.cpp +++ b/av_transport/av_trans_control_center/test/unittest/inner_kits/av_trans_control_center_callback_test.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023-2024 Huawei Device Co., Ltd. + * Copyright (c) 2023-2025 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -46,7 +46,7 @@ HWTEST_F(AVTransControlCenterCallbackTest, set_parameter_001, TestSize.Level0) callBack_->senderEngine_ = std::shared_ptr(); AVTransTag tag = AVTransTag::START_AV_SYNC; std::string value; - int32_t ret = callBack_->SetParameter(tag, value); + int32_t ret = callBack_->SetParameter((uint32_t)tag, value); EXPECT_EQ(DH_AVT_SUCCESS, ret); } @@ -63,7 +63,7 @@ HWTEST_F(AVTransControlCenterCallbackTest, set_parameter_002, TestSize.Level0) callBack_->senderEngine_ = std::shared_ptr(); AVTransTag tag = AVTransTag::STOP_AV_SYNC; std::string value; - int32_t ret = callBack_->SetParameter(tag, value); + int32_t ret = callBack_->SetParameter((uint32_t)tag, value); EXPECT_EQ(DH_AVT_SUCCESS, ret); } @@ -80,7 +80,7 @@ HWTEST_F(AVTransControlCenterCallbackTest, set_parameter_003, TestSize.Level0) callBack_->senderEngine_ = std::shared_ptr(); AVTransTag tag = AVTransTag::TIME_SYNC_RESULT; std::string value; - int32_t ret = callBack_->SetParameter(tag, value); + int32_t ret = callBack_->SetParameter((uint32_t)tag, value); EXPECT_EQ(DH_AVT_SUCCESS, ret); callBack_->receiverEngine_ = std::shared_ptr(); EXPECT_EQ(DH_AVT_SUCCESS, ret); @@ -97,7 +97,7 @@ HWTEST_F(AVTransControlCenterCallbackTest, set_shared_memory_001, TestSize.Level callBack_ = std::make_shared(); callBack_->receiverEngine_ = std::shared_ptr(); callBack_->senderEngine_ = std::shared_ptr(); - AVTransSharedMemory memory; + AVTransSharedMemoryExt memory; int32_t ret = callBack_->SetSharedMemory(memory); EXPECT_EQ(DH_AVT_SUCCESS, ret); callBack_->senderEngine_ = std::shared_ptr(); @@ -115,7 +115,7 @@ HWTEST_F(AVTransControlCenterCallbackTest, notify_001, TestSize.Level1) callBack_ = std::make_shared(); callBack_->receiverEngine_ = std::shared_ptr(); callBack_->senderEngine_ = std::shared_ptr(); - AVTransEvent event; + AVTransEventExt event; event.type = EventType::EVENT_ADD_STREAM; int32_t ret = callBack_->Notify(event); std::shared_ptr sender = std::shared_ptr(); diff --git a/av_transport/av_trans_control_center/test/unittest/inner_kits/av_trans_control_center_callback_test.h b/av_transport/av_trans_control_center/test/unittest/inner_kits/av_trans_control_center_callback_test.h index 664f68e8ce25736b168a8aa72fb9b5f19729235b..32511d0833f86e670c102445bdf3633de9f7d1f7 100644 --- a/av_transport/av_trans_control_center/test/unittest/inner_kits/av_trans_control_center_callback_test.h +++ b/av_transport/av_trans_control_center/test/unittest/inner_kits/av_trans_control_center_callback_test.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023-2024 Huawei Device Co., Ltd. + * Copyright (c) 2023-2025 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -29,6 +29,7 @@ #include "i_av_sender_engine_callback.h" #include "av_trans_message.h" #include "av_trans_buffer.h" +#include "av_trans_errno.h" namespace OHOS { namespace DistributedHardware { class AVTransControlCenterCallbackTest : public testing::Test { diff --git a/av_transport/av_trans_control_center/test/unittest/services/av_trans_control_center_test.h b/av_transport/av_trans_control_center/test/unittest/services/av_trans_control_center_test.h index c0ab074435993b279e038334744aa9b3967c02e2..926d6bca12e8a9f6022e1bd9a0dd910a11acd5bb 100644 --- a/av_transport/av_trans_control_center/test/unittest/services/av_trans_control_center_test.h +++ b/av_transport/av_trans_control_center/test/unittest/services/av_trans_control_center_test.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023 Huawei Device Co., Ltd. + * Copyright (c) 2023-2025 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -24,6 +24,7 @@ #include "av_trans_control_center_callback_stub.h" #include "av_trans_types.h" #include "av_sync_utils.h" +#include "av_trans_errno.h" namespace OHOS { namespace DistributedHardware { @@ -35,26 +36,26 @@ public: void TearDown(); std::shared_ptr center_ = nullptr; }; -class CenterCallback : public AVTransControlCenterCallbackStub { +class CenterCallback : public AvTransControlCenterCallbackStub { public: CenterCallback() = default; ~CenterCallback() override = default; - int32_t SetParameter(AVTransTag tag, const std::string &value) override + int32_t SetParameter(uint32_t tag, const std::string &value) override { value_ = value; return DH_AVT_SUCCESS; } - int32_t SetSharedMemory(const AVTransSharedMemory &memory) override + int32_t SetSharedMemory(const AVTransSharedMemoryExt &memory) override { memory_ = memory; return DH_AVT_SUCCESS; } - int32_t Notify(const AVTransEvent &event) override + int32_t Notify(const AVTransEventExt &event) override { return DH_AVT_SUCCESS; } std::string value_; - AVTransSharedMemory memory_; + AVTransSharedMemoryExt memory_; }; } // namespace DistributedHardware } // namespace OHOS diff --git a/av_transport/av_trans_engine/av_receiver/BUILD.gn b/av_transport/av_trans_engine/av_receiver/BUILD.gn index 5a0836601f3607be81e26913a783f29a4515916c..70a96b3dfdd419385e5a2e206dfd4aa5a8638ba0 100644 --- a/av_transport/av_trans_engine/av_receiver/BUILD.gn +++ b/av_transport/av_trans_engine/av_receiver/BUILD.gn @@ -70,6 +70,7 @@ ohos_shared_library("distributed_av_receiver") { ] deps = [ + "${dh_fwk_sdk_path}:dhfwk_idl_hardware_head", "${dh_fwk_sdk_path}:libdhfwk_sdk", "${distributed_av_transport_path}/framework:distributed_av_pipeline_fwk", "${filters_path}:avtrans_input_filter", diff --git a/av_transport/av_trans_engine/av_receiver/test/unittest/av_receiver_engine/BUILD.gn b/av_transport/av_trans_engine/av_receiver/test/unittest/av_receiver_engine/BUILD.gn index 4e31909f1a79336c944f5052776a1e8fde8d5a92..0ed9f0c16a150f0a2c5a95b3eac819d73127928e 100644 --- a/av_transport/av_trans_engine/av_receiver/test/unittest/av_receiver_engine/BUILD.gn +++ b/av_transport/av_trans_engine/av_receiver/test/unittest/av_receiver_engine/BUILD.gn @@ -54,6 +54,7 @@ ohos_unittest("AvReceiverEngineTest") { cflags_cc = cflags deps = [ + "${dh_fwk_sdk_path}:dhfwk_idl_hardware_head", "${dh_fwk_sdk_path}:libdhfwk_sdk", "${engine_path}/av_receiver:distributed_av_receiver", "${filters_path}:avtrans_input_filter", @@ -133,6 +134,7 @@ ohos_unittest("AvAudioReceiverEngineTest") { cflags_cc = cflags deps = [ + "${dh_fwk_sdk_path}:dhfwk_idl_hardware_head", "${dh_fwk_sdk_path}:libdhfwk_sdk", "${distributed_av_transport_path}/framework:distributed_av_pipeline_fwk", "${engine_path}/av_receiver:distributed_av_receiver", diff --git a/av_transport/av_trans_engine/av_receiver/test/unittest/av_receiver_engine_provider/BUILD.gn b/av_transport/av_trans_engine/av_receiver/test/unittest/av_receiver_engine_provider/BUILD.gn index c93f8bd3d5ac5dabb8547eebdaeb543c1a4530bc..f2d091383ab608e2828d7a3f68ce4d07093bb1aa 100644 --- a/av_transport/av_trans_engine/av_receiver/test/unittest/av_receiver_engine_provider/BUILD.gn +++ b/av_transport/av_trans_engine/av_receiver/test/unittest/av_receiver_engine_provider/BUILD.gn @@ -53,6 +53,7 @@ ohos_unittest("AvReceiverEngineProviderTest") { cflags_cc = cflags deps = [ + "${dh_fwk_sdk_path}:dhfwk_idl_hardware_head", "${dh_fwk_sdk_path}:libdhfwk_sdk", "${engine_path}/av_receiver:distributed_av_receiver", "${filters_path}:avtrans_input_filter", @@ -134,6 +135,7 @@ ohos_unittest("AvAudioReceiverEngineProviderTest") { cflags_cc = cflags deps = [ + "${dh_fwk_sdk_path}:dhfwk_idl_hardware_head", "${dh_fwk_sdk_path}:libdhfwk_sdk", "${engine_path}/av_receiver:distributed_av_receiver", "${filters_path}:avtrans_input_filter", diff --git a/av_transport/av_trans_engine/av_sender/BUILD.gn b/av_transport/av_trans_engine/av_sender/BUILD.gn index ac2dd8a5c25e7837b00b145b37c02f7acabc31bc..c086dcf61634a76ec4695dae79f69ae5e67c355e 100644 --- a/av_transport/av_trans_engine/av_sender/BUILD.gn +++ b/av_transport/av_trans_engine/av_sender/BUILD.gn @@ -65,6 +65,7 @@ ohos_shared_library("distributed_av_sender") { ] deps = [ + "${dh_fwk_sdk_path}:dhfwk_idl_hardware_head", "${dh_fwk_sdk_path}:libdhfwk_sdk", "${distributed_av_transport_path}/framework:distributed_av_pipeline_fwk", "${filters_path}:avtrans_input_filter", diff --git a/av_transport/av_trans_engine/av_sender/test/unittest/av_sender_engine/BUILD.gn b/av_transport/av_trans_engine/av_sender/test/unittest/av_sender_engine/BUILD.gn index d44da2b50af2200da1d6d45a57846fc3ea68dc31..b0c8e3a5d28ed08d9d7d21a5c8019485e2dae91d 100644 --- a/av_transport/av_trans_engine/av_sender/test/unittest/av_sender_engine/BUILD.gn +++ b/av_transport/av_trans_engine/av_sender/test/unittest/av_sender_engine/BUILD.gn @@ -53,6 +53,7 @@ ohos_unittest("AvSenderEngineTest") { cflags_cc = cflags deps = [ + "${dh_fwk_sdk_path}:dhfwk_idl_hardware_head", "${dh_fwk_sdk_path}:libdhfwk_sdk", "${engine_path}/av_sender:distributed_av_sender", "${filters_path}:avtrans_input_filter", @@ -133,6 +134,7 @@ ohos_unittest("AvAudioSenderEngineTest") { cflags_cc = cflags deps = [ + "${dh_fwk_sdk_path}:dhfwk_idl_hardware_head", "${dh_fwk_sdk_path}:libdhfwk_sdk", "${distributed_av_transport_path}/framework:distributed_av_pipeline_fwk", "${engine_path}/av_sender:distributed_av_sender", diff --git a/av_transport/av_trans_engine/av_sender/test/unittest/av_sender_engine_provider/BUILD.gn b/av_transport/av_trans_engine/av_sender/test/unittest/av_sender_engine_provider/BUILD.gn index b2c42b5cdcdf535b636bf089d310a9e5ce04fa52..0f01c383217991f5cb15c58177649e8d0a629003 100644 --- a/av_transport/av_trans_engine/av_sender/test/unittest/av_sender_engine_provider/BUILD.gn +++ b/av_transport/av_trans_engine/av_sender/test/unittest/av_sender_engine_provider/BUILD.gn @@ -53,6 +53,7 @@ ohos_unittest("AvSenderEngineProviderTest") { cflags_cc = cflags deps = [ + "${dh_fwk_sdk_path}:dhfwk_idl_hardware_head", "${dh_fwk_sdk_path}:libdhfwk_sdk", "${engine_path}/av_sender:distributed_av_sender", "${filters_path}:avtrans_input_filter", @@ -136,6 +137,7 @@ ohos_unittest("AvAudioSenderEngineProviderTest") { cflags_cc = cflags deps = [ + "${dh_fwk_sdk_path}:dhfwk_idl_hardware_head", "${dh_fwk_sdk_path}:libdhfwk_sdk", "${engine_path}/av_sender:distributed_av_sender", "${filters_path}:avtrans_input_filter", diff --git a/av_transport/av_trans_handler/histreamer_ability_querier/test/unittest/common/BUILD.gn b/av_transport/av_trans_handler/histreamer_ability_querier/test/unittest/common/BUILD.gn index 1b9fa37c40beee5a603163a4e0abf798b9f095b2..41d15659cd6543e72d12c281b9c9d77bbb2196e2 100644 --- a/av_transport/av_trans_handler/histreamer_ability_querier/test/unittest/common/BUILD.gn +++ b/av_transport/av_trans_handler/histreamer_ability_querier/test/unittest/common/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2023-2024 Huawei Device Co., Ltd. +# Copyright (c) 2023-2025 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at @@ -54,6 +54,7 @@ ohos_unittest("HistreamerAbilityQuerierTest") { "bounds_checking_function:libsec_shared", "cJSON:cjson", "c_utils:utils", + "hilog:libhilog", ] defines = [ diff --git a/av_transport/common/include/av_sync_utils.h b/av_transport/common/include/av_sync_utils.h index c1cafa76fff12c48e0dd0f3ae1d0c2d7f2ea2f84..c0bf87529eb22be872bd81ad6fe92e2d47f00d37 100644 --- a/av_transport/common/include/av_sync_utils.h +++ b/av_transport/common/include/av_sync_utils.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2023 Huawei Device Co., Ltd. + * Copyright (C) 2023-2025 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -18,6 +18,8 @@ #include #include +#include "parcel.h" +#include "message_parcel.h" namespace OHOS { namespace DistributedHardware { @@ -34,6 +36,45 @@ struct AVTransSharedMemory { std::string name; }; +struct AVTransSharedMemoryExt : public AVTransSharedMemory, public Parcelable { + using AVTransSharedMemory::AVTransSharedMemory; + explicit AVTransSharedMemoryExt() {} + virtual ~AVTransSharedMemoryExt() = default; + explicit AVTransSharedMemoryExt(const AVTransSharedMemory& avTransSharedMemory) + { + fd = avTransSharedMemory.fd; + size = avTransSharedMemory.size; + name = avTransSharedMemory.name; + } + virtual bool Marshalling(Parcel &parcel) const override + { + MessageParcel &messageParcel = static_cast(parcel); + if (!messageParcel.WriteFileDescriptor(fd)) { + return false; + } + if (!parcel.WriteInt32(size)) { + return false; + } + if (!parcel.WriteString(name)) { + return false; + } + return true; + } + + static AVTransSharedMemoryExt *Unmarshalling(Parcel &parcel) + { + MessageParcel &messageParcel = static_cast(parcel); + AVTransSharedMemoryExt *avTransSharedMemory = new (std::nothrow) AVTransSharedMemoryExt(); + if (avTransSharedMemory == nullptr) { + return nullptr; + } + avTransSharedMemory->fd = messageParcel.ReadFileDescriptor(); + avTransSharedMemory->size = parcel.ReadInt32(); + avTransSharedMemory->name = parcel.ReadString(); + return avTransSharedMemory; + } +}; + struct AVSyncClockUnit { uint32_t index; uint32_t frameNum; diff --git a/av_transport/common/include/av_trans_types.h b/av_transport/common/include/av_trans_types.h index cb9ca677abdab4f58f696b5043b85aafe6296e55..0c0a5c00e8a1210d50dfdd65d5190bf333f23586 100644 --- a/av_transport/common/include/av_trans_types.h +++ b/av_transport/common/include/av_trans_types.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023 Huawei Device Co., Ltd. + * Copyright (c) 2023-2025 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -18,6 +18,8 @@ #include #include +#include "parcel.h" +#include "message_parcel.h" namespace OHOS { namespace DistributedHardware { @@ -158,6 +160,48 @@ struct AVTransEvent { std::string peerDevId; }; +struct AVTransEventExt : public AVTransEvent, public Parcelable { + using AVTransEvent::AVTransEvent; + explicit AVTransEventExt() {} + virtual ~AVTransEventExt() = default; + explicit AVTransEventExt(const AVTransEvent& AVTransEvent) + { + type = AVTransEvent.type; + content = AVTransEvent.content; + peerDevId = AVTransEvent.peerDevId; + } + + virtual bool Marshalling(Parcel &parcel) const override + { + if (!parcel.WriteUint32((uint32_t)type)) { + return false; + } + if (!parcel.WriteString(content)) { + return false; + } + if (!parcel.WriteString(peerDevId)) { + return false; + } + return true; + } + + static AVTransEventExt *Unmarshalling(Parcel &parcel) + { + AVTransEventExt *avTransEvent = new (std::nothrow) AVTransEventExt(); + if (avTransEvent == nullptr) { + return nullptr; + } + uint32_t typeValue = parcel.ReadUint32(); + std::string contentValue = parcel.ReadString(); + std::string peerDevIdValue = parcel.ReadString(); + avTransEvent->type = static_cast(typeValue); + avTransEvent->content = contentValue; + avTransEvent->peerDevId = peerDevIdValue; + + return avTransEvent; + } +}; + struct AVStreamInfo { std::string sceneType; std::string peerDevId; diff --git a/av_transport/common/test/unittest/BUILD.gn b/av_transport/common/test/unittest/BUILD.gn index 194df3d238ade59929d8156f775b1d0b880b33b6..3afb85ef59ac3fbaad97aab8c50f53689f09217a 100644 --- a/av_transport/common/test/unittest/BUILD.gn +++ b/av_transport/common/test/unittest/BUILD.gn @@ -54,6 +54,7 @@ ohos_unittest("AvSyncUtilsTest") { "googletest:gmock", "googletest:gmock_main", "ipc:ipc_core", + "hilog:libhilog", ] cflags = [ diff --git a/bundle.json b/bundle.json index 5b6bfe3ded17bb8f301f80dbb74c1a5eb46d351f..d6192a1eb67870d4686df0bb2344e59360dcdfed 100644 --- a/bundle.json +++ b/bundle.json @@ -137,7 +137,6 @@ "device_type.h", "dhardware_ipc_interface_code.h", "distributed_hardware_errno.h", - "iav_trans_control_center_callback.h", "idistributed_hardware_manager.h", "idistributed_hardware_sink.h", "idistributed_hardware_source.h", diff --git a/common/utils/include/idistributed_hardware.h b/common/utils/include/idistributed_hardware.h index e17488b9d7696b128cf587913a2136c18aecbdd9..64ffee52751f87149896f3c9feb294e3ccccecfe 100644 --- a/common/utils/include/idistributed_hardware.h +++ b/common/utils/include/idistributed_hardware.h @@ -47,7 +47,7 @@ public: virtual int32_t CreateControlChannel(int32_t engineId, const std::string &peerDevId) = 0; virtual int32_t NotifyAVCenter(int32_t engineId, const AVTransEvent &event) = 0; virtual int32_t RegisterCtlCenterCallback(int32_t engineId, - const sptr callback) = 0; + const sptr callback) = 0; virtual int32_t NotifySourceRemoteSinkStarted(std::string &deviceId) = 0; virtual int32_t PauseDistributedHardware(DHType dhType, const std::string &networkId) = 0; virtual int32_t ResumeDistributedHardware(DHType dhType, const std::string &networkId) = 0; diff --git a/interfaces/inner_kits/BUILD.gn b/interfaces/inner_kits/BUILD.gn index 0d6f0583c762c9365ff0c30e318250908223a1a6..914993618df8a96c37f2ddd646d9229d61b8024e 100644 --- a/interfaces/inner_kits/BUILD.gn +++ b/interfaces/inner_kits/BUILD.gn @@ -11,6 +11,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +import("//build/config/components/idl_tool/idl.gni") import("//build/ohos.gni") import( "//foundation/distributedhardware/distributed_hardware_fwk/distributedhardwarefwk.gni") @@ -22,6 +23,73 @@ config("innerkits_external_config") { ] } +idl_gen_interface("dhfwk_idl_hardware") { + sources = [ + "IAvTransControlCenterCallback.idl", + ] + log_domainid = "0xD004100" + log_tag = "distributedhardware" +} + +config("dhfwk_idl_hardware_config") { + include_dirs = [ + "include", + "${av_trans_path}/common/include", + "${innerkits_path}/include", + ".", + "${target_gen_dir}", + "${common_path}/utils/include", + ] +} + +ohos_source_set("dhfwk_idl_hardware_source") { + sanitize = { + cfi = true + cfi_cross_dso = true + debug = false + } + public_configs = [ ":dhfwk_idl_hardware_config" ] + output_values = get_target_outputs(":dhfwk_idl_hardware") + sources = filter_include(output_values, [ "*.cpp" ]) + deps = [ ":dhfwk_idl_hardware" ] + + external_deps = [ + "c_utils:utils", + "hilog:libhilog", + "hitrace:hitrace_meter", + "ipc:ipc_core", + "safwk:system_ability_fwk", + "samgr:samgr_proxy", + ] + + subsystem_name = "distributedhardware" + + part_name = "distributed_hardware_fwk" +} + +ohos_source_set("dhfwk_idl_hardware_head") { + sanitize = { + cfi = true + cfi_cross_dso = true + debug = false + } + public_configs = [ ":dhfwk_idl_hardware_config" ] + deps = [ ":dhfwk_idl_hardware" ] + + external_deps = [ + "c_utils:utils", + "hilog:libhilog", + "hitrace:hitrace_meter", + "ipc:ipc_core", + "safwk:system_ability_fwk", + "samgr:samgr_proxy", + ] + + subsystem_name = "distributedhardware" + + part_name = "distributed_hardware_fwk" +} + ohos_shared_library("libdhfwk_sdk") { sanitize = { boundary_sanitize = true @@ -48,7 +116,6 @@ ohos_shared_library("libdhfwk_sdk") { sources = [ "${av_center_kits_path}/src/av_trans_control_center_callback.cpp", - "${av_center_kits_path}/src/av_trans_control_center_callback_stub.cpp", "${innerkits_path}/src/distributed_hardware_fwk_kit.cpp", "${innerkits_path}/src/ipc/dhfwk_sa_manager.cpp", "${innerkits_path}/src/ipc/distributed_hardware_proxy.cpp", @@ -58,6 +125,7 @@ ohos_shared_library("libdhfwk_sdk") { ] deps = [ + ":dhfwk_idl_hardware_source", "${services_path}/distributedhardwarefwkservice:distributedhardwarefwksvr", "${utils_path}:distributedhardwareutils", ] @@ -79,6 +147,7 @@ ohos_shared_library("libdhfwk_sdk") { "c_utils:utils", "hilog:libhilog", "hisysevent:libhisysevent", + "hitrace:hitrace_meter", "ipc:ipc_core", "safwk:system_ability_fwk", "samgr:samgr_proxy", diff --git a/common/utils/include/iav_trans_control_center_callback.h b/interfaces/inner_kits/IAvTransControlCenterCallback.idl similarity index 40% rename from common/utils/include/iav_trans_control_center_callback.h rename to interfaces/inner_kits/IAvTransControlCenterCallback.idl index bcbe6338f28ed5bd4d945efd8464c0c979fbd7f3..572afca178777099d47ee5f0f354e61a8006d94b 100644 --- a/common/utils/include/iav_trans_control_center_callback.h +++ b/interfaces/inner_kits/IAvTransControlCenterCallback.idl @@ -1,43 +1,23 @@ -/* - * Copyright (c) 2023 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef OHOS_I_AV_TRANSPORT_CONTROL_CENTER_CALLBACK_H -#define OHOS_I_AV_TRANSPORT_CONTROL_CENTER_CALLBACK_H - -#include "iremote_broker.h" - -#include "av_sync_utils.h" -#include "av_trans_errno.h" -#include "av_trans_types.h" - -namespace OHOS { -namespace DistributedHardware { -class IAVTransControlCenterCallback : public IRemoteBroker { -public: - virtual int32_t SetParameter(AVTransTag tag, const std::string &value) = 0; - virtual int32_t SetSharedMemory(const AVTransSharedMemory &memory) = 0; - virtual int32_t Notify(const AVTransEvent &event) = 0; - - enum class Message : uint32_t { - SET_PARAMETER = 1, - SET_SHARED_MEMORY = 2, - NOTIFY_AV_EVENT = 3 - }; - - DECLARE_INTERFACE_DESCRIPTOR(u"ohos.distributedhardware.IAVTransControlCenterCallback"); -}; -} -} -#endif \ No newline at end of file +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package OHOS.DistributedHardware; +sequenceable AvTransTypes..OHOS.DistributedHardware.AVTransEventExt; +sequenceable AvSyncUtils..OHOS.DistributedHardware.AVTransSharedMemoryExt; +interface OHOS.DistributedHardware.IAvTransControlCenterCallback { + [ipccode 1] void SetParameter([in] unsigned int tag, [in] String value); + [ipccode 2] void SetSharedMemory([in] AVTransSharedMemoryExt memory); + [ipccode 3] void Notify([in] AVTransEventExt event); +} \ No newline at end of file diff --git a/interfaces/inner_kits/include/distributed_hardware_fwk_kit.h b/interfaces/inner_kits/include/distributed_hardware_fwk_kit.h index d2744e90ae8325ccaf4618ae051ae412b1ce5771..3c3e3927a572117fa9d63bdfedb9c1764ff4d0fa 100644 --- a/interfaces/inner_kits/include/distributed_hardware_fwk_kit.h +++ b/interfaces/inner_kits/include/distributed_hardware_fwk_kit.h @@ -29,6 +29,9 @@ #include "idistributed_hardware.h" #include "iget_dh_descriptors_callback.h" #include "ihardware_status_listener.h" +#include "device_type.h" +#include "av_trans_types.h" +#include "iav_trans_control_center_callback.h" #ifndef API_EXPORT #define API_EXPORT __attribute__((visibility("default"))) @@ -131,7 +134,7 @@ public: * @param callback av control center callback. * @return Returns 0 if success. */ - API_EXPORT int32_t RegisterCtlCenterCallback(int32_t engineId, const sptr callback); + API_EXPORT int32_t RegisterCtlCenterCallback(int32_t engineId, const sptr callback); /** * @brief Pause distributed hardware. diff --git a/interfaces/inner_kits/include/ipc/dhfwk_sa_manager.h b/interfaces/inner_kits/include/ipc/dhfwk_sa_manager.h index 831fafebe966b774f55d6339eac9cf5ae97509f8..0a7f1e5959e1643501139f755e27f7710dc0c5b4 100644 --- a/interfaces/inner_kits/include/ipc/dhfwk_sa_manager.h +++ b/interfaces/inner_kits/include/ipc/dhfwk_sa_manager.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Huawei Device Co., Ltd. + * Copyright (c) 2022-2025 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -42,7 +42,7 @@ public: int32_t AddPublisherListenerToCache(const DHTopic topic, sptr listener); void RemovePublisherListenerFromCache(const DHTopic topic, sptr listener); - void AddAVTransControlCenterCbToCache(int32_t engineId, const sptr callback); + void AddAVTransControlCenterCbToCache(int32_t engineId, const sptr callback); void RemoveAVTransControlCenterCbFromCache(int32_t engineId); public: @@ -66,7 +66,7 @@ private: std::mutex publisherListenersMutex_; std::unordered_map>> publisherListenersCache_; std::mutex avTransControlCenterCbMutex_; - std::unordered_map> avTransControlCenterCbCache_; + std::unordered_map> avTransControlCenterCbCache_; }; } // DistributedHardware } // OHOS diff --git a/interfaces/inner_kits/include/ipc/distributed_hardware_proxy.h b/interfaces/inner_kits/include/ipc/distributed_hardware_proxy.h index 90937e86472e681bc581ab49c035420aac3309d4..648f07be63dd37510efaa3a40f4cc0b8fdae4357 100644 --- a/interfaces/inner_kits/include/ipc/distributed_hardware_proxy.h +++ b/interfaces/inner_kits/include/ipc/distributed_hardware_proxy.h @@ -42,7 +42,7 @@ public: int32_t ReleaseAVCenter(int32_t engineId) override; int32_t CreateControlChannel(int32_t engineId, const std::string &peerDevId) override; int32_t NotifyAVCenter(int32_t engineId, const AVTransEvent &event) override; - int32_t RegisterCtlCenterCallback(int32_t engineId, const sptr callback) override; + int32_t RegisterCtlCenterCallback(int32_t engineId, const sptr callback) override; int32_t NotifySourceRemoteSinkStarted(std::string &deviceId) override; int32_t PauseDistributedHardware(DHType dhType, const std::string &networkId) override; int32_t ResumeDistributedHardware(DHType dhType, const std::string &networkId) override; diff --git a/interfaces/inner_kits/src/distributed_hardware_fwk_kit.cpp b/interfaces/inner_kits/src/distributed_hardware_fwk_kit.cpp index 91ea88ca18963ff81e1adff3e1c26a84fde9b169..0d8be356572c7044ce73daf64af3c627f5f8224a 100644 --- a/interfaces/inner_kits/src/distributed_hardware_fwk_kit.cpp +++ b/interfaces/inner_kits/src/distributed_hardware_fwk_kit.cpp @@ -206,7 +206,7 @@ int32_t DistributedHardwareFwkKit::NotifyAVCenter(int32_t engineId, const AVTran } int32_t DistributedHardwareFwkKit::RegisterCtlCenterCallback(int32_t engineId, - const sptr callback) + const sptr callback) { DHLOGI("Register av control center callback. engineId: %{public}" PRId32, engineId); diff --git a/interfaces/inner_kits/src/ipc/dhfwk_sa_manager.cpp b/interfaces/inner_kits/src/ipc/dhfwk_sa_manager.cpp index 29c30e52642a8b585d18f96f9207678a95adcc8d..b1b9b2c8e3e2323984af53d0b6256eb9c71537a4 100644 --- a/interfaces/inner_kits/src/ipc/dhfwk_sa_manager.cpp +++ b/interfaces/inner_kits/src/ipc/dhfwk_sa_manager.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022-2024 Huawei Device Co., Ltd. + * Copyright (c) 2022-2025 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -200,7 +200,7 @@ void DHFWKSAManager::RemovePublisherListenerFromCache(const DHTopic topic, sptr< } void DHFWKSAManager::AddAVTransControlCenterCbToCache(int32_t engineId, - const sptr callback) + const sptr callback) { std::lock_guard avTransControlCenterCbLock(avTransControlCenterCbMutex_); avTransControlCenterCbCache_[engineId] = callback; diff --git a/interfaces/inner_kits/src/ipc/distributed_hardware_proxy.cpp b/interfaces/inner_kits/src/ipc/distributed_hardware_proxy.cpp index 47ee352db885aa38588b58f8b7ae2fa6008c8d69..41137e54dbf859c145b8c7980f5deca0efa29b19 100644 --- a/interfaces/inner_kits/src/ipc/distributed_hardware_proxy.cpp +++ b/interfaces/inner_kits/src/ipc/distributed_hardware_proxy.cpp @@ -352,7 +352,7 @@ int32_t DistributedHardwareProxy::NotifyAVCenter(int32_t engineId, const AVTrans } int32_t DistributedHardwareProxy::RegisterCtlCenterCallback(int32_t engineId, - const sptr callback) + const sptr callback) { sptr remote = Remote(); if (remote == nullptr) { diff --git a/interfaces/inner_kits/test/fuzztest/distributedhardwarefwkkit_fuzzer/BUILD.gn b/interfaces/inner_kits/test/fuzztest/distributedhardwarefwkkit_fuzzer/BUILD.gn index f2d874b401f449b095099a6b00dc461698953b17..2b6dcea16f3a4d961564cd34157e8b71eff8fee3 100644 --- a/interfaces/inner_kits/test/fuzztest/distributedhardwarefwkkit_fuzzer/BUILD.gn +++ b/interfaces/inner_kits/test/fuzztest/distributedhardwarefwkkit_fuzzer/BUILD.gn @@ -54,7 +54,10 @@ ohos_fuzztest("DistributedHardwareFwkKitFuzzTest") { "c_utils:utils", "ipc:ipc_core", "safwk:system_ability_fwk", + "hilog:libhilog", ] + + public_configs = [ "${innerkits_path}:dhfwk_idl_hardware_config" ] } ############################################################################### diff --git a/interfaces/inner_kits/test/fuzztest/distributedhardwarefwkstub_fuzzer/BUILD.gn b/interfaces/inner_kits/test/fuzztest/distributedhardwarefwkstub_fuzzer/BUILD.gn index a344a08bfb8ab5cb093fa43feb1d533244b9a815..397d08d5ac326987a6ffcc3d40edd9fb3ddb087c 100644 --- a/interfaces/inner_kits/test/fuzztest/distributedhardwarefwkstub_fuzzer/BUILD.gn +++ b/interfaces/inner_kits/test/fuzztest/distributedhardwarefwkstub_fuzzer/BUILD.gn @@ -53,7 +53,10 @@ ohos_fuzztest("DistributedHardwareFwkStubFuzzTest") { "c_utils:utils", "ipc:ipc_core", "safwk:system_ability_fwk", + "hilog:libhilog", ] + + public_configs = [ "${innerkits_path}:dhfwk_idl_hardware_config" ] } ############################################################################### diff --git a/interfaces/inner_kits/test/unittest/common/distributedhardwarefwkkit/BUILD.gn b/interfaces/inner_kits/test/unittest/common/distributedhardwarefwkkit/BUILD.gn index 913a5577aa92e07d20baf14bd48d213e22b365bf..bd72a3eeeb05b2421aa4a273c1bffc931c18af52 100644 --- a/interfaces/inner_kits/test/unittest/common/distributedhardwarefwkkit/BUILD.gn +++ b/interfaces/inner_kits/test/unittest/common/distributedhardwarefwkkit/BUILD.gn @@ -58,6 +58,8 @@ ohos_unittest("DistributedHardwareFwkKitTest") { "safwk:system_ability_fwk", "samgr:samgr_proxy", ] + + public_configs = [ "${innerkits_path}:dhfwk_idl_hardware_config" ] } group("distributed_hardware_fwk_kit_test") { diff --git a/interfaces/inner_kits/test/unittest/common/distributedhardwarefwkkit/src/distributed_hardware_fwk_kit_test.cpp b/interfaces/inner_kits/test/unittest/common/distributedhardwarefwkkit/src/distributed_hardware_fwk_kit_test.cpp index eb5994952bd5cde0524a5a2a9c1fedd363c94c99..9cae45bfa8f1f33a611e071d12543825310a6861 100644 --- a/interfaces/inner_kits/test/unittest/common/distributedhardwarefwkkit/src/distributed_hardware_fwk_kit_test.cpp +++ b/interfaces/inner_kits/test/unittest/common/distributedhardwarefwkkit/src/distributed_hardware_fwk_kit_test.cpp @@ -390,7 +390,7 @@ HWTEST_F(DistributedHardwareFwkKitTest, RegisterCtlCenterCallback_001, testing:: { ASSERT_TRUE(dhfwkPtr_ != nullptr); int32_t engineId = 0; - sptr callback = nullptr; + sptr callback = nullptr; int32_t ret = dhfwkPtr_->RegisterCtlCenterCallback(engineId, callback); EXPECT_EQ(ERR_DH_FWK_POINTER_IS_NULL, ret); } diff --git a/interfaces/inner_kits/test/unittest/common/ipc/dhfwk_sa_manager/BUILD.gn b/interfaces/inner_kits/test/unittest/common/ipc/dhfwk_sa_manager/BUILD.gn index 2b65e96b98b50d6d8e12f8c51894b6af21d850b4..772eb9f8b4676e95913723920ba273c9c036b7e0 100644 --- a/interfaces/inner_kits/test/unittest/common/ipc/dhfwk_sa_manager/BUILD.gn +++ b/interfaces/inner_kits/test/unittest/common/ipc/dhfwk_sa_manager/BUILD.gn @@ -55,6 +55,7 @@ ohos_unittest("DhfwkSaManagerTest") { "ipc:ipc_core", "safwk:system_ability_fwk", "samgr:samgr_proxy", + "hilog:libhilog", ] cflags = [ diff --git a/interfaces/inner_kits/test/unittest/common/ipc/dhfwk_sa_manager/include/dhfwk_sa_manager_test.h b/interfaces/inner_kits/test/unittest/common/ipc/dhfwk_sa_manager/include/dhfwk_sa_manager_test.h index 7639175f2aaac9a861f6d58b847f179a0a0785be..12796b558ae9f6d7924ce5ce0a7f4fdf8458d313 100644 --- a/interfaces/inner_kits/test/unittest/common/ipc/dhfwk_sa_manager/include/dhfwk_sa_manager_test.h +++ b/interfaces/inner_kits/test/unittest/common/ipc/dhfwk_sa_manager/include/dhfwk_sa_manager_test.h @@ -97,7 +97,7 @@ int32_t NotifyAVCenter(int32_t engineId, const AVTransEvent &event) return DH_FWK_SUCCESS; } -int32_t RegisterCtlCenterCallback(int32_t engineId, const sptr callback) +int32_t RegisterCtlCenterCallback(int32_t engineId, const sptr callback) { (void)engineId; (void)callback; diff --git a/interfaces/inner_kits/test/unittest/common/ipc/distributed_hardware_proxy/include/distributed_hardware_proxy_test.h b/interfaces/inner_kits/test/unittest/common/ipc/distributed_hardware_proxy/include/distributed_hardware_proxy_test.h index 7466ec10807fca29fd650c67832bce93c9e4d6bc..03bc7d3e8f7181a7c4fef777c65095fcae4263a3 100644 --- a/interfaces/inner_kits/test/unittest/common/ipc/distributed_hardware_proxy/include/distributed_hardware_proxy_test.h +++ b/interfaces/inner_kits/test/unittest/common/ipc/distributed_hardware_proxy/include/distributed_hardware_proxy_test.h @@ -50,7 +50,7 @@ public: int32_t ReleaseAVCenter(int32_t engineId); int32_t CreateControlChannel(int32_t engineId, const std::string &peerDevId); int32_t NotifyAVCenter(int32_t engineId, const AVTransEvent &event); - int32_t RegisterCtlCenterCallback(int32_t engineId, const sptr callback); + int32_t RegisterCtlCenterCallback(int32_t engineId, const sptr callback); int32_t NotifySourceRemoteSinkStarted(std::string &deviceId); int32_t PauseDistributedHardware(DHType dhType, const std::string &networkId); int32_t ResumeDistributedHardware(DHType dhType, const std::string &networkId); diff --git a/interfaces/inner_kits/test/unittest/common/ipc/distributed_hardware_proxy/src/distributed_hardware_proxy_test.cpp b/interfaces/inner_kits/test/unittest/common/ipc/distributed_hardware_proxy/src/distributed_hardware_proxy_test.cpp index 0195307b1453a40e6fef55f90eb412201671e41a..d9bf7db2b8d31cf7782c85e5c88e18f9d8741b5c 100644 --- a/interfaces/inner_kits/test/unittest/common/ipc/distributed_hardware_proxy/src/distributed_hardware_proxy_test.cpp +++ b/interfaces/inner_kits/test/unittest/common/ipc/distributed_hardware_proxy/src/distributed_hardware_proxy_test.cpp @@ -15,6 +15,7 @@ #include "distributed_hardware_proxy_test.h" #include "dhardware_ipc_interface_code.h" +#include "av_trans_errno.h" using namespace testing::ext; @@ -102,7 +103,7 @@ int32_t DistributedHardwareProxyTest::TestDistributedHardwareStub::NotifyAVCente } int32_t DistributedHardwareProxyTest::TestDistributedHardwareStub::RegisterCtlCenterCallback(int32_t engineId, - const sptr callback) + const sptr callback) { (void)engineId; (void)callback; @@ -458,7 +459,7 @@ HWTEST_F(DistributedHardwareProxyTest, NotifyAVCenter_001, TestSize.Level1) HWTEST_F(DistributedHardwareProxyTest, RegisterCtlCenterCallback_001, TestSize.Level1) { int32_t engineId = 0; - sptr callback = nullptr; + sptr callback = nullptr; sptr dhStubPtr(new TestDistributedHardwareStub()); ASSERT_TRUE(dhStubPtr != nullptr); DistributedHardwareProxy dhProxy(dhStubPtr); diff --git a/interfaces/inner_kits/test/unittest/common/ipc/hardware_status_listener_stub/BUILD.gn b/interfaces/inner_kits/test/unittest/common/ipc/hardware_status_listener_stub/BUILD.gn index a6fd17dc2099bfc620cf242ef4dd81728e29f509..e77d37db8208ff26d8a6298a9df0b041365ea3d0 100644 --- a/interfaces/inner_kits/test/unittest/common/ipc/hardware_status_listener_stub/BUILD.gn +++ b/interfaces/inner_kits/test/unittest/common/ipc/hardware_status_listener_stub/BUILD.gn @@ -54,6 +54,7 @@ ohos_unittest("HardwareStatusListenerStubTest") { "ipc:ipc_core", "safwk:system_ability_fwk", "samgr:samgr_proxy", + "hilog:libhilog", ] cflags = [ diff --git a/interfaces/inner_kits/test/unittest/common/ipc/publisher_listener_stub/BUILD.gn b/interfaces/inner_kits/test/unittest/common/ipc/publisher_listener_stub/BUILD.gn index 3da38ba05789b8e7d33ba1d887a5471d579a2040..c6c5cd6c5a61b059127cc2cbe67e59629095e15c 100644 --- a/interfaces/inner_kits/test/unittest/common/ipc/publisher_listener_stub/BUILD.gn +++ b/interfaces/inner_kits/test/unittest/common/ipc/publisher_listener_stub/BUILD.gn @@ -55,6 +55,7 @@ ohos_unittest("PublisherListenerStubTest") { "ipc:ipc_core", "safwk:system_ability_fwk", "samgr:samgr_proxy", + "hilog:libhilog", ] cflags = [ diff --git a/interfaces/kits/napi/BUILD.gn b/interfaces/kits/napi/BUILD.gn index b57cb752007906fdd124bf783174d29a6e4b7be0..456412b6f6a44cb469d1b5125f994c4be6c44361 100644 --- a/interfaces/kits/napi/BUILD.gn +++ b/interfaces/kits/napi/BUILD.gn @@ -68,4 +68,6 @@ ohos_shared_library("hardwaremanager") { subsystem_name = "distributedhardware" relative_install_dir = "module/distributedhardware" part_name = "distributed_hardware_fwk" + + public_configs = [ "${innerkits_path}:dhfwk_idl_hardware_config" ] } diff --git a/services/distributedhardwarefwkservice/BUILD.gn b/services/distributedhardwarefwkservice/BUILD.gn index a5ffe399373916dc5dd1275794aff1adb871f6b2..ec7d55fe1d99e7a1746df2133945449084bacbd5 100644 --- a/services/distributedhardwarefwkservice/BUILD.gn +++ b/services/distributedhardwarefwkservice/BUILD.gn @@ -55,7 +55,6 @@ ohos_shared_library("distributedhardwarefwksvr") { sources = [ "${av_center_svc_path}/src/av_sync_manager.cpp", "${av_center_svc_path}/src/av_trans_control_center.cpp", - "${av_center_svc_path}/src/ipc/av_trans_control_center_callback_proxy.cpp", "${av_trans_path}/common/src/av_sync_utils.cpp", "${av_trans_path}/common/src/av_trans_message.cpp", "${av_trans_path}/common/src/softbus_channel_adapter.cpp", @@ -112,7 +111,10 @@ ohos_shared_library("distributedhardwarefwksvr") { "src/versionmanager/version_manager.cpp", ] - deps = [ "${utils_path}:distributedhardwareutils" ] + deps = [ + "${utils_path}:distributedhardwareutils", + "${innerkits_path}:dhfwk_idl_hardware_source", + ] defines = [ "HI_LOG_ENABLE", @@ -172,4 +174,6 @@ ohos_shared_library("distributedhardwarefwksvr") { subsystem_name = "distributedhardware" part_name = "distributed_hardware_fwk" + + public_configs = [ "${innerkits_path}:dhfwk_idl_hardware_config" ] } diff --git a/services/distributedhardwarefwkservice/include/distributed_hardware_service.h b/services/distributedhardwarefwkservice/include/distributed_hardware_service.h index c535261565401fe474c15190c31d0aa249706880..444a260f3d09faf4b5c70930dcd07d6f73890a91 100644 --- a/services/distributedhardwarefwkservice/include/distributed_hardware_service.h +++ b/services/distributedhardwarefwkservice/include/distributed_hardware_service.h @@ -47,7 +47,7 @@ public: int32_t ReleaseAVCenter(int32_t engineId) override; int32_t CreateControlChannel(int32_t engineId, const std::string &peerDevId) override; int32_t NotifyAVCenter(int32_t engineId, const AVTransEvent &event) override; - int32_t RegisterCtlCenterCallback(int32_t engineId, const sptr callback) override; + int32_t RegisterCtlCenterCallback(int32_t engineId, const sptr callback) override; int32_t NotifySourceRemoteSinkStarted(std::string &deviceId) override; int32_t PauseDistributedHardware(DHType dhType, const std::string &networkId) override; int32_t ResumeDistributedHardware(DHType dhType, const std::string &networkId) override; diff --git a/services/distributedhardwarefwkservice/src/distributed_hardware_service.cpp b/services/distributedhardwarefwkservice/src/distributed_hardware_service.cpp index bc63bfd32eb30daf8b48eaecc4f66acac5539bc6..218f02cf2e15d42c2bce5c84ce5353afc3afed95 100644 --- a/services/distributedhardwarefwkservice/src/distributed_hardware_service.cpp +++ b/services/distributedhardwarefwkservice/src/distributed_hardware_service.cpp @@ -274,7 +274,7 @@ int32_t DistributedHardwareService::NotifyAVCenter(int32_t engineId, const AVTra } int32_t DistributedHardwareService::RegisterCtlCenterCallback(int32_t engineId, - const sptr callback) + const sptr callback) { return AVTransControlCenter::GetInstance().RegisterCtlCenterCallback(engineId, callback); } diff --git a/services/distributedhardwarefwkservice/src/distributed_hardware_stub.cpp b/services/distributedhardwarefwkservice/src/distributed_hardware_stub.cpp index 19c8d50577e58eaf6bb66e7964c94362489ed403..a122723654a26a6fc0d7477af9fe19efbc796b54 100644 --- a/services/distributedhardwarefwkservice/src/distributed_hardware_stub.cpp +++ b/services/distributedhardwarefwkservice/src/distributed_hardware_stub.cpp @@ -31,6 +31,7 @@ #include "distributed_hardware_errno.h" #include "distributed_hardware_log.h" #include "publisher_listener_proxy.h" +#include "av_trans_errno.h" namespace OHOS { namespace DistributedHardware { @@ -264,7 +265,7 @@ int32_t DistributedHardwareStub::RegisterControlCenterCallbackInner(MessageParce } int32_t engineId = data.ReadInt32(); - sptr callback = iface_cast(data.ReadRemoteObject()); + sptr callback = iface_cast(data.ReadRemoteObject()); if (callback == nullptr) { DHLOGE("Input av control center callback is null"); return ERR_DH_FWK_PARA_INVALID; diff --git a/services/distributedhardwarefwkservice/test/unittest/common/componentmanager/component_privacy/BUILD.gn b/services/distributedhardwarefwkservice/test/unittest/common/componentmanager/component_privacy/BUILD.gn index 4b5ca7df68fb32dc45776bf9f174075106535b7c..c1c128cb21b2ae4404a7c90aa200df672342d4a6 100644 --- a/services/distributedhardwarefwkservice/test/unittest/common/componentmanager/component_privacy/BUILD.gn +++ b/services/distributedhardwarefwkservice/test/unittest/common/componentmanager/component_privacy/BUILD.gn @@ -51,6 +51,7 @@ ohos_unittest("ComponentPrivacyTest") { "ipc:ipc_core", "ipc:ipc_single", "samgr:samgr_proxy", + "hilog:libhilog", ] cflags = [ diff --git a/services/distributedhardwarefwkservice/test/unittest/common/distributedhardwarestub/BUILD.gn b/services/distributedhardwarefwkservice/test/unittest/common/distributedhardwarestub/BUILD.gn index 93d928483fa71fd289c370825f747c64373fb30a..c2b37a73b43da8eb016a7650875e0979d82ba610 100644 --- a/services/distributedhardwarefwkservice/test/unittest/common/distributedhardwarestub/BUILD.gn +++ b/services/distributedhardwarefwkservice/test/unittest/common/distributedhardwarestub/BUILD.gn @@ -70,6 +70,7 @@ ohos_unittest("DistributedHardwareStubTest") { "googletest:gmock_main", "ipc:ipc_core", "safwk:system_ability_fwk", + "hilog:libhilog", ] } diff --git a/services/distributedhardwarefwkservice/test/unittest/common/distributedhardwarestub/include/distributed_hardware_stub_test.h b/services/distributedhardwarefwkservice/test/unittest/common/distributedhardwarestub/include/distributed_hardware_stub_test.h index 9e6d4975c98a8056493d3fe57d9a276b27a8c3b7..8c38da8a6e8c07108dc38335405c59d1acbe2355 100644 --- a/services/distributedhardwarefwkservice/test/unittest/common/distributedhardwarestub/include/distributed_hardware_stub_test.h +++ b/services/distributedhardwarefwkservice/test/unittest/common/distributedhardwarestub/include/distributed_hardware_stub_test.h @@ -91,7 +91,7 @@ int32_t NotifyAVCenter(int32_t engineId, const AVTransEvent &event) return DH_FWK_SUCCESS; } -int32_t RegisterCtlCenterCallback(int32_t engineId, const sptr callback) +int32_t RegisterCtlCenterCallback(int32_t engineId, const sptr callback) { (void)engineId; (void)callback; diff --git a/services/distributedhardwarefwkservice/test/unittest/common/hidumphelper/enabledcompsdump/BUILD.gn b/services/distributedhardwarefwkservice/test/unittest/common/hidumphelper/enabledcompsdump/BUILD.gn index 8f5af6b519ed09bbb3f0e235694eee54339e416f..6fb325dbd365dbbbfbed5aa16f7ee2e82c38577d 100644 --- a/services/distributedhardwarefwkservice/test/unittest/common/hidumphelper/enabledcompsdump/BUILD.gn +++ b/services/distributedhardwarefwkservice/test/unittest/common/hidumphelper/enabledcompsdump/BUILD.gn @@ -49,6 +49,7 @@ ohos_unittest("EnabledCompsDumpTest") { "eventhandler:libeventhandler", "ipc:ipc_core", "safwk:system_ability_fwk", + "hilog:libhilog", ] cflags = [ diff --git a/services/distributedhardwarefwkservice/test/unittest/common/ipc/BUILD.gn b/services/distributedhardwarefwkservice/test/unittest/common/ipc/BUILD.gn index 065abb95447b7d9bde7e488ebf05805db7ed0e03..e0aacd067b0d2d69f2265644326e1524b654b8b4 100644 --- a/services/distributedhardwarefwkservice/test/unittest/common/ipc/BUILD.gn +++ b/services/distributedhardwarefwkservice/test/unittest/common/ipc/BUILD.gn @@ -53,6 +53,7 @@ ohos_unittest("PublisherListenerProxyTest") { external_deps = [ "c_utils:utils", "ipc:ipc_core", + "hilog:libhilog", ] } diff --git a/services/distributedhardwarefwkservice/test/unittest/common/ipc/hardware_status_listener_proxy/BUILD.gn b/services/distributedhardwarefwkservice/test/unittest/common/ipc/hardware_status_listener_proxy/BUILD.gn index c56df9715519b95eebf845486d7e1c07f578fa07..59d1a359c35deddeb8df5a55b50749b65c368b46 100644 --- a/services/distributedhardwarefwkservice/test/unittest/common/ipc/hardware_status_listener_proxy/BUILD.gn +++ b/services/distributedhardwarefwkservice/test/unittest/common/ipc/hardware_status_listener_proxy/BUILD.gn @@ -53,6 +53,7 @@ ohos_unittest("HardwareStatusListenerProxyTest") { external_deps = [ "c_utils:utils", "ipc:ipc_core", + "hilog:libhilog", ] } diff --git a/services/distributedhardwarefwkservice/test/unittest/common/lowlatency/lowlatency/BUILD.gn b/services/distributedhardwarefwkservice/test/unittest/common/lowlatency/lowlatency/BUILD.gn index 133bf69fc3b07b553203ac565b4d45b59b7b64a5..99bdedfa95ec80a4bc3a4ef54e02d9233ccbbe3d 100644 --- a/services/distributedhardwarefwkservice/test/unittest/common/lowlatency/lowlatency/BUILD.gn +++ b/services/distributedhardwarefwkservice/test/unittest/common/lowlatency/lowlatency/BUILD.gn @@ -58,6 +58,7 @@ ohos_unittest("LowLatencyTest") { "eventhandler:libeventhandler", "ipc:ipc_core", "safwk:system_ability_fwk", + "hilog:libhilog", ] } diff --git a/services/distributedhardwarefwkservice/test/unittest/common/lowlatency/lowlatencylistener/BUILD.gn b/services/distributedhardwarefwkservice/test/unittest/common/lowlatency/lowlatencylistener/BUILD.gn index 02da53a7a8d2e342a37d17f89a3d9b44a1ae6b3c..27f054a2f193a7de8a8b174e703fff1ca4dc38c7 100644 --- a/services/distributedhardwarefwkservice/test/unittest/common/lowlatency/lowlatencylistener/BUILD.gn +++ b/services/distributedhardwarefwkservice/test/unittest/common/lowlatency/lowlatencylistener/BUILD.gn @@ -58,6 +58,7 @@ ohos_unittest("LowLatencyListenerTest") { "eventhandler:libeventhandler", "ipc:ipc_core", "safwk:system_ability_fwk", + "hilog:libhilog", ] } diff --git a/services/distributedhardwarefwkservice/test/unittest/common/publisher/BUILD.gn b/services/distributedhardwarefwkservice/test/unittest/common/publisher/BUILD.gn index e34fbdddf06506ed9aa7fd5d73a04b1a50da2c62..c8b9d0edd118ec5dc479009e9c1110c94690bfb8 100644 --- a/services/distributedhardwarefwkservice/test/unittest/common/publisher/BUILD.gn +++ b/services/distributedhardwarefwkservice/test/unittest/common/publisher/BUILD.gn @@ -49,6 +49,7 @@ ohos_unittest("PublisherItemTest") { "ipc:ipc_core", "kv_store:distributeddata_inner", "safwk:system_ability_fwk", + "hilog:libhilog", ] } diff --git a/services/distributedhardwarefwkservice/test/unittest/common/versionmanager/BUILD.gn b/services/distributedhardwarefwkservice/test/unittest/common/versionmanager/BUILD.gn index 7fb04db8527b50f22de425371a1c9f1d7198c00e..2729efb94dfef8a5a58b63c430bd963695eadb84 100644 --- a/services/distributedhardwarefwkservice/test/unittest/common/versionmanager/BUILD.gn +++ b/services/distributedhardwarefwkservice/test/unittest/common/versionmanager/BUILD.gn @@ -55,6 +55,7 @@ ohos_unittest("VersionManagerTest") { "c_utils:utils", "eventhandler:libeventhandler", "kv_store:distributeddata_inner", + "hilog:libhilog", ] defines = [ diff --git a/utils/BUILD.gn b/utils/BUILD.gn index 5064b36087da379c60727dc40ca15d159f2df571..a003f1273f9b2187e11f1ecdfd2830c5380ecc92 100644 --- a/utils/BUILD.gn +++ b/utils/BUILD.gn @@ -32,7 +32,10 @@ ohos_shared_library("distributedhardwareutils") { debug = false } branch_protector_ret = "pac_ret" - public_configs = [ ":utils_external_config" ] + public_configs = [ + ":utils_external_config", + "${innerkits_path}:dhfwk_idl_hardware_config" + ] include_dirs = [ "${common_path}/log/include", diff --git a/utils/test/unittest/common/histreamer_ability_parser/BUILD.gn b/utils/test/unittest/common/histreamer_ability_parser/BUILD.gn index 2f64105f1aeb03702d7fd01a29b122cb91b90fe0..2ff89c73db22b5f69863a238a3810687305228d9 100644 --- a/utils/test/unittest/common/histreamer_ability_parser/BUILD.gn +++ b/utils/test/unittest/common/histreamer_ability_parser/BUILD.gn @@ -38,6 +38,7 @@ ohos_unittest("HistreamerAbilityParserTest") { external_deps = [ "cJSON:cjson", "c_utils:utils", + "hilog:libhilog", ] } diff --git a/utils/test/unittest/common/utilstool/BUILD.gn b/utils/test/unittest/common/utilstool/BUILD.gn index cdbc3907b2fb08c208c919280ca12eeb266d412e..2f816ac25b253c4a1d749d560168ade6139a3a22 100644 --- a/utils/test/unittest/common/utilstool/BUILD.gn +++ b/utils/test/unittest/common/utilstool/BUILD.gn @@ -41,6 +41,7 @@ ohos_unittest("UtilsToolTest") { "cJSON:cjson", "c_utils:utils", "hitrace:hitrace_meter", + "hilog:libhilog", ] }