Add sound trigger control by audio policy
Audio policy:
- Added active capture indication to sound trigger service:
recognition stops if concurrent capture is not supported.
- Added generation of reserved I/O handle and session ID for
utterance capture.
Sound trigger service
- Added sound model update callback handling.
- Added service state callback
- Simplified callback shared memory allocation.
Bug: 12378680.
Change-Id: Ib0292c2733e6df90fdae480633dd9953d0016ef1
diff --git a/include/soundtrigger/ISoundTriggerClient.h b/include/soundtrigger/ISoundTriggerClient.h
index 7f86d02..480429a 100644
--- a/include/soundtrigger/ISoundTriggerClient.h
+++ b/include/soundtrigger/ISoundTriggerClient.h
@@ -31,6 +31,10 @@
virtual void onRecognitionEvent(const sp<IMemory>& eventMemory) = 0;
+ virtual void onSoundModelEvent(const sp<IMemory>& eventMemory) = 0;
+
+ virtual void onServiceStateChange(const sp<IMemory>& eventMemory) = 0;
+
};
// ----------------------------------------------------------------------------
diff --git a/include/soundtrigger/ISoundTriggerHwService.h b/include/soundtrigger/ISoundTriggerHwService.h
index 05a764a..ae0cb01 100644
--- a/include/soundtrigger/ISoundTriggerHwService.h
+++ b/include/soundtrigger/ISoundTriggerHwService.h
@@ -39,6 +39,8 @@
virtual status_t attach(const sound_trigger_module_handle_t handle,
const sp<ISoundTriggerClient>& client,
sp<ISoundTrigger>& module) = 0;
+
+ virtual status_t setCaptureState(bool active) = 0;
};
// ----------------------------------------------------------------------------
diff --git a/include/soundtrigger/SoundTrigger.h b/include/soundtrigger/SoundTrigger.h
index 1f7f286..bf5e1de 100644
--- a/include/soundtrigger/SoundTrigger.h
+++ b/include/soundtrigger/SoundTrigger.h
@@ -18,6 +18,7 @@
#define ANDROID_HARDWARE_SOUNDTRIGGER_H
#include <binder/IBinder.h>
+#include <utils/threads.h>
#include <soundtrigger/SoundTriggerCallback.h>
#include <soundtrigger/ISoundTrigger.h>
#include <soundtrigger/ISoundTriggerHwService.h>
@@ -32,12 +33,15 @@
public IBinder::DeathRecipient
{
public:
+
+ virtual ~SoundTrigger();
+
static status_t listModules(struct sound_trigger_module_descriptor *modules,
uint32_t *numModules);
static sp<SoundTrigger> attach(const sound_trigger_module_handle_t module,
const sp<SoundTriggerCallback>& callback);
- virtual ~SoundTrigger();
+ static status_t setCaptureState(bool active);
void detach();
@@ -51,6 +55,8 @@
// BpSoundTriggerClient
virtual void onRecognitionEvent(const sp<IMemory>& eventMemory);
+ virtual void onSoundModelEvent(const sp<IMemory>& eventMemory);
+ virtual void onServiceStateChange(const sp<IMemory>& eventMemory);
//IBinder::DeathRecipient
virtual void binderDied(const wp<IBinder>& who);
diff --git a/include/soundtrigger/SoundTriggerCallback.h b/include/soundtrigger/SoundTriggerCallback.h
index 8a5ba02..b5277f2 100644
--- a/include/soundtrigger/SoundTriggerCallback.h
+++ b/include/soundtrigger/SoundTriggerCallback.h
@@ -31,6 +31,10 @@
virtual void onRecognitionEvent(struct sound_trigger_recognition_event *event) = 0;
+ virtual void onSoundModelEvent(struct sound_trigger_model_event *event) = 0;
+
+ virtual void onServiceStateChange(sound_trigger_service_state_t state) = 0;
+
virtual void onServiceDied() = 0;
};