Loading core/java/android/service/voice/AlwaysOnHotwordDetector.java +10 −0 Original line number Diff line number Diff line Loading @@ -263,6 +263,7 @@ public class AlwaysOnHotwordDetector extends AbstractHotwordDetector { private static final int MSG_DETECTION_RESUME = 5; private static final int MSG_HOTWORD_REJECTED = 6; private static final int MSG_HOTWORD_STATUS_REPORTED = 7; private static final int MSG_PROCESS_RESTARTED = 8; private final String mText; private final Locale mLocale; Loading Loading @@ -1212,6 +1213,12 @@ public class AlwaysOnHotwordDetector extends AbstractHotwordDetector { message.arg1 = status; message.sendToTarget(); } @Override public void onProcessRestarted() { Slog.i(TAG, "onProcessRestarted"); mHandler.sendEmptyMessage(MSG_PROCESS_RESTARTED); } } class MyHandler extends Handler { Loading Loading @@ -1246,6 +1253,9 @@ public class AlwaysOnHotwordDetector extends AbstractHotwordDetector { case MSG_HOTWORD_STATUS_REPORTED: mExternalCallback.onHotwordDetectionServiceInitialized(msg.arg1); break; case MSG_PROCESS_RESTARTED: mExternalCallback.onHotwordDetectionServiceRestarted(); break; default: super.handleMessage(msg); } Loading core/java/android/service/voice/HotwordDetectionService.java +1 −3 Original line number Diff line number Diff line Loading @@ -291,9 +291,7 @@ public abstract class HotwordDetectionService extends Service { @Nullable PersistableBundle options, @Nullable SharedMemory sharedMemory, @DurationMillisLong long callbackTimeoutMillis, @Nullable IntConsumer statusCallback) { // TODO: Handle the unimplemented case by throwing? } @Nullable IntConsumer statusCallback) {} /** * Called when the {@link VoiceInteractionService} requests that this service Loading core/java/android/service/voice/SoftwareHotwordDetector.java +27 −7 Original line number Diff line number Diff line Loading @@ -122,7 +122,7 @@ class SoftwareHotwordDetector extends AbstractHotwordDetector { this.mCallback = callback; } /** TODO: onDetected */ /** Called when the detected result is valid. */ @Override public void onDetected( @Nullable HotwordDetectedResult hotwordDetectedResult, Loading Loading @@ -150,33 +150,45 @@ class SoftwareHotwordDetector extends AbstractHotwordDetector { public void onKeyphraseDetected( SoundTrigger.KeyphraseRecognitionEvent recognitionEvent, HotwordDetectedResult result) { if (DEBUG) { Slog.i(TAG, "Ignored #onKeyphraseDetected event"); } } @Override public void onGenericSoundTriggerDetected( SoundTrigger.GenericRecognitionEvent recognitionEvent) throws RemoteException { if (DEBUG) { Slog.i(TAG, "Ignored #onGenericSoundTriggerDetected event"); } } @Override public void onRejected(HotwordRejectedResult result) throws RemoteException { if (DEBUG) { Slog.i(TAG, "Ignored #onRejected event"); } } @Override public void onError(int status) throws RemoteException { if (DEBUG) { Slog.i(TAG, "Ignored #onError (" + status + ") event"); } } @Override public void onRecognitionPaused() throws RemoteException { if (DEBUG) { Slog.i(TAG, "Ignored #onRecognitionPaused event"); } } @Override public void onRecognitionResumed() throws RemoteException { if (DEBUG) { Slog.i(TAG, "Ignored #onRecognitionResumed event"); } } @Override Loading @@ -187,6 +199,14 @@ class SoftwareHotwordDetector extends AbstractHotwordDetector { mCallback, status)); } @Override public void onProcessRestarted() throws RemoteException { Slog.v(TAG, "onProcessRestarted()"); mHandler.sendMessage(obtainMessage( HotwordDetector.Callback::onHotwordDetectionServiceRestarted, mCallback)); } } /** @hide */ Loading core/java/com/android/internal/app/IHotwordRecognitionStatusCallback.aidl +3 −0 Original line number Diff line number Diff line Loading @@ -78,4 +78,7 @@ oneway interface IHotwordRecognitionStatusCallback { * @param status The status about the result of requesting update state action. */ void onStatusReported(int status); /** Called when the hotword detection process is restarted */ void onProcessRestarted(); } core/java/com/android/internal/infra/ServiceConnector.java +1 −1 Original line number Diff line number Diff line Loading @@ -228,7 +228,7 @@ public interface ServiceConnector<I extends IInterface> { private final int mBindingFlags; private final @Nullable Function<IBinder, I> mBinderAsInterface; private final @NonNull Handler mHandler; private final @NonNull Executor mExecutor; protected final @NonNull Executor mExecutor; private volatile I mService = null; private boolean mBinding = false; Loading Loading
core/java/android/service/voice/AlwaysOnHotwordDetector.java +10 −0 Original line number Diff line number Diff line Loading @@ -263,6 +263,7 @@ public class AlwaysOnHotwordDetector extends AbstractHotwordDetector { private static final int MSG_DETECTION_RESUME = 5; private static final int MSG_HOTWORD_REJECTED = 6; private static final int MSG_HOTWORD_STATUS_REPORTED = 7; private static final int MSG_PROCESS_RESTARTED = 8; private final String mText; private final Locale mLocale; Loading Loading @@ -1212,6 +1213,12 @@ public class AlwaysOnHotwordDetector extends AbstractHotwordDetector { message.arg1 = status; message.sendToTarget(); } @Override public void onProcessRestarted() { Slog.i(TAG, "onProcessRestarted"); mHandler.sendEmptyMessage(MSG_PROCESS_RESTARTED); } } class MyHandler extends Handler { Loading Loading @@ -1246,6 +1253,9 @@ public class AlwaysOnHotwordDetector extends AbstractHotwordDetector { case MSG_HOTWORD_STATUS_REPORTED: mExternalCallback.onHotwordDetectionServiceInitialized(msg.arg1); break; case MSG_PROCESS_RESTARTED: mExternalCallback.onHotwordDetectionServiceRestarted(); break; default: super.handleMessage(msg); } Loading
core/java/android/service/voice/HotwordDetectionService.java +1 −3 Original line number Diff line number Diff line Loading @@ -291,9 +291,7 @@ public abstract class HotwordDetectionService extends Service { @Nullable PersistableBundle options, @Nullable SharedMemory sharedMemory, @DurationMillisLong long callbackTimeoutMillis, @Nullable IntConsumer statusCallback) { // TODO: Handle the unimplemented case by throwing? } @Nullable IntConsumer statusCallback) {} /** * Called when the {@link VoiceInteractionService} requests that this service Loading
core/java/android/service/voice/SoftwareHotwordDetector.java +27 −7 Original line number Diff line number Diff line Loading @@ -122,7 +122,7 @@ class SoftwareHotwordDetector extends AbstractHotwordDetector { this.mCallback = callback; } /** TODO: onDetected */ /** Called when the detected result is valid. */ @Override public void onDetected( @Nullable HotwordDetectedResult hotwordDetectedResult, Loading Loading @@ -150,33 +150,45 @@ class SoftwareHotwordDetector extends AbstractHotwordDetector { public void onKeyphraseDetected( SoundTrigger.KeyphraseRecognitionEvent recognitionEvent, HotwordDetectedResult result) { if (DEBUG) { Slog.i(TAG, "Ignored #onKeyphraseDetected event"); } } @Override public void onGenericSoundTriggerDetected( SoundTrigger.GenericRecognitionEvent recognitionEvent) throws RemoteException { if (DEBUG) { Slog.i(TAG, "Ignored #onGenericSoundTriggerDetected event"); } } @Override public void onRejected(HotwordRejectedResult result) throws RemoteException { if (DEBUG) { Slog.i(TAG, "Ignored #onRejected event"); } } @Override public void onError(int status) throws RemoteException { if (DEBUG) { Slog.i(TAG, "Ignored #onError (" + status + ") event"); } } @Override public void onRecognitionPaused() throws RemoteException { if (DEBUG) { Slog.i(TAG, "Ignored #onRecognitionPaused event"); } } @Override public void onRecognitionResumed() throws RemoteException { if (DEBUG) { Slog.i(TAG, "Ignored #onRecognitionResumed event"); } } @Override Loading @@ -187,6 +199,14 @@ class SoftwareHotwordDetector extends AbstractHotwordDetector { mCallback, status)); } @Override public void onProcessRestarted() throws RemoteException { Slog.v(TAG, "onProcessRestarted()"); mHandler.sendMessage(obtainMessage( HotwordDetector.Callback::onHotwordDetectionServiceRestarted, mCallback)); } } /** @hide */ Loading
core/java/com/android/internal/app/IHotwordRecognitionStatusCallback.aidl +3 −0 Original line number Diff line number Diff line Loading @@ -78,4 +78,7 @@ oneway interface IHotwordRecognitionStatusCallback { * @param status The status about the result of requesting update state action. */ void onStatusReported(int status); /** Called when the hotword detection process is restarted */ void onProcessRestarted(); }
core/java/com/android/internal/infra/ServiceConnector.java +1 −1 Original line number Diff line number Diff line Loading @@ -228,7 +228,7 @@ public interface ServiceConnector<I extends IInterface> { private final int mBindingFlags; private final @Nullable Function<IBinder, I> mBinderAsInterface; private final @NonNull Handler mHandler; private final @NonNull Executor mExecutor; protected final @NonNull Executor mExecutor; private volatile I mService = null; private boolean mBinding = false; Loading