Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit df3dc7e2 authored by Eric Laurent's avatar Eric Laurent
Browse files

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
parent d0fded31
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -309,6 +309,12 @@ public:
    /* Set audio port configuration */
    static status_t setAudioPortConfig(const struct audio_port_config *config);


    static status_t acquireSoundTriggerSession(audio_session_t *session,
                                           audio_io_handle_t *ioHandle,
                                           audio_devices_t *device);
    static status_t releaseSoundTriggerSession(audio_session_t session);

    // ----------------------------------------------------------------------------

    class AudioPortCallback : public RefBase
+6 −0
Original line number Diff line number Diff line
@@ -136,6 +136,12 @@ public:
    virtual status_t setAudioPortConfig(const struct audio_port_config *config) = 0;

    virtual void registerClient(const sp<IAudioPolicyServiceClient>& client) = 0;

    virtual status_t acquireSoundTriggerSession(audio_session_t *session,
                                           audio_io_handle_t *ioHandle,
                                           audio_devices_t *device) = 0;

    virtual status_t releaseSoundTriggerSession(audio_session_t session) = 0;
};


+4 −0
Original line number Diff line number Diff line
@@ -31,6 +31,10 @@ public:

    virtual void onRecognitionEvent(const sp<IMemory>& eventMemory) = 0;

    virtual void onSoundModelEvent(const sp<IMemory>& eventMemory) = 0;

    virtual void onServiceStateChange(const sp<IMemory>& eventMemory) = 0;

};

// ----------------------------------------------------------------------------
+2 −0
Original line number Diff line number Diff line
@@ -39,6 +39,8 @@ public:
    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;
};

// ----------------------------------------------------------------------------
+7 −1
Original line number Diff line number Diff line
@@ -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 @@ class SoundTrigger : public BnSoundTriggerClient,
                        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 @@ public:

            // 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);
Loading