Merge "Hotword: Propagate the DSP DetectedResult." into sc-dev

This commit is contained in:
TreeHugger Robot
2021-06-09 22:32:37 +00:00
committed by Android (Google) Code Review
4 changed files with 21 additions and 9 deletions

View File

@@ -354,6 +354,13 @@ public class AlwaysOnHotwordDetector extends AbstractHotwordDetector {
null);
}
EventPayload(boolean triggerAvailable, boolean captureAvailable,
AudioFormat audioFormat, int captureSession, byte[] data,
HotwordDetectedResult hotwordDetectedResult) {
this(triggerAvailable, captureAvailable, audioFormat, captureSession, data,
hotwordDetectedResult, null);
}
EventPayload(AudioFormat audioFormat, HotwordDetectedResult hotwordDetectedResult) {
this(false, false, audioFormat, -1, null, hotwordDetectedResult, null);
}
@@ -1149,7 +1156,8 @@ public class AlwaysOnHotwordDetector extends AbstractHotwordDetector {
}
@Override
public void onKeyphraseDetected(KeyphraseRecognitionEvent event) {
public void onKeyphraseDetected(
KeyphraseRecognitionEvent event, HotwordDetectedResult result) {
if (DBG) {
Slog.d(TAG, "onDetected(" + event + ")");
} else {
@@ -1157,7 +1165,7 @@ public class AlwaysOnHotwordDetector extends AbstractHotwordDetector {
}
Message.obtain(mHandler, MSG_HOTWORD_DETECTED,
new EventPayload(event.triggerInData, event.captureAvailable,
event.captureFormat, event.captureSession, event.data))
event.captureFormat, event.captureSession, event.data, result))
.sendToTarget();
}
@Override

View File

@@ -147,8 +147,9 @@ class SoftwareHotwordDetector extends AbstractHotwordDetector {
}
@Override
public void onKeyphraseDetected(SoundTrigger.KeyphraseRecognitionEvent recognitionEvent)
throws RemoteException {
public void onKeyphraseDetected(
SoundTrigger.KeyphraseRecognitionEvent recognitionEvent,
HotwordDetectedResult result) {
}

View File

@@ -17,6 +17,7 @@
package com.android.internal.app;
import android.hardware.soundtrigger.SoundTrigger;
import android.service.voice.HotwordDetectedResult;
import android.service.voice.HotwordRejectedResult;
/**
@@ -29,8 +30,11 @@ oneway interface IHotwordRecognitionStatusCallback {
* @param recognitionEvent Object containing data relating to the
* keyphrase recognition event such as keyphrase
* extras.
* @param result Successful detection result payload.
*/
void onKeyphraseDetected(in SoundTrigger.KeyphraseRecognitionEvent recognitionEvent);
void onKeyphraseDetected(
in SoundTrigger.KeyphraseRecognitionEvent recognitionEvent,
in HotwordDetectedResult result);
/**
* Called when a generic sound trigger event is witnessed.

View File

@@ -329,7 +329,7 @@ final class HotwordDetectionConnection {
if (DEBUG) {
Slog.d(TAG, "onDetected");
}
externalCallback.onKeyphraseDetected(recognitionEvent);
externalCallback.onKeyphraseDetected(recognitionEvent, result);
}
@Override
@@ -362,8 +362,7 @@ final class HotwordDetectionConnection {
if (DEBUG) {
Slog.d(TAG, "onDetected");
}
// TODO: Propagate the HotwordDetectedResult.
externalCallback.onKeyphraseDetected(recognitionEvent);
externalCallback.onKeyphraseDetected(recognitionEvent, result);
}
@Override
@@ -407,7 +406,7 @@ final class HotwordDetectionConnection {
mHotwordDetectionConnection.detectFromDspSource(
recognitionEvent, mExternalCallback);
} else {
mExternalCallback.onKeyphraseDetected(recognitionEvent);
mExternalCallback.onKeyphraseDetected(recognitionEvent, null);
}
}