From e09f84171d6854174911f25dd92cca86bc817b44 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=86=AF=E4=BF=8A=E6=A1=A6?= Date: Mon, 30 Jun 2025 20:45:32 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E4=B8=BB=E5=B9=B2=E5=91=8A=E8=AD=A6?= =?UTF-8?q?=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 冯俊桦 --- .../audiomanager/managersink/include/daudio_sink_manager.h | 6 +++--- .../managersource/include/daudio_source_manager.h | 2 +- services/audiomanager/servicesink/BUILD.gn | 2 -- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/services/audiomanager/managersink/include/daudio_sink_manager.h b/services/audiomanager/managersink/include/daudio_sink_manager.h index 439b5f0b..c72db946 100644 --- a/services/audiomanager/managersink/include/daudio_sink_manager.h +++ b/services/audiomanager/managersink/include/daudio_sink_manager.h @@ -98,7 +98,7 @@ private: std::string localNetworkId_; ChannelState channelState_ = ChannelState::UNKNOWN; - std::shared_ptr providerListener_; + std::shared_ptr providerListener_ = nullptr; std::shared_ptr ctrlListenerCallback_ = nullptr; std::shared_ptr ctrlListener_ = nullptr; IAVEngineProvider *sendProviderPtr_ = nullptr; @@ -109,8 +109,8 @@ private: bool isSameAccount_ = false; bool isCheckSecLevel_ = false; sptr ipcSinkCallback_ = nullptr; - std::shared_ptr initCallback_; - uint64_t callerTokenId_; + std::shared_ptr initCallback_ = nullptr; + uint64_t callerTokenId_ = 0; }; } // DistributedHardware } // OHOS diff --git a/services/audiomanager/managersource/include/daudio_source_manager.h b/services/audiomanager/managersource/include/daudio_source_manager.h index 53b1d3b9..d4dbda94 100644 --- a/services/audiomanager/managersource/include/daudio_source_manager.h +++ b/services/audiomanager/managersource/include/daudio_source_manager.h @@ -96,7 +96,7 @@ private: void *pSHandler_ = nullptr; void *pRHandler_ = nullptr; std::atomic isHicollieRunning_ = true; - uint64_t callerTokenId_; + uint64_t callerTokenId_ = 0; class SourceManagerHandler : public AppExecFwk::EventHandler { public: diff --git a/services/audiomanager/servicesink/BUILD.gn b/services/audiomanager/servicesink/BUILD.gn index 2b097064..d638cc47 100755 --- a/services/audiomanager/servicesink/BUILD.gn +++ b/services/audiomanager/servicesink/BUILD.gn @@ -101,8 +101,6 @@ ohos_shared_library("distributed_audio_sink") { "hisysevent:libhisysevent", "hitrace:hitrace_meter", "ipc:ipc_core", - "os_account:libaccountkits", - "os_account:os_account_innerkits", "safwk:system_ability_fwk", "samgr:samgr_proxy", ] -- Gitee From 788e3f802213604db00f7d20b6ecba1817412762 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=86=AF=E4=BF=8A=E6=A1=A6?= Date: Tue, 1 Jul 2025 17:22:39 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E7=A9=BA=E5=8F=A3=E6=95=B0=E6=8D=AEfuzz?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 冯俊桦 --- .../native_cpp/test/fuzztest/BUILD.gn | 2 + .../BUILD.gn | 82 +++++++++++++++++++ .../corpus/init | 16 ++++ .../project.xml | 25 ++++++ .../sinkservicedump_fuzzer.cpp | 62 ++++++++++++++ .../sinkservicedump_fuzzer.h | 39 +++++++++ .../BUILD.gn | 82 +++++++++++++++++++ .../corpus/init | 16 ++++ .../project.xml | 25 ++++++ .../sinkservicedump_fuzzer.cpp | 62 ++++++++++++++ .../sinkservicedump_fuzzer.h | 39 +++++++++ 11 files changed, 450 insertions(+) create mode 100644 services/audiotransport/test/fuzztest/sinkctrltransonchannelevent_fuzzer/BUILD.gn create mode 100644 services/audiotransport/test/fuzztest/sinkctrltransonchannelevent_fuzzer/corpus/init create mode 100644 services/audiotransport/test/fuzztest/sinkctrltransonchannelevent_fuzzer/project.xml create mode 100644 services/audiotransport/test/fuzztest/sinkctrltransonchannelevent_fuzzer/sinkservicedump_fuzzer.cpp create mode 100644 services/audiotransport/test/fuzztest/sinkctrltransonchannelevent_fuzzer/sinkservicedump_fuzzer.h create mode 100644 services/audiotransport/test/fuzztest/sourcectrltransonchannelevent_fuzzer/BUILD.gn create mode 100644 services/audiotransport/test/fuzztest/sourcectrltransonchannelevent_fuzzer/corpus/init create mode 100644 services/audiotransport/test/fuzztest/sourcectrltransonchannelevent_fuzzer/project.xml create mode 100644 services/audiotransport/test/fuzztest/sourcectrltransonchannelevent_fuzzer/sinkservicedump_fuzzer.cpp create mode 100644 services/audiotransport/test/fuzztest/sourcectrltransonchannelevent_fuzzer/sinkservicedump_fuzzer.h diff --git a/interfaces/inner_kits/native_cpp/test/fuzztest/BUILD.gn b/interfaces/inner_kits/native_cpp/test/fuzztest/BUILD.gn index fcc2a5f1..23f55ba2 100644 --- a/interfaces/inner_kits/native_cpp/test/fuzztest/BUILD.gn +++ b/interfaces/inner_kits/native_cpp/test/fuzztest/BUILD.gn @@ -37,6 +37,8 @@ group("fuzztest") { "${services_path}/audiomanager/test/fuzztest/sourceserviceunregisterdistributedhardware_fuzzer:fuzztest", "${services_path}/audiomanager/test/fuzztest/sinkservicedump_fuzzer:fuzztest", "${services_path}/common/test/fuzztest/audiodatasetinit64_fuzzer:fuzztest", + "${services_path}/audiotransport/test/fuzztest/sinkctrltransonchannelevent_fuzzer:fuzztest", + "${services_path}/audiotransport/test/fuzztest/sourcectrltransonchannelevent_fuzzer:fuzztest", "onremotesinksvrdied_fuzzer:fuzztest", "onremotesourcesvrdied_fuzzer:fuzztest", "sinkhandlerfinishstartsa_fuzzer:fuzztest", diff --git a/services/audiotransport/test/fuzztest/sinkctrltransonchannelevent_fuzzer/BUILD.gn b/services/audiotransport/test/fuzztest/sinkctrltransonchannelevent_fuzzer/BUILD.gn new file mode 100644 index 00000000..60d4d416 --- /dev/null +++ b/services/audiotransport/test/fuzztest/sinkctrltransonchannelevent_fuzzer/BUILD.gn @@ -0,0 +1,82 @@ +# 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. + +#####################hydra-fuzz################### +import("//build/config/features.gni") +import("//build/test.gni") +import("../../../../../distributedaudio.gni") + +##############################fuzztest########################################## +ohos_fuzztest("SinkCtrlTransOnChannelEventFuzzTest") { + module_out_path = "${distributedaudio_fuzz_path}/sinkctrltransonchannelevent_fuzzer" + fuzz_config_file = + "${services_path}/audiotransport/test/fuzztest/sinkctrltransonchannelevent_fuzzer" + + cflags = [ + "-g", + "-O0", + "-Wno-unused-variable", + "-fno-omit-frame-pointer", + ] + sources = [ "sinkctrltransonchannelevent_fuzzer.cpp" ] + + include_dirs = [ + "include", + "${audio_client_path}/interface", + "${audio_client_path}/micclient/include", + "${audio_client_path}/spkclient/include", + "${audio_control_path}/controlsink/include", + "${audio_processor_path}/interface", + "${audio_transport_path}/interface", + "${audio_transport_path}/audioctrltransport/include", + "${audio_transport_path}/receiverengine/include", + "${audio_transport_path}/senderengine/include", + "${common_path}/dfx_utils/include", + "${common_path}/include", + "${innerkits_path}/native_cpp/audio_sink/include", + "${innerkits_path}/native_cpp/audio_source/include", + "${services_path}/audiomanager/managersink/include", + "${services_path}/common/audioeventcallback", + "${services_path}/common/audiodata/include", + "${services_path}/common/audioparam", + ] + + deps =[ + "${services_path}/audiomanager/servicesink:distributed_audio_sink", + ] + + defines = [ + "HI_LOG_ENABLE", + "DH_LOG_TAG=\"SinkServiceDumpFuzzTest\"", + "LOG_DOMAIN=0xD004130", + ] + + external_deps = [ + "c_utils:utils", + "cJSON:cjson", + "distributed_hardware_fwk:distributed_av_sender", + "distributed_hardware_fwk:distributedhardwareutils", + "ipc:ipc_core", + "safwk:system_ability_fwk", + "samgr:samgr_proxy", + ] + + +} + +############################################################################### +group("fuzztest") { + testonly = true + deps = [ ":SinkCtrlTransOnChannelEventFuzzTest" ] +} +############################################################################### diff --git a/services/audiotransport/test/fuzztest/sinkctrltransonchannelevent_fuzzer/corpus/init b/services/audiotransport/test/fuzztest/sinkctrltransonchannelevent_fuzzer/corpus/init new file mode 100644 index 00000000..8eb5a7d6 --- /dev/null +++ b/services/audiotransport/test/fuzztest/sinkctrltransonchannelevent_fuzzer/corpus/init @@ -0,0 +1,16 @@ +/* + * 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. + */ + +FUZZ \ No newline at end of file diff --git a/services/audiotransport/test/fuzztest/sinkctrltransonchannelevent_fuzzer/project.xml b/services/audiotransport/test/fuzztest/sinkctrltransonchannelevent_fuzzer/project.xml new file mode 100644 index 00000000..6e8ad2cf --- /dev/null +++ b/services/audiotransport/test/fuzztest/sinkctrltransonchannelevent_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 1000 + + 300 + + 4096 + + diff --git a/services/audiotransport/test/fuzztest/sinkctrltransonchannelevent_fuzzer/sinkservicedump_fuzzer.cpp b/services/audiotransport/test/fuzztest/sinkctrltransonchannelevent_fuzzer/sinkservicedump_fuzzer.cpp new file mode 100644 index 00000000..cc472e72 --- /dev/null +++ b/services/audiotransport/test/fuzztest/sinkctrltransonchannelevent_fuzzer/sinkservicedump_fuzzer.cpp @@ -0,0 +1,62 @@ +/* + * 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 + #include + + #include "av_trans_message.h" + #include "av_trans_types.h" + + #include + #include "daudio_sink_ctrl_trans.h" + #include "sinkctrltransonchannelevent.h" + + #include "dlfcn.h" + + #include "daudio_constants.h" + #include "daudio_errorcode.h" + #include "daudio_log.h" + #include "daudio_util.h" + +namespace OHOS { +namespace DistributedHardware { +void SinkCtrlTransOnChannelEventFuzzTest(const uint8_t* data, size_t size) +{ + if (data == nullptr || size == 0) { + return; + } + std::string devId = "devId"; + std::string sessionName = "sessionName"; + std::string peerSessName = "peerSessName"; + auto sinkCtrlTransCb = std::make_shared(); + auto ctrlTrans = DaudioSinkCtrlTrans(devId, sessionName, peerSessName, sinkCtrlTransCb); + FuzzedDataProvider fdp(data, size); + AVTransEvent event; + event.content = fdp.ConsumeRandomLengthString(); + event.peerDevId = fdp.ConsumeRandomLengthString(); + event.type = static_cast(fdp.ConsumeIntegral &message) override + { + (void)message; + } +}; +} +} +#endif \ No newline at end of file diff --git a/services/audiotransport/test/fuzztest/sourcectrltransonchannelevent_fuzzer/BUILD.gn b/services/audiotransport/test/fuzztest/sourcectrltransonchannelevent_fuzzer/BUILD.gn new file mode 100644 index 00000000..e5d21f16 --- /dev/null +++ b/services/audiotransport/test/fuzztest/sourcectrltransonchannelevent_fuzzer/BUILD.gn @@ -0,0 +1,82 @@ +# 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. + +#####################hydra-fuzz################### +import("//build/config/features.gni") +import("//build/test.gni") +import("../../../../../distributedaudio.gni") + +##############################fuzztest########################################## +ohos_fuzztest("SourceCtrlTransOnChannelEventFuzzTest") { + module_out_path = "${distributedaudio_fuzz_path}/sourcectrltransonchannelevent_fuzzer" + fuzz_config_file = + "${services_path}/audiotransport/test/fuzztest/sourcectrltransonchannelevent_fuzzer" + + cflags = [ + "-g", + "-O0", + "-Wno-unused-variable", + "-fno-omit-frame-pointer", + ] + sources = [ "sourcectrltransonchannelevent_fuzzer.cpp" ] + + include_dirs = [ + "include", + "${audio_client_path}/interface", + "${audio_client_path}/micclient/include", + "${audio_client_path}/spkclient/include", + "${audio_control_path}/controlsink/include", + "${audio_processor_path}/interface", + "${audio_transport_path}/interface", + "${audio_transport_path}/audioctrltransport/include", + "${audio_transport_path}/receiverengine/include", + "${audio_transport_path}/senderengine/include", + "${common_path}/dfx_utils/include", + "${common_path}/include", + "${innerkits_path}/native_cpp/audio_sink/include", + "${innerkits_path}/native_cpp/audio_source/include", + "${services_path}/audiomanager/managersink/include", + "${services_path}/common/audioeventcallback", + "${services_path}/common/audiodata/include", + "${services_path}/common/audioparam", + ] + + deps =[ + "${services_path}/audiomanager/servicesink:distributed_audio_sink", + ] + + defines = [ + "HI_LOG_ENABLE", + "DH_LOG_TAG=\"SinkServiceDumpFuzzTest\"", + "LOG_DOMAIN=0xD004130", + ] + + external_deps = [ + "c_utils:utils", + "cJSON:cjson", + "distributed_hardware_fwk:distributed_av_sender", + "distributed_hardware_fwk:distributedhardwareutils", + "ipc:ipc_core", + "safwk:system_ability_fwk", + "samgr:samgr_proxy", + ] + + +} + +############################################################################### +group("fuzztest") { + testonly = true + deps = [ ":SourceCtrlTransOnChannelEventFuzzTest" ] +} +############################################################################### diff --git a/services/audiotransport/test/fuzztest/sourcectrltransonchannelevent_fuzzer/corpus/init b/services/audiotransport/test/fuzztest/sourcectrltransonchannelevent_fuzzer/corpus/init new file mode 100644 index 00000000..8eb5a7d6 --- /dev/null +++ b/services/audiotransport/test/fuzztest/sourcectrltransonchannelevent_fuzzer/corpus/init @@ -0,0 +1,16 @@ +/* + * 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. + */ + +FUZZ \ No newline at end of file diff --git a/services/audiotransport/test/fuzztest/sourcectrltransonchannelevent_fuzzer/project.xml b/services/audiotransport/test/fuzztest/sourcectrltransonchannelevent_fuzzer/project.xml new file mode 100644 index 00000000..6e8ad2cf --- /dev/null +++ b/services/audiotransport/test/fuzztest/sourcectrltransonchannelevent_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 1000 + + 300 + + 4096 + + diff --git a/services/audiotransport/test/fuzztest/sourcectrltransonchannelevent_fuzzer/sinkservicedump_fuzzer.cpp b/services/audiotransport/test/fuzztest/sourcectrltransonchannelevent_fuzzer/sinkservicedump_fuzzer.cpp new file mode 100644 index 00000000..3aa0f656 --- /dev/null +++ b/services/audiotransport/test/fuzztest/sourcectrltransonchannelevent_fuzzer/sinkservicedump_fuzzer.cpp @@ -0,0 +1,62 @@ +/* + * 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 + #include + + #include "av_trans_message.h" + #include "av_trans_types.h" + + #include + #include "daudio_sink_ctrl_trans.h" + #include "sourcectrltransonchannelevent.h" + + #include "dlfcn.h" + + #include "daudio_constants.h" + #include "daudio_errorcode.h" + #include "daudio_log.h" + #include "daudio_util.h" + +namespace OHOS { +namespace DistributedHardware { +void SourceCtrlTransOnChannelEventFuzzTest(const uint8_t* data, size_t size) +{ + if (data == nullptr || size == 0) { + return; + } + std::string devId = "devId"; + std::string sessionName = "sessionName"; + std::string peerSessName = "peerSessName"; + auto sinkCtrlTransCb = std::make_shared(); + auto ctrlTrans = DaudioSourceCtrlTrans(devId, sessionName, peerSessName, sinkCtrlTransCb); + FuzzedDataProvider fdp(data, size); + AVTransEvent event; + event.content = fdp.ConsumeRandomLengthString(); + event.peerDevId = fdp.ConsumeRandomLengthString(); + event.type = static_cast(fdp.ConsumeIntegral &message) override + { + (void)message; + } +}; +} +} +#endif \ No newline at end of file -- Gitee From 40ba8acce6d5373b400d0c99e5abc4a4750b36ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=86=AF=E4=BF=8A=E6=A1=A6?= Date: Tue, 1 Jul 2025 09:48:27 +0000 Subject: [PATCH 3/3] =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=96=87=E4=BB=B6=20serv?= =?UTF-8?q?ices/audiomanager/managersink/include/daudio=5Fsink=5Fmanager.h?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../managersink/include/daudio_sink_manager.h | 117 ------------------ 1 file changed, 117 deletions(-) delete mode 100644 services/audiomanager/managersink/include/daudio_sink_manager.h diff --git a/services/audiomanager/managersink/include/daudio_sink_manager.h b/services/audiomanager/managersink/include/daudio_sink_manager.h deleted file mode 100644 index c72db946..00000000 --- a/services/audiomanager/managersink/include/daudio_sink_manager.h +++ /dev/null @@ -1,117 +0,0 @@ -/* - * Copyright (c) 2024 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_DAUDIO_SINK_MANAGER_H -#define OHOS_DAUDIO_SINK_MANAGER_H - -#include -#include - -#include "single_instance.h" -#include "device_manager.h" -#include "device_manager_callback.h" -#ifdef DEVICE_SECURITY_LEVEL_ENABLE -#include "device_security_defines.h" -#include "device_security_info.h" -#endif - -#include "daudio_ctrl_channel_listener.h" -#include "daudio_sink_dev.h" -#include "idaudio_source.h" -#include "idaudio_sink_ipc_callback.h" -#include "i_av_engine_provider_callback.h" - -namespace OHOS { -namespace DistributedHardware { -class EngineProviderListener : public IAVEngineProviderCallback { -public: - EngineProviderListener() {}; - ~EngineProviderListener() override {}; - - int32_t OnProviderEvent(const AVTransEvent &event) override; -}; - -class CtrlChannelListener : public CtrlChannelListenerCallback { -public: - CtrlChannelListener() {}; - ~CtrlChannelListener() override {}; - - void OnCtrlChannelEvent(const AVTransEvent &event) override; -}; - -class DeviceInitCallback : public DmInitCallback { - void OnRemoteDied() override; -}; - -class DAudioSinkManager { -DECLARE_SINGLE_INSTANCE_BASE(DAudioSinkManager); -public: - int32_t Init(const sptr &sinkCallback); - int32_t UnInit(); - int32_t HandleDAudioNotify(const std::string &devId, const std::string &dhId, const int32_t eventType, - const std::string &eventContent); - int32_t DAudioNotify(const std::string &devId, const std::string &dhId, const int32_t eventType, - const std::string &eventContent); - void OnSinkDevReleased(const std::string &devId); - void NotifyEvent(const std::string &devId, const int32_t eventType, const std::string &eventContent); - void ClearAudioDev(const std::string &devId); - int32_t CreateAudioDevice(const std::string &devId); - void SetChannelState(const std::string &content); - int32_t PauseDistributedHardware(const std::string &networkId); - int32_t ResumeDistributedHardware(const std::string &networkId); - int32_t StopDistributedHardware(const std::string &networkId); - void SetCallerTokenId(uint64_t tokenId); - -private: - DAudioSinkManager(); - ~DAudioSinkManager(); - int32_t LoadAVSenderEngineProvider(); - int32_t UnloadAVSenderEngineProvider(); - int32_t LoadAVReceiverEngineProvider(); - int32_t UnloadAVReceiverEngineProvider(); - bool CheckDeviceSecurityLevel(const std::string &srcDeviceId, const std::string &dstDeviceId); - int32_t GetDeviceSecurityLevel(const std::string &udid); - std::string GetUdidByNetworkId(const std::string &networkId); - int32_t VerifySecurityLevel(const std::string &devId); - int32_t InitAudioDevice(std::shared_ptr dev, const std::string &devId, bool isSpkOrMic); - -private: - static constexpr const char* DEVCLEAR_THREAD = "sinkClearTh"; - std::mutex devMapMutex_; - std::unordered_map> audioDevMap_; - std::mutex remoteSvrMutex_; - std::mutex ipcCallbackMutex_; - std::map> sourceServiceMap_; - std::thread devClearThread_; - std::string localNetworkId_; - ChannelState channelState_ = ChannelState::UNKNOWN; - - std::shared_ptr providerListener_ = nullptr; - std::shared_ptr ctrlListenerCallback_ = nullptr; - std::shared_ptr ctrlListener_ = nullptr; - IAVEngineProvider *sendProviderPtr_ = nullptr; - IAVEngineProvider *rcvProviderPtr_ = nullptr; - void *pSHandler_ = nullptr; - void *pRHandler_ = nullptr; - bool isSensitive_ = false; - bool isSameAccount_ = false; - bool isCheckSecLevel_ = false; - sptr ipcSinkCallback_ = nullptr; - std::shared_ptr initCallback_ = nullptr; - uint64_t callerTokenId_ = 0; -}; -} // DistributedHardware -} // OHOS -#endif // OHOS_DAUDIO_SINK_MANAGER_H -- Gitee