blob: a215108e95008c61e75031817341a4410a7be7ed [file] [log] [blame]
Eric Laurent27ef4d82016-10-14 15:46:06 -07001/*
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 Naganov10548292016-10-31 10:39:47 -070017#define LOG_TAG "audiohalservice"
Eric Laurent27ef4d82016-10-14 15:46:06 -070018
Martijn Coenen02822372016-12-29 14:03:41 +010019#include <hidl/HidlTransportSupport.h>
Mikhail Naganov10548292016-10-31 10:39:47 -070020#include <hidl/LegacySupport.h>
21#include <android/hardware/audio/2.0/IDevicesFactory.h>
22#include <android/hardware/audio/effect/2.0/IEffectsFactory.h>
Eric Laurent27ef4d82016-10-14 15:46:06 -070023#include <android/hardware/soundtrigger/2.0/ISoundTriggerHw.h>
24
Martijn Coenen02822372016-12-29 14:03:41 +010025using android::hardware::configureRpcThreadpool;
26using android::hardware::joinRpcThreadpool;
27using android::hardware::registerPassthroughServiceImplementation;
28
Mikhail Naganov10548292016-10-31 10:39:47 -070029using android::hardware::audio::effect::V2_0::IEffectsFactory;
30using android::hardware::audio::V2_0::IDevicesFactory;
Eric Laurent27ef4d82016-10-14 15:46:06 -070031using android::hardware::soundtrigger::V2_0::ISoundTriggerHw;
Mikhail Naganov10548292016-10-31 10:39:47 -070032using android::hardware::registerPassthroughServiceImplementation;
Eric Laurent27ef4d82016-10-14 15:46:06 -070033
Mikhail Naganov3c256462017-02-08 16:34:22 -080034using android::OK;
35
Eric Laurent27ef4d82016-10-14 15:46:06 -070036int main(int /* argc */, char* /* argv */ []) {
Martijn Coenen02822372016-12-29 14:03:41 +010037 configureRpcThreadpool(16, true /*callerWillJoin*/);
Mikhail Naganov3c256462017-02-08 16:34:22 -080038 android::status_t status;
Yifan Hong55f72472017-02-16 15:03:53 -080039 status = registerPassthroughServiceImplementation<IDevicesFactory>();
Mikhail Naganov3c256462017-02-08 16:34:22 -080040 LOG_ALWAYS_FATAL_IF(status != OK, "Error while registering audio service: %d", status);
Chris Phoenix549ca2b2017-01-24 13:45:10 -080041 status = registerPassthroughServiceImplementation<IEffectsFactory>();
Mikhail Naganov3c256462017-02-08 16:34:22 -080042 LOG_ALWAYS_FATAL_IF(status != OK, "Error while registering audio effects service: %d", status);
Tomasz Wasilczykf4bae952017-08-07 17:05:14 -070043 // Soundtrigger might be not present.
Mikhail Naganov3acaa662017-04-13 11:00:11 -070044 status = registerPassthroughServiceImplementation<ISoundTriggerHw>();
Mikhail Naganov3c256462017-02-08 16:34:22 -080045 ALOGE_IF(status != OK, "Error while registering soundtrigger service: %d", status);
Martijn Coenen02822372016-12-29 14:03:41 +010046 joinRpcThreadpool();
Mikhail Naganov3c256462017-02-08 16:34:22 -080047 return status;
Eric Laurent27ef4d82016-10-14 15:46:06 -070048}