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