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

Commit 1a1cba8f authored by Eric Laurent's avatar Eric Laurent
Browse files

sound trigger: stop recognition on sound model unload

Force a stop recognition command to the HAL when
unloading a sound model and recognition is still active.

Change-Id: I7379a64a37bbc3eeea08e0e1d59e427de9544a10
parent 7e45ef9d
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -367,8 +367,12 @@ status_t SoundTriggerHwService::Module::unloadSoundModel(sound_model_handle_t ha
    if (index < 0) {
        return BAD_VALUE;
    }
    sp<Model> model = mModels.valueAt(index);
    mModels.removeItem(handle);

    if (model->mState == Model::STATE_ACTIVE) {
        mHwDevice->stop_recognition(mHwDevice, model->mHandle);
        model->deallocateMemory();
    }
    return mHwDevice->unload_sound_model(mHwDevice, handle);
}