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
diff --git a/audio/2.0/default/service.cpp b/audio/2.0/default/service.cpp
index 646d898..8b608c8 100644
--- a/audio/2.0/default/service.cpp
+++ b/audio/2.0/default/service.cpp
@@ -33,11 +33,20 @@
 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<IDevicesFactory>("audio_devices_factory");
-    registerPassthroughServiceImplementation<IEffectsFactory>("audio_effects_factory");
-    registerPassthroughServiceImplementation<ISoundTriggerHw>("sound_trigger.primary");
-    registerPassthroughServiceImplementation<IBroadcastRadioFactory>("broadcastradio");
+    android::status_t status;
+    status = registerPassthroughServiceImplementation<IDevicesFactory>("audio_devices_factory");
+    LOG_ALWAYS_FATAL_IF(status != OK, "Error while registering audio service: %d", status);
+    status = registerPassthroughServiceImplementation<IEffectsFactory>("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<ISoundTriggerHw>("sound_trigger.primary");
+    ALOGE_IF(status != OK, "Error while registering soundtrigger service: %d", status);
+    status = registerPassthroughServiceImplementation<IBroadcastRadioFactory>("broadcastradio");
+    ALOGE_IF(status != OK, "Error while registering fm radio service: %d", status);
     joinRpcThreadpool();
+    return status;
 }