catch stopRecognition exceptions in destroy()
Ignore any exceptions coming out of the HotwordDetector#destroy() method when stopRecognition is called. The stopRecognition call here is a best effort call which should not be retried if it fails. Test: atest CtsVoiceInteractionTestCases Test: atest CtsVoiceInteractionHostTestCases Bug: 193232191 Change-Id: Ie4f8e68ca9078dca0e30fe73408947a2525c5b9a
This commit is contained in:
@@ -1215,7 +1215,11 @@ public class AlwaysOnHotwordDetector extends AbstractHotwordDetector {
|
||||
public void destroy() {
|
||||
synchronized (mLock) {
|
||||
if (mAvailability == STATE_KEYPHRASE_ENROLLED) {
|
||||
stopRecognition();
|
||||
try {
|
||||
stopRecognition();
|
||||
} catch (Exception e) {
|
||||
Log.i(TAG, "failed to stopRecognition in destroy", e);
|
||||
}
|
||||
}
|
||||
|
||||
mAvailability = STATE_INVALID;
|
||||
|
||||
@@ -30,6 +30,7 @@ import android.os.ParcelFileDescriptor;
|
||||
import android.os.PersistableBundle;
|
||||
import android.os.RemoteException;
|
||||
import android.os.SharedMemory;
|
||||
import android.util.Log;
|
||||
import android.util.Slog;
|
||||
|
||||
import com.android.internal.app.IHotwordRecognitionStatusCallback;
|
||||
@@ -117,7 +118,11 @@ class SoftwareHotwordDetector extends AbstractHotwordDetector {
|
||||
|
||||
@Override
|
||||
public void destroy() {
|
||||
stopRecognition();
|
||||
try {
|
||||
stopRecognition();
|
||||
} catch (Exception e) {
|
||||
Log.i(TAG, "failed to stopRecognition in destroy", e);
|
||||
}
|
||||
maybeCloseExistingSession();
|
||||
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user