diff options
author | Chris Thornton <thorntonc@google.com> | 2015-10-06 16:48:12 -0700 |
---|---|---|
committer | Chris Thornton <thorntonc@google.com> | 2015-10-07 11:33:45 -0700 |
commit | b7b5812147aadb159080f14944b7d93a5002fdb7 (patch) | |
tree | ffb3ab779ad48734b72563bb5a2414660a684d8b /services/voiceinteraction | |
parent | 714a61cd586c789b18acfd0567cfea2b4ea170dd (diff) | |
download | frameworks_base-b7b5812147aadb159080f14944b7d93a5002fdb7.zip frameworks_base-b7b5812147aadb159080f14944b7d93a5002fdb7.tar.gz frameworks_base-b7b5812147aadb159080f14944b7d93a5002fdb7.tar.bz2 |
Don't call StopRecognition when recognition was aborted.
If recognition has been aborted, then the call to the sound trigger
device stop recognition has already occurred. The sound trigger helper
would then try to stop it again, which generates an error code for a
stop without a corresponding start event.
BUG=24677430
Change-Id: Ibf5d1da1a8eb06b677e428f047905d15fd5cf21f
Diffstat (limited to 'services/voiceinteraction')
-rw-r--r-- | services/voiceinteraction/java/com/android/server/voiceinteraction/SoundTriggerHelper.java | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/services/voiceinteraction/java/com/android/server/voiceinteraction/SoundTriggerHelper.java b/services/voiceinteraction/java/com/android/server/voiceinteraction/SoundTriggerHelper.java index 3ca0c84..31d859f 100644 --- a/services/voiceinteraction/java/com/android/server/voiceinteraction/SoundTriggerHelper.java +++ b/services/voiceinteraction/java/com/android/server/voiceinteraction/SoundTriggerHelper.java @@ -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) { |