OSDN Git Service

audiohal: Exit instead of crashing when HAL factory can't be obtained
authorMikhail Naganov <mnaganov@google.com>
Mon, 20 Mar 2017 17:58:07 +0000 (10:58 -0700)
committerMikhail Naganov <mnaganov@google.com>
Mon, 20 Mar 2017 18:00:54 +0000 (11:00 -0700)
Replace LOG_ALWAYS_FATAL with ALOGE + exit, so the process still
restarts, but without a crash. This avoids confusion in bug triaging
and also helps to eliminate noise in bug reports statistics.

Bug: 36424777
Change-Id: I623cbc6a5b0d3351f849810dd67708d421efd61a
Test: reproduced error condition, checked that audio server restarts

media/libaudiohal/DevicesFactoryHalHidl.cpp
media/libaudiohal/EffectsFactoryHalHidl.cpp

index 758a580..fc2645e 100644 (file)
@@ -45,7 +45,8 @@ DevicesFactoryHalHidl::DevicesFactoryHalHidl() {
         // and thus have the same lifespan.
         mDevicesFactory->linkToDeath(HalDeathHandler::getInstance(), 0 /*cookie*/);
     } else {
-        LOG_ALWAYS_FATAL("Failed to obtain IDevicesFactory service");
+        ALOGE("Failed to obtain IDevicesFactory service, terminating process.");
+        exit(1);
     }
 }
 
index f7dbb9c..605c059 100644 (file)
@@ -44,7 +44,10 @@ bool EffectsFactoryHalInterface::isNullUuid(const effect_uuid_t *pEffectUuid) {
 
 EffectsFactoryHalHidl::EffectsFactoryHalHidl() : ConversionHelperHidl("EffectsFactory") {
     mEffectsFactory = IEffectsFactory::getService();
-    LOG_ALWAYS_FATAL_IF(mEffectsFactory == 0, "Failed to obtain IEffectsFactory service");
+    if (mEffectsFactory == 0) {
+        ALOGE("Failed to obtain IEffectsFactory service, terminating process.");
+        exit(1);
+    }
 }
 
 EffectsFactoryHalHidl::~EffectsFactoryHalHidl() {