From 3c25646562abf65505eb32a03d1dd1cfca502644 Mon Sep 17 00:00:00 2001 From: Mikhail Naganov Date: Wed, 8 Feb 2017 16:34:22 -0800 Subject: [PATCH] audio: Check status of registerPassthroughServiceImplementation Make sure the server aborts if it can't register the main audio service and the effects service. Soundtrigger and FM radio are optional, thus their failure to register is only logged. Bug: 34634573 Change-Id: If96e3238fe4d986e91581cc1ea0d9b36c24a8b9c Test: restart audio service --- audio/2.0/default/service.cpp | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/audio/2.0/default/service.cpp b/audio/2.0/default/service.cpp index 646d8980..8b608c80 100644 --- a/audio/2.0/default/service.cpp +++ b/audio/2.0/default/service.cpp @@ -33,11 +33,20 @@ using android::hardware::soundtrigger::V2_0::ISoundTriggerHw; using android::hardware::registerPassthroughServiceImplementation; using android::hardware::broadcastradio::V1_0::IBroadcastRadioFactory; +using android::OK; + int main(int /* argc */, char* /* argv */ []) { configureRpcThreadpool(16, true /*callerWillJoin*/); - registerPassthroughServiceImplementation("audio_devices_factory"); - registerPassthroughServiceImplementation("audio_effects_factory"); - registerPassthroughServiceImplementation("sound_trigger.primary"); - registerPassthroughServiceImplementation("broadcastradio"); + android::status_t status; + status = registerPassthroughServiceImplementation("audio_devices_factory"); + LOG_ALWAYS_FATAL_IF(status != OK, "Error while registering audio service: %d", status); + status = registerPassthroughServiceImplementation("audio_effects_factory"); + LOG_ALWAYS_FATAL_IF(status != OK, "Error while registering audio effects service: %d", status); + // Soundtrigger and FM radio might be not present. + status = registerPassthroughServiceImplementation("sound_trigger.primary"); + ALOGE_IF(status != OK, "Error while registering soundtrigger service: %d", status); + status = registerPassthroughServiceImplementation("broadcastradio"); + ALOGE_IF(status != OK, "Error while registering fm radio service: %d", status); joinRpcThreadpool(); + return status; } -- 2.11.0