Loading api/current.txt +2 −0 Original line number Diff line number Diff line Loading @@ -27535,6 +27535,8 @@ package android.service.voice { method public abstract void onAvailabilityChanged(int); method public abstract void onDetected(android.service.voice.AlwaysOnHotwordDetector.EventPayload); method public abstract void onError(); method public abstract void onRecognitionPaused(); method public abstract void onRecognitionResumed(); } public static class AlwaysOnHotwordDetector.EventPayload { core/java/android/hardware/soundtrigger/IRecognitionStatusCallback.aidl +8 −0 Original line number Diff line number Diff line Loading @@ -34,4 +34,12 @@ oneway interface IRecognitionStatusCallback { * @param status The error code that was seen. */ void onError(int status); /** * Called when the recognition is paused temporarily for some reason. */ void onRecognitionPaused(); /** * Called when the recognition is resumed after it was temporarily paused. */ void onRecognitionResumed(); } No newline at end of file core/java/android/service/voice/AlwaysOnHotwordDetector.java +32 −0 Original line number Diff line number Diff line Loading @@ -161,6 +161,8 @@ public class AlwaysOnHotwordDetector { private static final int MSG_AVAILABILITY_CHANGED = 1; private static final int MSG_HOTWORD_DETECTED = 2; private static final int MSG_DETECTION_ERROR = 3; private static final int MSG_DETECTION_PAUSE = 4; private static final int MSG_DETECTION_RESUME = 5; private final String mText; private final String mLocale; Loading Loading @@ -239,6 +241,18 @@ public class AlwaysOnHotwordDetector { * Called when the detection fails due to an error. */ void 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 * except showing an indication on their UI if they have to. */ void onRecognitionPaused(); /** * Called when the recognition is resumed after it was temporarily paused. * This is an informational callback, and the clients shouldn't be doing anything here * except showing an indication on their UI if they have to. */ void onRecognitionResumed(); } /** Loading Loading @@ -508,6 +522,18 @@ public class AlwaysOnHotwordDetector { Slog.i(TAG, "onError: " + status); mHandler.sendEmptyMessage(MSG_DETECTION_ERROR); } @Override public void onRecognitionPaused() { Slog.i(TAG, "onRecognitionPaused"); mHandler.sendEmptyMessage(MSG_DETECTION_PAUSE); } @Override public void onRecognitionResumed() { Slog.i(TAG, "onRecognitionResumed"); mHandler.sendEmptyMessage(MSG_DETECTION_RESUME); } } class MyHandler extends Handler { Loading @@ -530,6 +556,12 @@ public class AlwaysOnHotwordDetector { case MSG_DETECTION_ERROR: mExternalCallback.onError(); break; case MSG_DETECTION_PAUSE: mExternalCallback.onRecognitionPaused(); break; case MSG_DETECTION_RESUME: mExternalCallback.onRecognitionResumed(); break; default: super.handleMessage(msg); } Loading Loading
api/current.txt +2 −0 Original line number Diff line number Diff line Loading @@ -27535,6 +27535,8 @@ package android.service.voice { method public abstract void onAvailabilityChanged(int); method public abstract void onDetected(android.service.voice.AlwaysOnHotwordDetector.EventPayload); method public abstract void onError(); method public abstract void onRecognitionPaused(); method public abstract void onRecognitionResumed(); } public static class AlwaysOnHotwordDetector.EventPayload {
core/java/android/hardware/soundtrigger/IRecognitionStatusCallback.aidl +8 −0 Original line number Diff line number Diff line Loading @@ -34,4 +34,12 @@ oneway interface IRecognitionStatusCallback { * @param status The error code that was seen. */ void onError(int status); /** * Called when the recognition is paused temporarily for some reason. */ void onRecognitionPaused(); /** * Called when the recognition is resumed after it was temporarily paused. */ void onRecognitionResumed(); } No newline at end of file
core/java/android/service/voice/AlwaysOnHotwordDetector.java +32 −0 Original line number Diff line number Diff line Loading @@ -161,6 +161,8 @@ public class AlwaysOnHotwordDetector { private static final int MSG_AVAILABILITY_CHANGED = 1; private static final int MSG_HOTWORD_DETECTED = 2; private static final int MSG_DETECTION_ERROR = 3; private static final int MSG_DETECTION_PAUSE = 4; private static final int MSG_DETECTION_RESUME = 5; private final String mText; private final String mLocale; Loading Loading @@ -239,6 +241,18 @@ public class AlwaysOnHotwordDetector { * Called when the detection fails due to an error. */ void 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 * except showing an indication on their UI if they have to. */ void onRecognitionPaused(); /** * Called when the recognition is resumed after it was temporarily paused. * This is an informational callback, and the clients shouldn't be doing anything here * except showing an indication on their UI if they have to. */ void onRecognitionResumed(); } /** Loading Loading @@ -508,6 +522,18 @@ public class AlwaysOnHotwordDetector { Slog.i(TAG, "onError: " + status); mHandler.sendEmptyMessage(MSG_DETECTION_ERROR); } @Override public void onRecognitionPaused() { Slog.i(TAG, "onRecognitionPaused"); mHandler.sendEmptyMessage(MSG_DETECTION_PAUSE); } @Override public void onRecognitionResumed() { Slog.i(TAG, "onRecognitionResumed"); mHandler.sendEmptyMessage(MSG_DETECTION_RESUME); } } class MyHandler extends Handler { Loading @@ -530,6 +556,12 @@ public class AlwaysOnHotwordDetector { case MSG_DETECTION_ERROR: mExternalCallback.onError(); break; case MSG_DETECTION_PAUSE: mExternalCallback.onRecognitionPaused(); break; case MSG_DETECTION_RESUME: mExternalCallback.onRecognitionResumed(); break; default: super.handleMessage(msg); } Loading