blob: 17bfe43a865a914959f1aa655a23c9fde80777f8 [file] [log] [blame]
Shunkai Yaodca65ce2022-12-02 05:35:41 +00001/*
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>
Mikhail Naganove7a26ad2023-05-25 17:36:48 -070020#include <aidl/android/media/audio/IHalAdapterVendorExtension.h>
Shunkai Yaodca65ce2022-12-02 05:35:41 +000021#include <media/audiohal/DevicesFactoryHalInterface.h>
22#include <utils/RefBase.h>
23
Shunkai Yaodca65ce2022-12-02 05:35:41 +000024namespace android {
25
26class DevicesFactoryHalAidl : public DevicesFactoryHalInterface
27{
28 public:
Shunkai Yao51202502022-12-12 06:11:46 +000029 explicit DevicesFactoryHalAidl(
Mikhail Naganovf83b9742023-04-24 13:06:04 -070030 std::shared_ptr<::aidl::android::hardware::audio::core::IConfig> config);
31
32 status_t getDeviceNames(std::vector<std::string> *names) override;
Shunkai Yaodca65ce2022-12-02 05:35:41 +000033
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
Shunkai Yaodca65ce2022-12-02 05:35:41 +000038 status_t setCallbackOnce(sp<DevicesFactoryHalCallback> callback) override;
39
40 android::detail::AudioHalVersionInfo getHalVersion() const override;
41
Mikhail Naganovf83b9742023-04-24 13:06:04 -070042 status_t getSurroundSoundConfig(media::SurroundSoundConfig *config) override;
43
44 status_t getEngineConfig(media::audio::common::AudioHalEngineConfig *config) override;
45
Shunkai Yaodca65ce2022-12-02 05:35:41 +000046 private:
Mikhail Naganovf83b9742023-04-24 13:06:04 -070047 const std::shared_ptr<::aidl::android::hardware::audio::core::IConfig> mConfig;
Dan Shi1eaa2242024-02-01 19:32:34 +000048 std::optional<std::shared_ptr<::aidl::android::media::audio::IHalAdapterVendorExtension>>
49 mVendorExt;
50
51 std::shared_ptr<::aidl::android::media::audio::IHalAdapterVendorExtension> getVendorExtension();
Mikhail Naganove7a26ad2023-05-25 17:36:48 -070052
Shunkai Yao51202502022-12-12 06:11:46 +000053 ~DevicesFactoryHalAidl() = default;
Shunkai Yaodca65ce2022-12-02 05:35:41 +000054};
55
56} // namespace android