Merge "context_hub: Fix version defines" into nyc-dev
diff --git a/include/hardware/sound_trigger.h b/include/hardware/sound_trigger.h
index 2a8db87..bfded85 100644
--- a/include/hardware/sound_trigger.h
+++ b/include/hardware/sound_trigger.h
@@ -106,7 +106,12 @@
* The implementation does not have to call the callback when stopped via this method.
*/
int (*stop_recognition)(const struct sound_trigger_hw_device *dev,
- sound_model_handle_t sound_model_handle);
+ sound_model_handle_t sound_model_handle);
+
+ /* Stop recognition on all models.
+ * If no implementation is provided, stop_recognition will be called for each running model.
+ */
+ int (*stop_all_recognitions)(const struct sound_trigger_hw_device* dev);
};
typedef struct sound_trigger_hw_device sound_trigger_hw_device_t;
diff --git a/include/hardware/vehicle.h b/include/hardware/vehicle.h
index 9086d1c..ae3a59b 100644
--- a/include/hardware/vehicle.h
+++ b/include/hardware/vehicle.h
@@ -434,7 +434,7 @@
* VEHICLE_AUDIO_EXT_FOCUS_CAR_PLAY_ONLY_FLAG can be used.
* This is for case like radio where android side app still needs to hold focus
* but playback is done outside Android.
- * int32_array[3]: Currently active audio contexts in android side. Use combination of flags from
+ * int32_array[3]: Currently active audio contexts. Use combination of flags from
* vehicle_audio_context_flag.
* This can be used as a hint to adjust audio policy or other policy decision.
* Note that there can be multiple context active at the same time. And android
@@ -723,14 +723,13 @@
*/
enum vehicle_audio_hw_variant_config_flag {
/**
- * This is a flag to disable the default behavior of not sending focus request for radio module.
- * By default, when radio app request audio focus, that focus request is filtered out and
- * is not sent to car audio module as radio is supposed to be played by car radio module and
- * android side should have have audio focus for media stream.
- * But in some H/W, radio may be directly played from android side, and in that case,
- * android side should take focus for media stream. This flag should be enabled in such case.
+ * Flag to tell that radio is internal to android and radio should
+ * be treated like other android stream like media.
+ * When this flag is not set or AUDIO_HW_VARIANT does not exist,
+ * radio is treated as external module. This brins some delta in audio focus
+ * handling as well.
*/
- VEHICLE_AUDIO_HW_VARIANT_FLAG_PASS_RADIO_AUDIO_FOCUS_FLAG = 0x1,
+ VEHICLE_AUDIO_HW_VARIANT_FLAG_INTERNAL_RADIO_FLAG = 0x1,
};
diff --git a/modules/soundtrigger/sound_trigger_hw.c b/modules/soundtrigger/sound_trigger_hw.c
index dadad82..956e77a 100644
--- a/modules/soundtrigger/sound_trigger_hw.c
+++ b/modules/soundtrigger/sound_trigger_hw.c
@@ -787,6 +787,27 @@
return 0;
}
+static int stdev_stop_all_recognitions(const struct sound_trigger_hw_device *dev) {
+ struct stub_sound_trigger_device *stdev = (struct stub_sound_trigger_device *)dev;
+ ALOGI("%s", __func__);
+ pthread_mutex_lock(&stdev->lock);
+
+ struct recognition_context *model_context = stdev->root_model_context;
+ while (model_context) {
+ free(model_context->config);
+ model_context->config = NULL;
+ model_context->recognition_callback = NULL;
+ model_context->recognition_cookie = NULL;
+ ALOGI("%s stopped handle %d", __func__, model_context->model_handle);
+
+ model_context = model_context->next;
+ }
+
+ pthread_mutex_unlock(&stdev->lock);
+
+ return 0;
+}
+
__attribute__ ((visibility ("default")))
int sound_trigger_open_for_streaming() {
int ret = 0;
@@ -838,6 +859,7 @@
stdev->device.unload_sound_model = stdev_unload_sound_model;
stdev->device.start_recognition = stdev_start_recognition;
stdev->device.stop_recognition = stdev_stop_recognition;
+ stdev->device.stop_all_recognitions = stdev_stop_all_recognitions;
pthread_mutex_init(&stdev->lock, (const pthread_mutexattr_t *) NULL);