Merge "Hotword: Add onStopDetection() for software detectors." into sc-dev am: 76660ef721
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/14718524 Change-Id: Id52a02d9e7c53b3d8fe373397452d20c36fa6a1c
This commit is contained in:
@@ -10565,6 +10565,7 @@ package android.service.voice {
|
|||||||
method public void onDetect(@NonNull android.service.voice.AlwaysOnHotwordDetector.EventPayload, long, @NonNull android.service.voice.HotwordDetectionService.Callback);
|
method public void onDetect(@NonNull android.service.voice.AlwaysOnHotwordDetector.EventPayload, long, @NonNull android.service.voice.HotwordDetectionService.Callback);
|
||||||
method public void onDetect(@NonNull android.service.voice.HotwordDetectionService.Callback);
|
method public void onDetect(@NonNull android.service.voice.HotwordDetectionService.Callback);
|
||||||
method public void onDetect(@NonNull android.os.ParcelFileDescriptor, @NonNull android.media.AudioFormat, @Nullable android.os.PersistableBundle, @NonNull android.service.voice.HotwordDetectionService.Callback);
|
method public void onDetect(@NonNull android.os.ParcelFileDescriptor, @NonNull android.media.AudioFormat, @Nullable android.os.PersistableBundle, @NonNull android.service.voice.HotwordDetectionService.Callback);
|
||||||
|
method public void onStopDetection();
|
||||||
method public void onUpdateState(@Nullable android.os.PersistableBundle, @Nullable android.os.SharedMemory, long, @Nullable java.util.function.IntConsumer);
|
method public void onUpdateState(@Nullable android.os.PersistableBundle, @Nullable android.os.SharedMemory, long, @Nullable java.util.function.IntConsumer);
|
||||||
field public static final int INITIALIZATION_STATUS_SUCCESS = 0; // 0x0
|
field public static final int INITIALIZATION_STATUS_SUCCESS = 0; // 0x0
|
||||||
field public static final int INITIALIZATION_STATUS_UNKNOWN = 100; // 0x64
|
field public static final int INITIALIZATION_STATUS_UNKNOWN = 100; // 0x64
|
||||||
|
|||||||
@@ -192,6 +192,11 @@ public abstract class HotwordDetectionService extends Service {
|
|||||||
mContentCaptureManager = new ContentCaptureManager(
|
mContentCaptureManager = new ContentCaptureManager(
|
||||||
HotwordDetectionService.this, manager, options);
|
HotwordDetectionService.this, manager, options);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void stopDetection() {
|
||||||
|
HotwordDetectionService.this.onStopDetection();
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -348,6 +353,15 @@ public abstract class HotwordDetectionService extends Service {
|
|||||||
onUpdateState(options, sharedMemory, UPDATE_TIMEOUT_MILLIS, intConsumer);
|
onUpdateState(options, sharedMemory, UPDATE_TIMEOUT_MILLIS, intConsumer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called when the {@link VoiceInteractionService}
|
||||||
|
* {@link HotwordDetector#stopRecognition() requests} that hotword recognition be stopped.
|
||||||
|
* <p>
|
||||||
|
* Any open {@link android.media.AudioRecord} should be closed here.
|
||||||
|
*/
|
||||||
|
public void onStopDetection() {
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Callback for returning the detection result.
|
* Callback for returning the detection result.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -53,4 +53,6 @@ oneway interface IHotwordDetectionService {
|
|||||||
void updateContentCaptureManager(
|
void updateContentCaptureManager(
|
||||||
in IContentCaptureManager contentCaptureManager,
|
in IContentCaptureManager contentCaptureManager,
|
||||||
in ContentCaptureOptions options);
|
in ContentCaptureOptions options);
|
||||||
|
|
||||||
|
void stopDetection();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -287,6 +287,8 @@ final class HotwordDetectionConnection {
|
|||||||
Slog.d(TAG, "stopListening");
|
Slog.d(TAG, "stopListening");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mRemoteHotwordDetectionService.run(service -> service.stopDetection());
|
||||||
|
|
||||||
synchronized (mLock) {
|
synchronized (mLock) {
|
||||||
if (mCurrentAudioSink != null) {
|
if (mCurrentAudioSink != null) {
|
||||||
Slog.i(TAG, "Closing audio stream to hotword detector: stopping requested");
|
Slog.i(TAG, "Closing audio stream to hotword detector: stopping requested");
|
||||||
|
|||||||
Reference in New Issue
Block a user