Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 46c4ba27 authored by Nicholas Ambur's avatar Nicholas Ambur
Browse files

expand test API for DSP kephrase trigger

Expands the existing test API to include the KeyphraseExtra information
in the fake DSP trigger event.

Test: atest CtsVoiceInteractionTestCases
Test: atest CtsVoiceInteractionHostTestCases
Bug: 193232191
Change-Id: I3392cb37afaed6f67fb2f3b22edcbe7c869d1eba
parent fabe3ca4
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -2435,7 +2435,7 @@ package android.service.quicksettings {
package android.service.voice {

  public class AlwaysOnHotwordDetector implements android.service.voice.HotwordDetector {
    method @RequiresPermission(allOf={android.Manifest.permission.RECORD_AUDIO, android.Manifest.permission.CAPTURE_AUDIO_HOTWORD}) public void triggerHardwareRecognitionEventForTest(int, int, boolean, int, int, int, boolean, @NonNull android.media.AudioFormat, @Nullable byte[]);
    method @RequiresPermission(allOf={android.Manifest.permission.RECORD_AUDIO, android.Manifest.permission.CAPTURE_AUDIO_HOTWORD}) public void triggerHardwareRecognitionEventForTest(int, int, boolean, int, int, int, boolean, @NonNull android.media.AudioFormat, @Nullable byte[], @NonNull java.util.List<android.hardware.soundtrigger.SoundTrigger.KeyphraseRecognitionExtra>);
  }

  public static final class AlwaysOnHotwordDetector.EventPayload.Builder {
+4 −2
Original line number Diff line number Diff line
@@ -856,7 +856,8 @@ public class AlwaysOnHotwordDetector extends AbstractHotwordDetector {
    @RequiresPermission(allOf = {RECORD_AUDIO, CAPTURE_AUDIO_HOTWORD})
    public void triggerHardwareRecognitionEventForTest(int status, int soundModelHandle,
            boolean captureAvailable, int captureSession, int captureDelayMs, int capturePreambleMs,
            boolean triggerInData, @NonNull AudioFormat captureFormat, @Nullable byte[] data) {
            boolean triggerInData, @NonNull AudioFormat captureFormat, @Nullable byte[] data,
            @NonNull List<KeyphraseRecognitionExtra> keyphraseRecognitionExtras) {
        Log.d(TAG, "triggerHardwareRecognitionEventForTest()");
        synchronized (mLock) {
            if (mAvailability == STATE_INVALID || mAvailability == STATE_ERROR) {
@@ -867,7 +868,8 @@ public class AlwaysOnHotwordDetector extends AbstractHotwordDetector {
                mModelManagementService.triggerHardwareRecognitionEventForTest(
                        new KeyphraseRecognitionEvent(status, soundModelHandle, captureAvailable,
                                captureSession, captureDelayMs, capturePreambleMs, triggerInData,
                                captureFormat, data, null /* keyphraseExtras */),
                                captureFormat, data, keyphraseRecognitionExtras.toArray(
                                new KeyphraseRecognitionExtra[0])),
                        mInternalCallback);
            } catch (RemoteException e) {
                throw e.rethrowFromSystemServer();