audio: Guard WB_AMR callback
Some devices do not support this; some devices are WiFi only
and obviously do not have it.
Change-Id: I6d245eee447bd87849cbdfd41c0cf73c6af714e6
diff --git a/audio/voice.c b/audio/voice.c
index 8d73fd1..3ac1e01 100644
--- a/audio/voice.c
+++ b/audio/voice.c
@@ -401,17 +401,21 @@
session->wb_amr = true;
ALOGV("%s: Forcing voice config: %s", __func__, voice_config);
} else {
- /* register callback for wideband AMR setting */
- ret = ril_set_wb_amr_callback(&session->ril,
- voice_session_wb_amr_callback,
- (void *)adev);
- if (ret != 0) {
- ALOGE("%s: Failed to register WB_AMR callback", __func__);
- free(session);
- return NULL;
- }
+ if (RIL_UNSOL_SNDMGR_WB_AMR_REPORT > 0) {
+ /* register callback for wideband AMR setting */
+ ret = ril_set_wb_amr_callback(&session->ril,
+ voice_session_wb_amr_callback,
+ (void *)adev);
+ if (ret != 0) {
+ ALOGE("%s: Failed to register WB_AMR callback", __func__);
+ free(session);
+ return NULL;
+ }
- ALOGV("%s: Registered WB_AMR callback", __func__);
+ ALOGV("%s: Registered WB_AMR callback", __func__);
+ } else {
+ ALOGV("%s: WB_AMR callback not supported", __func__);
+ }
}
return session;