Eric Laurent | 27ef4d8 | 2016-10-14 15:46:06 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2016 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 | |
Mikhail Naganov | 1054829 | 2016-10-31 10:39:47 -0700 | [diff] [blame] | 17 | #define LOG_TAG "audiohalservice" |
Eric Laurent | 27ef4d8 | 2016-10-14 15:46:06 -0700 | [diff] [blame] | 18 | |
Mikhail Naganov | 1054829 | 2016-10-31 10:39:47 -0700 | [diff] [blame] | 19 | #include <android/hardware/audio/2.0/IDevicesFactory.h> |
Kevin Rocard | bee7f4e | 2018-03-01 18:56:58 -0800 | [diff] [blame] | 20 | #include <android/hardware/audio/4.0/IDevicesFactory.h> |
Mikhail Naganov | 1054829 | 2016-10-31 10:39:47 -0700 | [diff] [blame] | 21 | #include <android/hardware/audio/effect/2.0/IEffectsFactory.h> |
Kevin Rocard | bee7f4e | 2018-03-01 18:56:58 -0800 | [diff] [blame] | 22 | #include <android/hardware/audio/effect/4.0/IEffectsFactory.h> |
Aniket Kumar Lata | d93a3ad | 2018-01-31 20:17:30 -0800 | [diff] [blame] | 23 | #include <android/hardware/bluetooth/a2dp/1.0/IBluetoothAudioOffload.h> |
Cheney Ni | 4f6882f | 2018-11-27 16:23:27 +0800 | [diff] [blame] | 24 | #include <android/hardware/bluetooth/audio/2.0/IBluetoothAudioProvidersFactory.h> |
Mikhail Naganov | ce8d65b | 2018-01-22 13:25:09 -0800 | [diff] [blame] | 25 | #include <android/hardware/soundtrigger/2.0/ISoundTriggerHw.h> |
Mikhail Naganov | 5697a9b | 2017-12-28 13:29:59 -0800 | [diff] [blame] | 26 | #include <android/hardware/soundtrigger/2.1/ISoundTriggerHw.h> |
Haynes Mathew George | a57f41d | 2018-02-21 14:45:20 -0800 | [diff] [blame] | 27 | #include <binder/ProcessState.h> |
Mikhail Naganov | 5697a9b | 2017-12-28 13:29:59 -0800 | [diff] [blame] | 28 | #include <hidl/HidlTransportSupport.h> |
| 29 | #include <hidl/LegacySupport.h> |
Eric Laurent | 27ef4d8 | 2016-10-14 15:46:06 -0700 | [diff] [blame] | 30 | |
Kevin Rocard | bee7f4e | 2018-03-01 18:56:58 -0800 | [diff] [blame] | 31 | using namespace android::hardware; |
Mikhail Naganov | 3c25646 | 2017-02-08 16:34:22 -0800 | [diff] [blame] | 32 | using android::OK; |
| 33 | |
Eric Laurent | 27ef4d8 | 2016-10-14 15:46:06 -0700 | [diff] [blame] | 34 | int main(int /* argc */, char* /* argv */ []) { |
Haynes Mathew George | a57f41d | 2018-02-21 14:45:20 -0800 | [diff] [blame] | 35 | android::ProcessState::initWithDriver("/dev/vndbinder"); |
| 36 | // start a threadpool for vndbinder interactions |
| 37 | android::ProcessState::self()->startThreadPool(); |
Martijn Coenen | 0282237 | 2016-12-29 14:03:41 +0100 | [diff] [blame] | 38 | configureRpcThreadpool(16, true /*callerWillJoin*/); |
Kevin Rocard | bee7f4e | 2018-03-01 18:56:58 -0800 | [diff] [blame] | 39 | |
| 40 | bool fail = registerPassthroughServiceImplementation<audio::V4_0::IDevicesFactory>() != OK && |
| 41 | registerPassthroughServiceImplementation<audio::V2_0::IDevicesFactory>() != OK; |
| 42 | LOG_ALWAYS_FATAL_IF(fail, "Could not register audio core API 2.0 nor 4.0"); |
| 43 | |
| 44 | fail = registerPassthroughServiceImplementation<audio::effect::V4_0::IEffectsFactory>() != OK && |
| 45 | registerPassthroughServiceImplementation<audio::effect::V2_0::IEffectsFactory>() != OK, |
| 46 | LOG_ALWAYS_FATAL_IF(fail, "Could not register audio effect API 2.0 nor 4.0"); |
| 47 | |
| 48 | fail = registerPassthroughServiceImplementation<soundtrigger::V2_1::ISoundTriggerHw>() != OK && |
| 49 | registerPassthroughServiceImplementation<soundtrigger::V2_0::ISoundTriggerHw>() != OK, |
| 50 | ALOGW_IF(fail, "Could not register soundtrigger API 2.0 nor 2.1"); |
| 51 | |
Cheney Ni | 4f6882f | 2018-11-27 16:23:27 +0800 | [diff] [blame] | 52 | fail = registerPassthroughServiceImplementation< |
| 53 | bluetooth::audio::V2_0::IBluetoothAudioProvidersFactory>() != OK; |
| 54 | ALOGW_IF(fail, "Could not register Bluetooth Audio API 2.0"); |
| 55 | |
| 56 | // remove the old HIDL when Bluetooth Audio Hal V2 has offloading supported |
Aniket Kumar Lata | d93a3ad | 2018-01-31 20:17:30 -0800 | [diff] [blame] | 57 | fail = |
| 58 | registerPassthroughServiceImplementation<bluetooth::a2dp::V1_0::IBluetoothAudioOffload>() != |
| 59 | OK; |
| 60 | ALOGW_IF(fail, "Could not register Bluetooth audio offload 1.0"); |
| 61 | |
Martijn Coenen | 0282237 | 2016-12-29 14:03:41 +0100 | [diff] [blame] | 62 | joinRpcThreadpool(); |
Eric Laurent | 27ef4d8 | 2016-10-14 15:46:06 -0700 | [diff] [blame] | 63 | } |