xref: /aosp_15_r20/frameworks/av/media/libaudiohal/impl/DevicesFactoryHalAidl.h (revision ec779b8e0859a360c3d303172224686826e6e0e1)
1 /*
2  * Copyright (C) 2022 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #pragma once
18 
19 #include <aidl/android/hardware/audio/core/IConfig.h>
20 #include <aidl/android/media/audio/IHalAdapterVendorExtension.h>
21 #include <media/audiohal/DevicesFactoryHalInterface.h>
22 #include <utils/RefBase.h>
23 
24 namespace android {
25 
26 class DevicesFactoryHalAidl : public DevicesFactoryHalInterface
27 {
28   public:
29     explicit DevicesFactoryHalAidl(
30             std::shared_ptr<::aidl::android::hardware::audio::core::IConfig> config);
31 
32     status_t getDeviceNames(std::vector<std::string> *names) override;
33 
34     // Opens a device with the specified name. To close the device, it is
35     // necessary to release references to the returned object.
36     status_t openDevice(const char *name, sp<DeviceHalInterface> *device) override;
37 
38     status_t setCallbackOnce(sp<DevicesFactoryHalCallback> callback) override;
39 
40     android::detail::AudioHalVersionInfo getHalVersion() const override;
41 
42     status_t getSurroundSoundConfig(media::SurroundSoundConfig *config) override;
43 
44     status_t getEngineConfig(media::audio::common::AudioHalEngineConfig *config) override;
45 
46   private:
47     const std::shared_ptr<::aidl::android::hardware::audio::core::IConfig> mConfig;
48     const std::shared_ptr<::aidl::android::media::audio::IHalAdapterVendorExtension> mVendorExt;
49 
50     ~DevicesFactoryHalAidl() = default;
51 };
52 
53 } // namespace android
54