sound trigger HAL: add specialized methods for extended sound models
Initial HAL definition was using base struct types
(e.g SoundModel) to pass either a base struct or a struct
extended by composition.
This doesn't work with how autogenerated code passes data
over binder.
Bug: 32022304
Change-Id: I7d4ba6d063e80ba38af3db01043cafc7a084c426
diff --git a/soundtrigger/2.0/ISoundTriggerHw.hal b/soundtrigger/2.0/ISoundTriggerHw.hal
index a1be85d..cf35ef1 100644
--- a/soundtrigger/2.0/ISoundTriggerHw.hal
+++ b/soundtrigger/2.0/ISoundTriggerHw.hal
@@ -159,6 +159,34 @@
generates (int32_t retval, SoundModelHandle modelHandle);
/*
+ * Load a key phrase sound model. Once loaded, recognition of this model can
+ * be started and stopped. Only one active recognition per model at a time.
+ * The SoundTrigger service must handle concurrent recognition requests by
+ * different users/applications on the same model.
+ * The implementation returns a unique handle used by other functions
+ * (unloadSoundModel(), startRecognition(), etc...
+ * @param soundModel A PhraseSoundModel structure describing the sound model
+ * to load.
+ * @param callback The callback interface on which the soundmodelCallback()
+ * method will be called upon completion.
+ * @param cookie The value of the cookie argument passed to the completion
+ * callback. This unique context information is assigned and
+ * used only by the framework.
+ * @return retval Operation completion status: 0 in case of success,
+ * -EINVAL in case of invalid sound model (e.g 0 data size),
+ * -ENOSYS in case of invalid operation (e.g max number of
+ * models exceeded),
+ * -ENOMEM in case of memory allocation failure,
+ * -ENODEV in case of initialization error.
+ * @return modelHandle A unique handle assigned by the HAL for use by the
+ * framework when controlling activity for this sound model.
+ */
+ loadPhraseSoundModel(PhraseSoundModel soundModel,
+ ISoundTriggerHwCallback callback,
+ CallbackCookie cookie)
+ generates (int32_t retval, SoundModelHandle modelHandle);
+
+ /*
* Unload a sound model. A sound model may be unloaded to make room for a
* new one to overcome implementation limitations.
* @param modelHandle the handle of the sound model to unload
diff --git a/soundtrigger/2.0/ISoundTriggerHwCallback.hal b/soundtrigger/2.0/ISoundTriggerHwCallback.hal
index 294d451..c6555f6 100644
--- a/soundtrigger/2.0/ISoundTriggerHwCallback.hal
+++ b/soundtrigger/2.0/ISoundTriggerHwCallback.hal
@@ -92,6 +92,17 @@
* started (see ISoundtriggerHw.startRecognition()
*/
recognitionCallback(RecognitionEvent event, CallbackCookie cookie);
+
+ /*
+ * Callback method called by the HAL when the sound recognition triggers
+ * for a key phrase sound model.
+ * @param event A RecognitionEvent structure containing detailed results
+ * of the recognition triggered
+ * @param cookie The cookie passed by the framework when recognition was
+ * started (see ISoundtriggerHw.startRecognition()
+ */
+ phraseRecognitionCallback(PhraseRecognitionEvent event,
+ CallbackCookie cookie);
/*
* Callback method called by the HAL when the sound model loading completes
* @param event A ModelEvent structure containing detailed results of the