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

Commit c76fab19 authored by Peter Li's avatar Peter Li Committed by Android (Google) Code Review
Browse files

Merge "Add the logs when it fails in onDetected method." into udc-dev

parents 36c5abbb 996d706c
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -510,6 +510,8 @@ abstract class DetectorSession {
                                        try {
                                            enforcePermissionsForDataDelivery();
                                        } catch (SecurityException e) {
                                            Slog.w(TAG, "Ignoring #onDetected due to a "
                                                    + "SecurityException", e);
                                            HotwordMetricsLogger.writeDetectorEvent(
                                                    getDetectorType(),
                                                    EXTERNAL_SOURCE_DETECT_SECURITY_EXCEPTION,
@@ -525,6 +527,8 @@ abstract class DetectorSession {
                                            newResult = mHotwordAudioStreamCopier
                                                    .startCopyingAudioStreams(triggerResult);
                                        } catch (IOException e) {
                                            Slog.w(TAG, "Ignoring #onDetected due to a "
                                                    + "IOException", e);
                                            // TODO: Write event
                                            callback.onError(new HotwordDetectionServiceFailure(
                                                    CALLBACK_ONDETECTED_STREAM_COPY_ERROR,
+2 −1
Original line number Diff line number Diff line
@@ -126,7 +126,7 @@ final class DspTrustedHotwordDetectorSession extends DetectorSession {
                        enforcePermissionsForDataDelivery();
                        enforceExtraKeyphraseIdNotLeaked(result, recognitionEvent);
                    } catch (SecurityException e) {
                        Slog.i(TAG, "Ignoring #onDetected due to a SecurityException", e);
                        Slog.w(TAG, "Ignoring #onDetected due to a SecurityException", e);
                        HotwordMetricsLogger.writeKeyphraseTriggerEvent(
                                HotwordDetector.DETECTOR_TYPE_TRUSTED_HOTWORD_DSP,
                                METRICS_KEYPHRASE_TRIGGERED_DETECT_SECURITY_EXCEPTION,
@@ -141,6 +141,7 @@ final class DspTrustedHotwordDetectorSession extends DetectorSession {
                    try {
                        newResult = mHotwordAudioStreamCopier.startCopyingAudioStreams(result);
                    } catch (IOException e) {
                        Slog.w(TAG, "Ignoring #onDetected due to a IOException", e);
                        externalCallback.onDetectionFailure(new HotwordDetectionServiceFailure(
                                CALLBACK_ONDETECTED_STREAM_COPY_ERROR,
                                "Copy audio stream failure."));
+2 −0
Original line number Diff line number Diff line
@@ -118,6 +118,7 @@ final class SoftwareTrustedHotwordDetectorSession extends DetectorSession {
                    try {
                        enforcePermissionsForDataDelivery();
                    } catch (SecurityException e) {
                        Slog.w(TAG, "Ignoring #onDetected due to a SecurityException", e);
                        HotwordMetricsLogger.writeKeyphraseTriggerEvent(
                                HotwordDetector.DETECTOR_TYPE_TRUSTED_HOTWORD_SOFTWARE,
                                METRICS_KEYPHRASE_TRIGGERED_DETECT_SECURITY_EXCEPTION,
@@ -132,6 +133,7 @@ final class SoftwareTrustedHotwordDetectorSession extends DetectorSession {
                    try {
                        newResult = mHotwordAudioStreamCopier.startCopyingAudioStreams(result);
                    } catch (IOException e) {
                        Slog.w(TAG, "Ignoring #onDetected due to a IOException", e);
                        // TODO: Write event
                        mSoftwareCallback.onError(new HotwordDetectionServiceFailure(
                                CALLBACK_ONDETECTED_STREAM_COPY_ERROR,