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 | |
Martijn Coenen | 0282237 | 2016-12-29 14:03:41 +0100 | [diff] [blame] | 19 | #include <hidl/HidlTransportSupport.h> |
Mikhail Naganov | 1054829 | 2016-10-31 10:39:47 -0700 | [diff] [blame] | 20 | #include <hidl/LegacySupport.h> |
| 21 | #include <android/hardware/audio/2.0/IDevicesFactory.h> |
| 22 | #include <android/hardware/audio/effect/2.0/IEffectsFactory.h> |
Eric Laurent | 27ef4d8 | 2016-10-14 15:46:06 -0700 | [diff] [blame] | 23 | #include <android/hardware/soundtrigger/2.0/ISoundTriggerHw.h> |
Eric Laurent | a174588 | 2016-11-21 10:41:22 -0800 | [diff] [blame] | 24 | #include <android/hardware/broadcastradio/1.0/IBroadcastRadioFactory.h> |
Eric Laurent | 27ef4d8 | 2016-10-14 15:46:06 -0700 | [diff] [blame] | 25 | |
Martijn Coenen | 0282237 | 2016-12-29 14:03:41 +0100 | [diff] [blame] | 26 | using android::hardware::configureRpcThreadpool; |
| 27 | using android::hardware::joinRpcThreadpool; |
| 28 | using android::hardware::registerPassthroughServiceImplementation; |
| 29 | |
Mikhail Naganov | 1054829 | 2016-10-31 10:39:47 -0700 | [diff] [blame] | 30 | using android::hardware::audio::effect::V2_0::IEffectsFactory; |
| 31 | using android::hardware::audio::V2_0::IDevicesFactory; |
Eric Laurent | 27ef4d8 | 2016-10-14 15:46:06 -0700 | [diff] [blame] | 32 | using android::hardware::soundtrigger::V2_0::ISoundTriggerHw; |
Mikhail Naganov | 1054829 | 2016-10-31 10:39:47 -0700 | [diff] [blame] | 33 | using android::hardware::registerPassthroughServiceImplementation; |
Eric Laurent | a174588 | 2016-11-21 10:41:22 -0800 | [diff] [blame] | 34 | using android::hardware::broadcastradio::V1_0::IBroadcastRadioFactory; |
Eric Laurent | 27ef4d8 | 2016-10-14 15:46:06 -0700 | [diff] [blame] | 35 | |
Mikhail Naganov | 3c25646 | 2017-02-08 16:34:22 -0800 | [diff] [blame] | 36 | using android::OK; |
| 37 | |
Eric Laurent | 27ef4d8 | 2016-10-14 15:46:06 -0700 | [diff] [blame] | 38 | int main(int /* argc */, char* /* argv */ []) { |
Martijn Coenen | 0282237 | 2016-12-29 14:03:41 +0100 | [diff] [blame] | 39 | configureRpcThreadpool(16, true /*callerWillJoin*/); |
Mikhail Naganov | 3c25646 | 2017-02-08 16:34:22 -0800 | [diff] [blame] | 40 | android::status_t status; |
| 41 | status = registerPassthroughServiceImplementation<IDevicesFactory>("audio_devices_factory"); |
| 42 | LOG_ALWAYS_FATAL_IF(status != OK, "Error while registering audio service: %d", status); |
| 43 | status = registerPassthroughServiceImplementation<IEffectsFactory>("audio_effects_factory"); |
| 44 | LOG_ALWAYS_FATAL_IF(status != OK, "Error while registering audio effects service: %d", status); |
| 45 | // Soundtrigger and FM radio might be not present. |
| 46 | status = registerPassthroughServiceImplementation<ISoundTriggerHw>("sound_trigger.primary"); |
| 47 | ALOGE_IF(status != OK, "Error while registering soundtrigger service: %d", status); |
| 48 | status = registerPassthroughServiceImplementation<IBroadcastRadioFactory>("broadcastradio"); |
| 49 | ALOGE_IF(status != OK, "Error while registering fm radio service: %d", status); |
Martijn Coenen | 0282237 | 2016-12-29 14:03:41 +0100 | [diff] [blame] | 50 | joinRpcThreadpool(); |
Mikhail Naganov | 3c25646 | 2017-02-08 16:34:22 -0800 | [diff] [blame] | 51 | return status; |
Eric Laurent | 27ef4d8 | 2016-10-14 15:46:06 -0700 | [diff] [blame] | 52 | } |