Loading core/api/system-current.txt +3 −2 Original line number Diff line number Diff line Loading @@ -13140,7 +13140,8 @@ package android.service.voice { public static interface HotwordDetector.Callback { method public void onDetected(@NonNull android.service.voice.AlwaysOnHotwordDetector.EventPayload); method public void onError(); method @Deprecated public void onError(); method public default void onFailure(@NonNull android.service.voice.DetectorFailure); method public void onHotwordDetectionServiceInitialized(int); method public void onHotwordDetectionServiceRestarted(); method public void onRecognitionPaused(); Loading Loading @@ -13201,7 +13202,7 @@ package android.service.voice { } public static interface VisualQueryDetector.Callback { method public void onError(); method public void onFailure(@NonNull android.service.voice.DetectorFailure); method public void onQueryDetected(@NonNull String); method public void onQueryFinished(); method public void onQueryRejected(); core/java/android/service/voice/AbstractDetector.java +6 −3 Original line number Diff line number Diff line Loading @@ -231,9 +231,12 @@ abstract class AbstractDetector implements HotwordDetector { /** Called when the detection fails due to an error. */ @Override public void onError() { Slog.v(TAG, "BinderCallback#onError"); Binder.withCleanCallingIdentity(() -> mExecutor.execute(() -> mCallback.onError())); public void onError(DetectorFailure detectorFailure) { Slog.v(TAG, "BinderCallback#onError detectorFailure: " + detectorFailure); Binder.withCleanCallingIdentity(() -> mExecutor.execute(() -> { mCallback.onFailure(detectorFailure != null ? detectorFailure : new UnknownFailure("Error data is null")); })); } @Override Loading core/java/android/service/voice/AlwaysOnHotwordDetector.java +18 −3 Original line number Diff line number Diff line Loading @@ -732,7 +732,13 @@ public class AlwaysOnHotwordDetector extends AbstractDetector { */ public abstract void onDetected(@NonNull EventPayload eventPayload); /** {@inheritDoc} */ /** * {@inheritDoc} * * @deprecated Use {@link HotwordDetector.Callback#onError(DetectorFailure)} instead. */ @Deprecated @Override public abstract void onError(); /** {@inheritDoc} */ Loading Loading @@ -1658,9 +1664,18 @@ public class AlwaysOnHotwordDetector extends AbstractDetector { @Override public void onError(int status) { Slog.i(TAG, "onError: " + status); mHandler.sendEmptyMessage(MSG_DETECTION_ERROR); // This is a workaround before the sound trigger uses the onDetectionFailure method. Message.obtain(mHandler, MSG_DETECTION_ERROR, new SoundTriggerFailure(status, "Sound trigger error")).sendToTarget(); } @Override public void onDetectionFailure(DetectorFailure detectorFailure) { Slog.v(TAG, "onDetectionFailure detectorFailure: " + detectorFailure); Message.obtain(mHandler, MSG_DETECTION_ERROR, detectorFailure != null ? detectorFailure : new UnknownFailure("Error data is null")).sendToTarget(); } @Override public void onRecognitionPaused() { Slog.i(TAG, "onRecognitionPaused"); Loading Loading @@ -1716,7 +1731,7 @@ public class AlwaysOnHotwordDetector extends AbstractDetector { mExternalCallback.onDetected((EventPayload) message.obj); break; case MSG_DETECTION_ERROR: mExternalCallback.onError(); mExternalCallback.onFailure((DetectorFailure) msg.obj); break; case MSG_DETECTION_PAUSE: mExternalCallback.onRecognitionPaused(); Loading core/java/android/service/voice/HotwordDetector.java +19 −0 Original line number Diff line number Diff line Loading @@ -231,9 +231,28 @@ public interface HotwordDetector { /** * Called when the detection fails due to an error. * * @deprecated On Android 14 and above, implement {@link #onFailure(DetectorFailure)} * instead. */ @Deprecated void onError(); /** * Called when the detection fails due to an error, the subclasses of * {@link DetectorFailure} will be reported to the detector. * * @see android.service.voice.HotwordDetectionServiceFailure * @see android.service.voice.SoundTriggerFailure * @see android.service.voice.UnknownFailure * @see android.service.voice.VisualQueryDetectionServiceFailure * * @param detectorFailure It provides the error code, error message and suggested action. */ default void onFailure(@NonNull DetectorFailure detectorFailure) { onError(); } /** * Called when the recognition is paused temporarily for some reason. * This is an informational callback, and the clients shouldn't be doing anything here Loading core/java/android/service/voice/IMicrophoneHotwordDetectionVoiceInteractionCallback.aidl +2 −1 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ package android.service.voice; import android.media.AudioFormat; import android.service.voice.DetectorFailure; import android.service.voice.HotwordDetectedResult; import android.service.voice.HotwordRejectedResult; Loading @@ -38,7 +39,7 @@ oneway interface IMicrophoneHotwordDetectionVoiceInteractionCallback { /** * Called when the detection fails due to an error. */ void onError(); void onError(in DetectorFailure detectorFailure); /** * Called when the detected result was not detected. Loading Loading
core/api/system-current.txt +3 −2 Original line number Diff line number Diff line Loading @@ -13140,7 +13140,8 @@ package android.service.voice { public static interface HotwordDetector.Callback { method public void onDetected(@NonNull android.service.voice.AlwaysOnHotwordDetector.EventPayload); method public void onError(); method @Deprecated public void onError(); method public default void onFailure(@NonNull android.service.voice.DetectorFailure); method public void onHotwordDetectionServiceInitialized(int); method public void onHotwordDetectionServiceRestarted(); method public void onRecognitionPaused(); Loading Loading @@ -13201,7 +13202,7 @@ package android.service.voice { } public static interface VisualQueryDetector.Callback { method public void onError(); method public void onFailure(@NonNull android.service.voice.DetectorFailure); method public void onQueryDetected(@NonNull String); method public void onQueryFinished(); method public void onQueryRejected();
core/java/android/service/voice/AbstractDetector.java +6 −3 Original line number Diff line number Diff line Loading @@ -231,9 +231,12 @@ abstract class AbstractDetector implements HotwordDetector { /** Called when the detection fails due to an error. */ @Override public void onError() { Slog.v(TAG, "BinderCallback#onError"); Binder.withCleanCallingIdentity(() -> mExecutor.execute(() -> mCallback.onError())); public void onError(DetectorFailure detectorFailure) { Slog.v(TAG, "BinderCallback#onError detectorFailure: " + detectorFailure); Binder.withCleanCallingIdentity(() -> mExecutor.execute(() -> { mCallback.onFailure(detectorFailure != null ? detectorFailure : new UnknownFailure("Error data is null")); })); } @Override Loading
core/java/android/service/voice/AlwaysOnHotwordDetector.java +18 −3 Original line number Diff line number Diff line Loading @@ -732,7 +732,13 @@ public class AlwaysOnHotwordDetector extends AbstractDetector { */ public abstract void onDetected(@NonNull EventPayload eventPayload); /** {@inheritDoc} */ /** * {@inheritDoc} * * @deprecated Use {@link HotwordDetector.Callback#onError(DetectorFailure)} instead. */ @Deprecated @Override public abstract void onError(); /** {@inheritDoc} */ Loading Loading @@ -1658,9 +1664,18 @@ public class AlwaysOnHotwordDetector extends AbstractDetector { @Override public void onError(int status) { Slog.i(TAG, "onError: " + status); mHandler.sendEmptyMessage(MSG_DETECTION_ERROR); // This is a workaround before the sound trigger uses the onDetectionFailure method. Message.obtain(mHandler, MSG_DETECTION_ERROR, new SoundTriggerFailure(status, "Sound trigger error")).sendToTarget(); } @Override public void onDetectionFailure(DetectorFailure detectorFailure) { Slog.v(TAG, "onDetectionFailure detectorFailure: " + detectorFailure); Message.obtain(mHandler, MSG_DETECTION_ERROR, detectorFailure != null ? detectorFailure : new UnknownFailure("Error data is null")).sendToTarget(); } @Override public void onRecognitionPaused() { Slog.i(TAG, "onRecognitionPaused"); Loading Loading @@ -1716,7 +1731,7 @@ public class AlwaysOnHotwordDetector extends AbstractDetector { mExternalCallback.onDetected((EventPayload) message.obj); break; case MSG_DETECTION_ERROR: mExternalCallback.onError(); mExternalCallback.onFailure((DetectorFailure) msg.obj); break; case MSG_DETECTION_PAUSE: mExternalCallback.onRecognitionPaused(); Loading
core/java/android/service/voice/HotwordDetector.java +19 −0 Original line number Diff line number Diff line Loading @@ -231,9 +231,28 @@ public interface HotwordDetector { /** * Called when the detection fails due to an error. * * @deprecated On Android 14 and above, implement {@link #onFailure(DetectorFailure)} * instead. */ @Deprecated void onError(); /** * Called when the detection fails due to an error, the subclasses of * {@link DetectorFailure} will be reported to the detector. * * @see android.service.voice.HotwordDetectionServiceFailure * @see android.service.voice.SoundTriggerFailure * @see android.service.voice.UnknownFailure * @see android.service.voice.VisualQueryDetectionServiceFailure * * @param detectorFailure It provides the error code, error message and suggested action. */ default void onFailure(@NonNull DetectorFailure detectorFailure) { onError(); } /** * Called when the recognition is paused temporarily for some reason. * This is an informational callback, and the clients shouldn't be doing anything here Loading
core/java/android/service/voice/IMicrophoneHotwordDetectionVoiceInteractionCallback.aidl +2 −1 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ package android.service.voice; import android.media.AudioFormat; import android.service.voice.DetectorFailure; import android.service.voice.HotwordDetectedResult; import android.service.voice.HotwordRejectedResult; Loading @@ -38,7 +39,7 @@ oneway interface IMicrophoneHotwordDetectionVoiceInteractionCallback { /** * Called when the detection fails due to an error. */ void onError(); void onError(in DetectorFailure detectorFailure); /** * Called when the detected result was not detected. Loading