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

Commit fd7070fd authored by Sandeep Siddhartha's avatar Sandeep Siddhartha
Browse files

Add the capture session (and its availability) in the EventPayload

Keep it hidden till the API to start capture using a session isn't public

Bug: 16731718
Change-Id: I112dec307257739ef1e6c5c1e0358b6ecabe9a9e
parent 5f9aa0bc
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -27558,7 +27558,7 @@ package android.service.voice {
  public static class AlwaysOnHotwordDetector.EventPayload {
    field public final android.media.AudioFormat audioFormat;
    field public final byte[] data;
    field public final boolean isTriggerAudio;
    field public final boolean triggerAvailable;
  }
  public class VoiceInteractionService extends android.app.Service {
+28 −5
Original line number Diff line number Diff line
@@ -188,9 +188,28 @@ public class AlwaysOnHotwordDetector {
        /**
         * Indicates if {@code data} is the audio that triggered the keyphrase.
         */
        public final boolean isTriggerAudio;
        public final boolean triggerAvailable;
        /**
         * Format of {@code data}. May be null if {@code isTriggerAudio} is false.
         * Indicates if {@code captureSession} can be used to continue capturing more audio from
         * the DSP hardware.
         *
         * Candidate for public API
         * @hide
         */
        public final boolean captureAvailable;
        /**
         * The session to use when attempting to capture more audio from the DSP hardware.
         *
         * Candidate for public API
         * TODO: When unhiding, change javadoc of audioFormat to -
         * "Format of {@code data} or the audio that may be captured using {@code captureSession}.
         * May be null if {@code triggerAvailable} and {@code captureAvailable} are false."
         * @hide
         */
        public final int captureSession;
        /**
         * Format of {@code data}.
         * May be null if {@code triggerAvailable} is false.
         */
        @Nullable
        public final AudioFormat audioFormat;
@@ -201,8 +220,11 @@ public class AlwaysOnHotwordDetector {
        @Nullable
        public final byte[] data;

        private EventPayload(boolean _isTriggerAudio, AudioFormat _audioFormat, byte[] _data) {
            isTriggerAudio = _isTriggerAudio;
        private EventPayload(boolean _triggerAvailable, boolean _captureAvailable,
                AudioFormat _audioFormat, int _captureSession, byte[] _data) {
            triggerAvailable = _triggerAvailable;
            captureAvailable = _captureAvailable;
            captureSession = _captureSession;
            audioFormat = _audioFormat;
            data = _data;
        }
@@ -513,7 +535,8 @@ public class AlwaysOnHotwordDetector {
                Slog.i(TAG, "onDetected");
            }
            Message.obtain(mHandler, MSG_HOTWORD_DETECTED,
                    new EventPayload(event.triggerInData, event.captureFormat, event.data))
                    new EventPayload(event.triggerInData, event.captureAvailable,
                            event.captureFormat, event.captureSession, event.data))
                    .sendToTarget();
        }