blob: f6e43535984293e06333193c6f1140bdb62c2fed [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
Mikhail Naganov10548292016-10-31 10:39:47 -070019#include <android/hardware/audio/2.0/IDevicesFactory.h>
Kevin Rocardbee7f4e2018-03-01 18:56:58 -080020#include <android/hardware/audio/4.0/IDevicesFactory.h>
Mikhail Naganov10548292016-10-31 10:39:47 -070021#include <android/hardware/audio/effect/2.0/IEffectsFactory.h>
Kevin Rocardbee7f4e2018-03-01 18:56:58 -080022#include <android/hardware/audio/effect/4.0/IEffectsFactory.h>
Mikhail Naganovce8d65b2018-01-22 13:25:09 -080023#include <android/hardware/soundtrigger/2.0/ISoundTriggerHw.h>
Mikhail Naganov5697a9b2017-12-28 13:29:59 -080024#include <android/hardware/soundtrigger/2.1/ISoundTriggerHw.h>
Haynes Mathew Georgea57f41d2018-02-21 14:45:20 -080025#include <binder/ProcessState.h>
Mikhail Naganov5697a9b2017-12-28 13:29:59 -080026#include <hidl/HidlTransportSupport.h>
27#include <hidl/LegacySupport.h>
Eric Laurent27ef4d82016-10-14 15:46:06 -070028
Kevin Rocardbee7f4e2018-03-01 18:56:58 -080029using namespace android::hardware;
Mikhail Naganov3c256462017-02-08 16:34:22 -080030using android::OK;
31
Eric Laurent27ef4d82016-10-14 15:46:06 -070032int main(int /* argc */, char* /* argv */ []) {
Haynes Mathew Georgea57f41d2018-02-21 14:45:20 -080033 android::ProcessState::initWithDriver("/dev/vndbinder");
34 // start a threadpool for vndbinder interactions
35 android::ProcessState::self()->startThreadPool();
Martijn Coenen02822372016-12-29 14:03:41 +010036 configureRpcThreadpool(16, true /*callerWillJoin*/);
Kevin Rocardbee7f4e2018-03-01 18:56:58 -080037
38 bool fail = registerPassthroughServiceImplementation<audio::V4_0::IDevicesFactory>() != OK &&
39 registerPassthroughServiceImplementation<audio::V2_0::IDevicesFactory>() != OK;
40 LOG_ALWAYS_FATAL_IF(fail, "Could not register audio core API 2.0 nor 4.0");
41
42 fail = registerPassthroughServiceImplementation<audio::effect::V4_0::IEffectsFactory>() != OK &&
43 registerPassthroughServiceImplementation<audio::effect::V2_0::IEffectsFactory>() != OK,
44 LOG_ALWAYS_FATAL_IF(fail, "Could not register audio effect API 2.0 nor 4.0");
45
46 fail = registerPassthroughServiceImplementation<soundtrigger::V2_1::ISoundTriggerHw>() != OK &&
47 registerPassthroughServiceImplementation<soundtrigger::V2_0::ISoundTriggerHw>() != OK,
48 ALOGW_IF(fail, "Could not register soundtrigger API 2.0 nor 2.1");
49
Martijn Coenen02822372016-12-29 14:03:41 +010050 joinRpcThreadpool();
Eric Laurent27ef4d82016-10-14 15:46:06 -070051}