CSD: fix crash when HAL returns null sound dose itf
This is allowed as defined in the HAL documentation. Adding extra check
when retrieving the sound dose interface.
Test: trivial fix
Bug: 308045706
Change-Id: I0b5611fd3df39b4230dde3bf31596b96e944b571
diff --git a/media/libaudiohal/impl/DeviceHalAidl.cpp b/media/libaudiohal/impl/DeviceHalAidl.cpp
index 72fe32b..31572f7 100644
--- a/media/libaudiohal/impl/DeviceHalAidl.cpp
+++ b/media/libaudiohal/impl/DeviceHalAidl.cpp
@@ -1033,6 +1033,14 @@
return BAD_VALUE;
}
}
+
+ if (mSoundDose == nullptr) {
+ ALOGE("%s failed to return the sound dose interface for module %s: not implemented",
+ __func__,
+ module.c_str());
+ return NO_INIT;
+ }
+
*soundDoseBinder = mSoundDose->asBinder();
ALOGI("%s using audio AIDL HAL sound dose interface", __func__);