summaryrefslogtreecommitdiff
path: root/core/java/android
diff options
context:
space:
mode:
authorTreeHugger Robot <treehugger-gerrit@google.com>2022-05-26 17:14:11 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2022-05-26 17:14:11 +0000
commit90579f32b391a2d193870fa255bd2873cda35dac (patch)
tree88e8965b8cccfecf2bc06b6f57ea63045b32736d /core/java/android
parentcb41788177bddacd969d9accd4b6e9b764a427a0 (diff)
parentbe0edce59a33e30716059d5b2e02644b25b2d572 (diff)
Merge "Add support for onReject and onError for external hotword." into tm-dev
Diffstat (limited to 'core/java/android')
-rw-r--r--core/java/android/service/voice/AbstractHotwordDetector.java11
-rw-r--r--core/java/android/service/voice/IMicrophoneHotwordDetectionVoiceInteractionCallback.aidl7
-rw-r--r--core/java/android/service/voice/SoftwareHotwordDetector.java11
3 files changed, 29 insertions, 0 deletions
diff --git a/core/java/android/service/voice/AbstractHotwordDetector.java b/core/java/android/service/voice/AbstractHotwordDetector.java
index b2bf9bc2ddd4..328750fe7780 100644
--- a/core/java/android/service/voice/AbstractHotwordDetector.java
+++ b/core/java/android/service/voice/AbstractHotwordDetector.java
@@ -198,5 +198,16 @@ abstract class AbstractHotwordDetector implements HotwordDetector {
HotwordDetector.Callback::onError,
mCallback));
}
+
+ @Override
+ public void onRejected(@Nullable HotwordRejectedResult result) {
+ if (result == null) {
+ result = new HotwordRejectedResult.Builder().build();
+ }
+ mHandler.sendMessage(obtainMessage(
+ HotwordDetector.Callback::onRejected,
+ mCallback,
+ result));
+ }
}
}
diff --git a/core/java/android/service/voice/IMicrophoneHotwordDetectionVoiceInteractionCallback.aidl b/core/java/android/service/voice/IMicrophoneHotwordDetectionVoiceInteractionCallback.aidl
index e8650894ac14..61ac68be9775 100644
--- a/core/java/android/service/voice/IMicrophoneHotwordDetectionVoiceInteractionCallback.aidl
+++ b/core/java/android/service/voice/IMicrophoneHotwordDetectionVoiceInteractionCallback.aidl
@@ -18,6 +18,7 @@ package android.service.voice;
import android.media.AudioFormat;
import android.service.voice.HotwordDetectedResult;
+import android.service.voice.HotwordRejectedResult;
/**
* Callback for returning the detected result from the HotwordDetectionService.
@@ -38,4 +39,10 @@ oneway interface IMicrophoneHotwordDetectionVoiceInteractionCallback {
* Called when the detection fails due to an error.
*/
void onError();
+
+ /**
+ * Called when the detected result was not detected.
+ */
+ void onRejected(
+ in HotwordRejectedResult hotwordRejectedResult);
}
diff --git a/core/java/android/service/voice/SoftwareHotwordDetector.java b/core/java/android/service/voice/SoftwareHotwordDetector.java
index f5a0c66f7b1b..68fa130b0003 100644
--- a/core/java/android/service/voice/SoftwareHotwordDetector.java
+++ b/core/java/android/service/voice/SoftwareHotwordDetector.java
@@ -164,6 +164,17 @@ class SoftwareHotwordDetector extends AbstractHotwordDetector {
HotwordDetector.Callback::onError,
mCallback));
}
+
+ @Override
+ public void onRejected(@Nullable HotwordRejectedResult result) {
+ if (result == null) {
+ result = new HotwordRejectedResult.Builder().build();
+ }
+ mHandler.sendMessage(obtainMessage(
+ HotwordDetector.Callback::onRejected,
+ mCallback,
+ result));
+ }
}
private static class InitializationStateListener