Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit fabe3ca4 authored by Nicholas Ambur's avatar Nicholas Ambur
Browse files

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
parent 274f05a8
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -1215,7 +1215,11 @@ public class AlwaysOnHotwordDetector extends AbstractHotwordDetector {
    public void destroy() {
        synchronized (mLock) {
            if (mAvailability == STATE_KEYPHRASE_ENROLLED) {
                try {
                    stopRecognition();
                } catch (Exception e) {
                    Log.i(TAG, "failed to stopRecognition in destroy", e);
                }
            }

            mAvailability = STATE_INVALID;
+6 −1
Original line number Diff line number Diff line
@@ -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() {
        try {
            stopRecognition();
        } catch (Exception e) {
            Log.i(TAG, "failed to stopRecognition in destroy", e);
        }
        maybeCloseExistingSession();

        try {