mirror of
https://github.com/Evolution-X/hardware_interfaces
synced 2026-02-01 05:49:27 +00:00
Merge "Audio service: Refactor register interface"
This commit is contained in:
committed by
Android (Google) Code Review
commit
7148d172cb
@@ -36,6 +36,15 @@
|
||||
using namespace android::hardware;
|
||||
using android::OK;
|
||||
|
||||
/** Try to register the provided factories in the provided order.
|
||||
* If any registers successfully, do not register any other and return true.
|
||||
* If all fail, return false.
|
||||
*/
|
||||
template <class... Factories>
|
||||
bool registerPassthroughServiceImplementations() {
|
||||
return ((registerPassthroughServiceImplementation<Factories>() != OK) && ...);
|
||||
}
|
||||
|
||||
int main(int /* argc */, char* /* argv */ []) {
|
||||
::android::ProcessState::initWithDriver("/dev/vndbinder");
|
||||
// start a threadpool for vndbinder interactions
|
||||
@@ -50,30 +59,30 @@ int main(int /* argc */, char* /* argv */ []) {
|
||||
}
|
||||
configureRpcThreadpool(16, true /*callerWillJoin*/);
|
||||
|
||||
bool fail = registerPassthroughServiceImplementation<audio::V5_0::IDevicesFactory>() != OK &&
|
||||
registerPassthroughServiceImplementation<audio::V4_0::IDevicesFactory>() != OK &&
|
||||
registerPassthroughServiceImplementation<audio::V2_0::IDevicesFactory>() != OK;
|
||||
LOG_ALWAYS_FATAL_IF(fail, "Could not register audio core API 2, 4 nor 5");
|
||||
LOG_ALWAYS_FATAL_IF((registerPassthroughServiceImplementations<audio::V5_0::IDevicesFactory,
|
||||
audio::V4_0::IDevicesFactory,
|
||||
audio::V2_0::IDevicesFactory>()),
|
||||
"Could not register audio core API");
|
||||
|
||||
fail = registerPassthroughServiceImplementation<audio::effect::V5_0::IEffectsFactory>() != OK &&
|
||||
registerPassthroughServiceImplementation<audio::effect::V4_0::IEffectsFactory>() != OK &&
|
||||
registerPassthroughServiceImplementation<audio::effect::V2_0::IEffectsFactory>() != OK,
|
||||
LOG_ALWAYS_FATAL_IF(fail, "Could not register audio effect API 2, 4 nor 5");
|
||||
LOG_ALWAYS_FATAL_IF(
|
||||
(registerPassthroughServiceImplementations<audio::effect::V5_0::IEffectsFactory,
|
||||
audio::effect::V4_0::IEffectsFactory,
|
||||
audio::effect::V2_0::IEffectsFactory>()),
|
||||
"Could not register audio effect API");
|
||||
|
||||
fail = registerPassthroughServiceImplementation<soundtrigger::V2_2::ISoundTriggerHw>() != OK &&
|
||||
registerPassthroughServiceImplementation<soundtrigger::V2_1::ISoundTriggerHw>() != OK &&
|
||||
registerPassthroughServiceImplementation<soundtrigger::V2_0::ISoundTriggerHw>() != OK,
|
||||
ALOGW_IF(fail, "Could not register soundtrigger API 2.0, 2.1 nor 2.2");
|
||||
ALOGW_IF((registerPassthroughServiceImplementations<soundtrigger::V2_2::ISoundTriggerHw,
|
||||
soundtrigger::V2_1::ISoundTriggerHw,
|
||||
soundtrigger::V2_0::ISoundTriggerHw>()),
|
||||
"Could not register soundtrigger API");
|
||||
|
||||
fail = registerPassthroughServiceImplementation<
|
||||
bluetooth::audio::V2_0::IBluetoothAudioProvidersFactory>() != OK;
|
||||
ALOGW_IF(fail, "Could not register Bluetooth Audio API 2.0");
|
||||
ALOGW_IF(registerPassthroughServiceImplementations<
|
||||
bluetooth::audio::V2_0::IBluetoothAudioProvidersFactory>(),
|
||||
"Could not register Bluetooth audio API");
|
||||
|
||||
// remove the old HIDL when Bluetooth Audio Hal V2 has offloading supported
|
||||
fail =
|
||||
registerPassthroughServiceImplementation<bluetooth::a2dp::V1_0::IBluetoothAudioOffload>() !=
|
||||
OK;
|
||||
ALOGW_IF(fail, "Could not register Bluetooth audio offload 1.0");
|
||||
ALOGW_IF(registerPassthroughServiceImplementations<
|
||||
bluetooth::a2dp::V1_0::IBluetoothAudioOffload>(),
|
||||
"Could not register Bluetooth audio offload API");
|
||||
|
||||
joinRpcThreadpool();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user