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

Commit 6dd21efe authored by Michael Dooley's avatar Michael Dooley
Browse files

Revert "Adding getModelState API to sound trigger"

This reverts commit 19a2dc31.

Reason for revert: fix build breakage

Change-Id: I9f58d4c7cfbd871259b4d3186b81de2af6c5021f
parent 19a2dc31
Loading
Loading
Loading
Loading
+0 −2
Original line number Diff line number Diff line
@@ -40,8 +40,6 @@ public:
    virtual status_t startRecognition(sound_model_handle_t handle,
                                      const sp<IMemory>& dataMemory) = 0;
    virtual status_t stopRecognition(sound_model_handle_t handle) = 0;
    virtual status_t getModelState(sound_model_handle_t handle,
                                   sp<IMemory>& eventMemory) = 0;

};

+0 −1
Original line number Diff line number Diff line
@@ -52,7 +52,6 @@ public:

            status_t startRecognition(sound_model_handle_t handle, const sp<IMemory>& dataMemory);
            status_t stopRecognition(sound_model_handle_t handle);
            status_t getModelState(sound_model_handle_t handle, sp<IMemory>& eventMemory);

            // BpSoundTriggerClient
            virtual void onRecognitionEvent(const sp<IMemory>& eventMemory);
+0 −1
Original line number Diff line number Diff line
@@ -55,7 +55,6 @@ LOCAL_SHARED_LIBRARIES += \
    libaudiohal_deathhandler \
    android.hardware.soundtrigger@2.0 \
    android.hardware.soundtrigger@2.1 \
    android.hardware.soundtrigger@2.2 \
    android.hardware.audio.common@2.0 \
    android.hidl.allocator@1.0 \
    android.hidl.memory@1.0
+0 −50
Original line number Diff line number Diff line
@@ -356,50 +356,6 @@ int SoundTriggerHalHidl::stopAllRecognitions()
    return hidlReturn;
}

int SoundTriggerHalHidl::getModelState(sound_model_handle_t handle,
                                       struct sound_trigger_recognition_event** event)
{
    sp<ISoundTriggerHw> soundtrigger = getService();
    if (soundtrigger == 0) {
        return -ENODEV;
    }

    sp<V2_2_ISoundTriggerHw> soundtrigger_2_2 = toService2_2(soundtrigger);
    if (soundtrigger_2_2 == 0) {
        ALOGE("getModelState not supported");
        return -ENODEV;
    }

    sp<SoundModel> model = getModel(handle);
    if (model == 0) {
        ALOGE("getModelState model not found for handle %u", handle);
        return -EINVAL;
    }

    int ret = NO_ERROR;
    Return<void> hidlReturn;
    {
        AutoMutex lock(mHalLock);
        hidlReturn = soundtrigger_2_2->getModelState(
            model->mHalHandle,
            [&](int r, const V2_0_ISoundTriggerHwCallback::RecognitionEvent& halEvent) {
              ret = r;
              if (ret != 0) {
                  ALOGE("getModelState returned error code %d", ret);
              } else {
                  *event = convertRecognitionEventFromHal(&halEvent);
              }
            });
    }
    if (!hidlReturn.isOk()) {
        ALOGE("getModelState error %s", hidlReturn.description().c_str());
        free(*event);
        *event = nullptr;
        ret = FAILED_TRANSACTION;
    }
    return ret;
}

SoundTriggerHalHidl::SoundTriggerHalHidl(const char *moduleName)
    : mModuleName(moduleName), mNextUniqueId(1)
{
@@ -432,12 +388,6 @@ sp<V2_1_ISoundTriggerHw> SoundTriggerHalHidl::toService2_1(const sp<ISoundTrigge
    return castResult_2_1.isOk() ? static_cast<sp<V2_1_ISoundTriggerHw>>(castResult_2_1) : nullptr;
}

sp<V2_2_ISoundTriggerHw> SoundTriggerHalHidl::toService2_2(const sp<ISoundTriggerHw>& s)
{
    auto castResult_2_2 = V2_2_ISoundTriggerHw::castFrom(s);
    return castResult_2_2.isOk() ? static_cast<sp<V2_2_ISoundTriggerHw>>(castResult_2_2) : nullptr;
}

sp<SoundTriggerHalHidl::SoundModel> SoundTriggerHalHidl::getModel(sound_model_handle_t handle)
{
    AutoMutex lock(mLock);
+0 −12
Original line number Diff line number Diff line
@@ -27,7 +27,6 @@
#include "SoundTriggerHalInterface.h"
#include <android/hardware/soundtrigger/2.0/types.h>
#include <android/hardware/soundtrigger/2.1/ISoundTriggerHw.h>
#include <android/hardware/soundtrigger/2.2/ISoundTriggerHw.h>
#include <android/hardware/soundtrigger/2.0/ISoundTriggerHwCallback.h>
#include <android/hardware/soundtrigger/2.1/ISoundTriggerHwCallback.h>

@@ -47,8 +46,6 @@ using V2_1_ISoundTriggerHw =
using V2_1_ISoundTriggerHwCallback =
        ::android::hardware::soundtrigger::V2_1::ISoundTriggerHwCallback;
using ::android::hidl::memory::V1_0::IMemory;
using V2_2_ISoundTriggerHw =
        ::android::hardware::soundtrigger::V2_2::ISoundTriggerHw;

class SoundTriggerHalHidl : public SoundTriggerHalInterface,
                            public virtual V2_1_ISoundTriggerHwCallback
@@ -95,14 +92,6 @@ public:
         */
        virtual int stopAllRecognitions();

        /* Get the current state of a given model.
         * Returns 0 or an error code. If successful it also sets indicated the event pointer
         * and expectes that the caller will free the memory.
         * Only supported for device api versions SOUND_TRIGGER_DEVICE_API_VERSION_1_2 or above.
         */
        virtual int getModelState(sound_model_handle_t handle,
                                  struct sound_trigger_recognition_event** event);

        // ISoundTriggerHwCallback
        virtual ::android::hardware::Return<void> recognitionCallback(
                const V2_0_ISoundTriggerHwCallback::RecognitionEvent& event, CallbackCookie cookie);
@@ -193,7 +182,6 @@ private:
        uint32_t nextUniqueId();
        sp<ISoundTriggerHw> getService();
        sp<V2_1_ISoundTriggerHw> toService2_1(const sp<ISoundTriggerHw>& s);
        sp<V2_2_ISoundTriggerHw> toService2_2(const sp<ISoundTriggerHw>& s);
        sp<SoundModel> getModel(sound_model_handle_t handle);
        sp<SoundModel> removeModel(sound_model_handle_t handle);

Loading