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

Commit 9b426f76 authored by Felix Oghina's avatar Felix Oghina Committed by Android (Google) Code Review
Browse files

Merge "[speech] catch all exceptions and forward as client error" into main

parents a0bf24c4 d97b5bc0
Loading
Loading
Loading
Loading
+7 −7
Original line number Diff line number Diff line
@@ -767,7 +767,7 @@ public class SpeechRecognizer {
        try {
            mService.startListening(recognizerIntent, mListener, mContext.getAttributionSource());
            if (DBG) Log.d(TAG, "service start listening command succeeded");
        } catch (final RemoteException e) {
        } catch (final Exception e) {
            Log.e(TAG, "startListening() failed", e);
            mListener.onError(ERROR_CLIENT);
        }
@@ -781,7 +781,7 @@ public class SpeechRecognizer {
        try {
            mService.stopListening(mListener);
            if (DBG) Log.d(TAG, "service stop listening command succeeded");
        } catch (final RemoteException e) {
        } catch (final Exception e) {
            Log.e(TAG, "stopListening() failed", e);
            mListener.onError(ERROR_CLIENT);
        }
@@ -795,7 +795,7 @@ public class SpeechRecognizer {
        try {
            mService.cancel(mListener, /*isShutdown*/ false);
            if (DBG) Log.d(TAG, "service cancel command succeeded");
        } catch (final RemoteException e) {
        } catch (final Exception e) {
            Log.e(TAG, "cancel() failed", e);
            mListener.onError(ERROR_CLIENT);
        }
@@ -830,7 +830,7 @@ public class SpeechRecognizer {
                    mContext.getAttributionSource(),
                    new InternalSupportCallback(callbackExecutor, recognitionSupportCallback));
            if (DBG) Log.d(TAG, "service support command succeeded");
        } catch (final RemoteException e) {
        } catch (final Exception e) {
            Log.e(TAG, "checkRecognitionSupport() failed", e);
            callbackExecutor.execute(() -> recognitionSupportCallback.onError(ERROR_CLIENT));
        }
@@ -850,7 +850,7 @@ public class SpeechRecognizer {
                mService.triggerModelDownload(
                        recognizerIntent, mContext.getAttributionSource(), null);
                if (DBG) Log.d(TAG, "triggerModelDownload() without a listener");
            } catch (final RemoteException e) {
            } catch (final Exception e) {
                Log.e(TAG, "triggerModelDownload() without a listener failed", e);
                mListener.onError(ERROR_CLIENT);
            }
@@ -862,7 +862,7 @@ public class SpeechRecognizer {
                        recognizerIntent, mContext.getAttributionSource(),
                        new InternalModelDownloadListener(callbackExecutor, modelDownloadListener));
                if (DBG) Log.d(TAG, "triggerModelDownload() with a listener");
            } catch (final RemoteException e) {
            } catch (final Exception e) {
                Log.e(TAG, "triggerModelDownload() with a listener failed", e);
                callbackExecutor.execute(() -> modelDownloadListener.onError(ERROR_CLIENT));
            }
@@ -889,7 +889,7 @@ public class SpeechRecognizer {
        if (mService != null) {
            try {
                mService.cancel(mListener, /*isShutdown*/ true);
            } catch (final RemoteException e) {
            } catch (final Exception e) {
                // Not important
            }
        }