Loading services/soundtrigger/SoundTriggerHwService.cpp +13 −2 Original line number Original line Diff line number Diff line Loading @@ -70,7 +70,8 @@ void SoundTriggerHwService::onFirstRef() SOUND_TRIGGER_HARDWARE_MODULE_ID, HW_MODULE_PREFIX, strerror(-rc)); SOUND_TRIGGER_HARDWARE_MODULE_ID, HW_MODULE_PREFIX, strerror(-rc)); return; return; } } if (dev->common.version != SOUND_TRIGGER_DEVICE_API_VERSION_CURRENT) { if (dev->common.version < SOUND_TRIGGER_DEVICE_API_VERSION_1_0 || dev->common.version > SOUND_TRIGGER_DEVICE_API_VERSION_CURRENT) { ALOGE("wrong sound trigger hw device version %04x", dev->common.version); ALOGE("wrong sound trigger hw device version %04x", dev->common.version); return; return; } } Loading Loading @@ -808,10 +809,20 @@ void SoundTriggerHwService::Module::setCaptureState_l(bool active) goto exit; goto exit; } } const bool supports_stop_all = (mHwDevice->common.version >= SOUND_TRIGGER_DEVICE_API_VERSION_1_1 && mHwDevice->stop_all_recognitions); if (supports_stop_all) { mHwDevice->stop_all_recognitions(mHwDevice); } for (size_t i = 0; i < mModels.size(); i++) { for (size_t i = 0; i < mModels.size(); i++) { sp<Model> model = mModels.valueAt(i); sp<Model> model = mModels.valueAt(i); if (model->mState == Model::STATE_ACTIVE) { if (model->mState == Model::STATE_ACTIVE) { if (!supports_stop_all) { mHwDevice->stop_recognition(mHwDevice, model->mHandle); mHwDevice->stop_recognition(mHwDevice, model->mHandle); } // keep model in ACTIVE state so that event is processed by onCallbackEvent() // keep model in ACTIVE state so that event is processed by onCallbackEvent() if (model->mType == SOUND_MODEL_TYPE_KEYPHRASE) { if (model->mType == SOUND_MODEL_TYPE_KEYPHRASE) { struct sound_trigger_phrase_recognition_event event; struct sound_trigger_phrase_recognition_event event; Loading Loading
services/soundtrigger/SoundTriggerHwService.cpp +13 −2 Original line number Original line Diff line number Diff line Loading @@ -70,7 +70,8 @@ void SoundTriggerHwService::onFirstRef() SOUND_TRIGGER_HARDWARE_MODULE_ID, HW_MODULE_PREFIX, strerror(-rc)); SOUND_TRIGGER_HARDWARE_MODULE_ID, HW_MODULE_PREFIX, strerror(-rc)); return; return; } } if (dev->common.version != SOUND_TRIGGER_DEVICE_API_VERSION_CURRENT) { if (dev->common.version < SOUND_TRIGGER_DEVICE_API_VERSION_1_0 || dev->common.version > SOUND_TRIGGER_DEVICE_API_VERSION_CURRENT) { ALOGE("wrong sound trigger hw device version %04x", dev->common.version); ALOGE("wrong sound trigger hw device version %04x", dev->common.version); return; return; } } Loading Loading @@ -808,10 +809,20 @@ void SoundTriggerHwService::Module::setCaptureState_l(bool active) goto exit; goto exit; } } const bool supports_stop_all = (mHwDevice->common.version >= SOUND_TRIGGER_DEVICE_API_VERSION_1_1 && mHwDevice->stop_all_recognitions); if (supports_stop_all) { mHwDevice->stop_all_recognitions(mHwDevice); } for (size_t i = 0; i < mModels.size(); i++) { for (size_t i = 0; i < mModels.size(); i++) { sp<Model> model = mModels.valueAt(i); sp<Model> model = mModels.valueAt(i); if (model->mState == Model::STATE_ACTIVE) { if (model->mState == Model::STATE_ACTIVE) { if (!supports_stop_all) { mHwDevice->stop_recognition(mHwDevice, model->mHandle); mHwDevice->stop_recognition(mHwDevice, model->mHandle); } // keep model in ACTIVE state so that event is processed by onCallbackEvent() // keep model in ACTIVE state so that event is processed by onCallbackEvent() if (model->mType == SOUND_MODEL_TYPE_KEYPHRASE) { if (model->mType == SOUND_MODEL_TYPE_KEYPHRASE) { struct sound_trigger_phrase_recognition_event event; struct sound_trigger_phrase_recognition_event event; Loading