hal: send device connect, disconnect events to sound trigger hal
Relay the device connect/disconnect events to sound trigger hal
in order to support voice activation using mic devices other
than handset mic.
Change-Id: Id4b186269f6f39ebbba605f4819965365b33b7e7
diff --git a/hal/audio_extn/soundtrigger.c b/hal/audio_extn/soundtrigger.c
index 70f6d06..aff7532 100644
--- a/hal/audio_extn/soundtrigger.c
+++ b/hal/audio_extn/soundtrigger.c
@@ -349,6 +349,18 @@
event.u.value = val;
st_dev->st_callback(AUDIO_EVENT_NUM_ST_SESSIONS, &event);
}
+
+ ret = str_parms_get_int(params, AUDIO_PARAMETER_DEVICE_CONNECT, &val);
+ if ((ret >= 0) && audio_is_input_device(val)) {
+ event.u.value = val;
+ st_dev->st_callback(AUDIO_EVENT_DEVICE_CONNECT, &event);
+ }
+
+ ret = str_parms_get_int(params, AUDIO_PARAMETER_DEVICE_DISCONNECT, &val);
+ if ((ret >= 0) && audio_is_input_device(val)) {
+ event.u.value = val;
+ st_dev->st_callback(AUDIO_EVENT_DEVICE_DISCONNECT, &event);
+ }
}
int audio_extn_sound_trigger_init(struct audio_device *adev)