am 11543a1b: am ea5ad487: am d8ef44bc: Merge "Don\'t call StopRecognition when recognition was aborted." into mnc-dr-dev

* commit '11543a1b852e5e87d37f5fbe95131d0f1d9afbee':
  Don't call StopRecognition when recognition was aborted.
This commit is contained in:
Chris Thornton
2015-10-15 01:43:57 +00:00
committed by Android Git Automerger

View File

@@ -87,6 +87,7 @@ public class SoundTriggerHelper implements SoundTrigger.StatusListener {
// This is an indirect indication of the microphone being open in some other application.
private boolean mServiceDisabled = false;
private boolean mStarted = false;
private boolean mRecognitionAborted = false;
private PowerSaveModeListener mPowerSaveModeListener;
SoundTriggerHelper(Context context) {
@@ -386,8 +387,9 @@ public class SoundTriggerHelper implements SoundTrigger.StatusListener {
private void onRecognitionAbortLocked() {
Slog.w(TAG, "Recognition aborted");
// No-op
// This is handled via service state changes instead.
// If abort has been called, the hardware has already stopped recognition, so we shouldn't
// call it again when we process the state change.
mRecognitionAborted = true;
}
private void onRecognitionFailureLocked() {
@@ -490,8 +492,13 @@ public class SoundTriggerHelper implements SoundTrigger.StatusListener {
}
return status;
} else {
// Stop recognition.
int status = mModule.stopRecognition(mCurrentSoundModelHandle);
// Stop recognition (only if we haven't been aborted).
int status = STATUS_OK;
if (!mRecognitionAborted) {
status = mModule.stopRecognition(mCurrentSoundModelHandle);
} else {
mRecognitionAborted = false;
}
if (status != SoundTrigger.STATUS_OK) {
Slog.w(TAG, "stopRecognition call failed with " + status);
if (notify) {