• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2025 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 #ifndef LOG_TAG
16 #define LOG_TAG "AudioCollaborativeManager"
17 #endif
18 
19 #include "audio_collaborative_manager.h"
20 
21 #include "iservice_registry.h"
22 #include "system_ability_definition.h"
23 #include "bundle_mgr_interface.h"
24 
25 #include "audio_service_log.h"
26 #include "audio_errors.h"
27 #include "audio_manager_base.h"
28 #include "audio_server_death_recipient.h"
29 #include "audio_policy_manager.h"
30 
31 #include "audio_collaborative_manager.h"
32 
33 namespace OHOS {
34 namespace AudioStandard {
35 
AudioCollaborativeManager()36 AudioCollaborativeManager::AudioCollaborativeManager()
37 {
38     AUDIO_DEBUG_LOG("AudioCollaborativeManager start");
39 }
40 
~AudioCollaborativeManager()41 AudioCollaborativeManager::~AudioCollaborativeManager()
42 {
43     AUDIO_DEBUG_LOG("AudioCollaborativeManager::~AudioCollaborativeManager");
44 }
45 
GetInstance()46 AudioCollaborativeManager *AudioCollaborativeManager::GetInstance()
47 {
48     static AudioCollaborativeManager audioCollaborativeManager;
49     return &audioCollaborativeManager;
50 }
51 
IsCollaborativePlaybackSupported()52 bool AudioCollaborativeManager::IsCollaborativePlaybackSupported()
53 {
54     return AudioPolicyManager::GetInstance().IsCollaborativePlaybackSupported();
55 }
56 
IsCollaborativePlaybackEnabledForDevice(const std::shared_ptr<AudioDeviceDescriptor> & selectedAudioDevice)57 bool AudioCollaborativeManager::IsCollaborativePlaybackEnabledForDevice(
58     const std::shared_ptr<AudioDeviceDescriptor> &selectedAudioDevice)
59 {
60     return AudioPolicyManager::GetInstance().IsCollaborativePlaybackEnabledForDevice(selectedAudioDevice);
61 }
62 
SetCollaborativePlaybackEnabledForDevice(const std::shared_ptr<AudioDeviceDescriptor> & selectedAudioDevice,bool enabled)63 int32_t AudioCollaborativeManager::SetCollaborativePlaybackEnabledForDevice(
64     const std::shared_ptr<AudioDeviceDescriptor> &selectedAudioDevice, bool enabled)
65 {
66     return AudioPolicyManager::GetInstance().SetCollaborativePlaybackEnabledForDevice(
67         selectedAudioDevice, enabled);
68 }
69 } // AudioStandard
70 } // OHOS