blob: 221584cecce55ff082254687ff66d86194e1ad60 [file] [log] [blame]
Mikhail Naganov6b111f32017-04-27 18:52:37 -07001/*
2 * Copyright (C) 2017 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#ifndef ANDROID_HARDWARE_DEVICES_FACTORY_HAL_HYBRID_H
18#define ANDROID_HARDWARE_DEVICES_FACTORY_HAL_HYBRID_H
19
Kevin Rocardb9448c72019-06-25 16:08:29 -070020#include PATH(android/hardware/audio/FILE_VERSION/IDevicesFactory.h)
Mikhail Naganov6b111f32017-04-27 18:52:37 -070021#include <media/audiohal/DevicesFactoryHalInterface.h>
22#include <utils/Errors.h>
23#include <utils/RefBase.h>
24
Kevin Rocardb9448c72019-06-25 16:08:29 -070025using ::android::hardware::audio::CPP_VERSION::IDevicesFactory;
26
Mikhail Naganov6b111f32017-04-27 18:52:37 -070027namespace android {
28
29class DevicesFactoryHalHybrid : public DevicesFactoryHalInterface
30{
31 public:
Kevin Rocardb9448c72019-06-25 16:08:29 -070032 DevicesFactoryHalHybrid(sp<IDevicesFactory> hidlFactory);
Kevin Rocarddf9b4202018-05-10 19:56:08 -070033
Mikhail Naganov6b111f32017-04-27 18:52:37 -070034 // Opens a device with the specified name. To close the device, it is
35 // necessary to release references to the returned object.
36 virtual status_t openDevice(const char *name, sp<DeviceHalInterface> *device);
37
Eric Laurent42896a02019-09-27 15:40:33 -070038 status_t getHalPids(std::vector<pid_t> *pids) override;
39
Mikhail Naganov88de22f2020-03-06 10:55:34 -080040 status_t setCallbackOnce(sp<DevicesFactoryHalCallback> callback) override;
41
Jiabin Huangebe64102021-09-07 20:01:07 +000042 float getHalVersion() const override {
43 return MAJOR_VERSION + (float)MINOR_VERSION / 10;
44 }
45
Mikhail Naganov6b111f32017-04-27 18:52:37 -070046 private:
Mikhail Naganov6b111f32017-04-27 18:52:37 -070047 sp<DevicesFactoryHalInterface> mLocalFactory;
48 sp<DevicesFactoryHalInterface> mHidlFactory;
49};
50
Mikhail Naganov6b111f32017-04-27 18:52:37 -070051} // namespace android
52
53#endif // ANDROID_HARDWARE_DEVICES_FACTORY_HAL_HYBRID_H