Loading api/current.txt +2 −3 Original line number Original line Diff line number Diff line Loading @@ -27774,9 +27774,8 @@ package android.service.voice { } } public static class AlwaysOnHotwordDetector.EventPayload { public static class AlwaysOnHotwordDetector.EventPayload { field public final android.media.AudioFormat audioFormat; method public android.media.AudioFormat getCaptureAudioFormat(); field public final byte[] data; method public byte[] getTriggerAudio(); field public final boolean triggerAvailable; } } public class VoiceInteractionService extends android.app.Service { public class VoiceInteractionService extends android.app.Service { core/java/android/service/voice/AlwaysOnHotwordDetector.java +61 −32 Original line number Original line Diff line number Diff line Loading @@ -187,48 +187,77 @@ public class AlwaysOnHotwordDetector { * Additional payload for {@link Callback#onDetected}. * Additional payload for {@link Callback#onDetected}. */ */ public static class EventPayload { public static class EventPayload { /** private final boolean mTriggerAvailable; * Indicates if {@code data} is the audio that triggered the keyphrase. // Indicates if {@code captureSession} can be used to continue capturing more audio // from the DSP hardware. private final boolean mCaptureAvailable; // The session to use when attempting to capture more audio from the DSP hardware. private final int mCaptureSession; private final AudioFormat mAudioFormat; // Raw data associated with the event. // This is the audio that triggered the keyphrase if {@code isTriggerAudio} is true. private final byte[] mData; private EventPayload(boolean triggerAvailable, boolean captureAvailable, AudioFormat audioFormat, int captureSession, byte[] data) { mTriggerAvailable = triggerAvailable; mCaptureAvailable = captureAvailable; mCaptureSession = captureSession; mAudioFormat = audioFormat; mData = data; } /** * Gets the format of the audio obtained using {@link #getTriggerAudio()}. * May be null if there's no audio present. */ */ public final boolean triggerAvailable; @Nullable public AudioFormat getCaptureAudioFormat() { return mAudioFormat; } /** /** * Indicates if {@code captureSession} can be used to continue capturing more audio from * Gets the raw audio that triggered the keyphrase. * the DSP hardware. * This may be null if the trigger audio isn't available. * If non-null, the format of the audio can be obtained by calling * {@link #getCaptureAudioFormat()}. * * * Candidate for public API * @see AlwaysOnHotwordDetector#RECOGNITION_FLAG_CAPTURE_TRIGGER_AUDIO * @hide */ */ public final boolean captureAvailable; @Nullable public byte[] getTriggerAudio() { if (mTriggerAvailable) { return mData; } else { return null; } } /** /** * The session to use when attempting to capture more audio from the DSP hardware. * Gets the session ID to start a capture from the DSP. * This may be null if streaming capture isn't possible. * If non-null, the format of the audio that can be captured can be * obtained using {@link #getCaptureAudioFormat()}. * * TODO: Candidate for Public API when the API to start capture with a session ID * is made public. * * TODO: Add this to {@link #getCaptureAudioFormat()}: * "Gets the format of the audio obtained using {@link #getTriggerAudio()} * or {@link #getCaptureSession()}. May be null if no audio can be obtained * for either the trigger or a streaming session." * * TODO: Should this return a known invalid value instead? * * * 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 * @hide */ */ public final int captureSession; /** * Format of {@code data}. * May be null if {@code triggerAvailable} is false. */ @Nullable @Nullable public final AudioFormat audioFormat; public Integer getCaptureSession() { /** if (mCaptureAvailable) { * Raw data associated with the event. return mCaptureSession; * This is the audio that triggered the keyphrase if {@code isTriggerAudio} is true. } else { */ return null; @Nullable } public final byte[] data; private EventPayload(boolean _triggerAvailable, boolean _captureAvailable, AudioFormat _audioFormat, int _captureSession, byte[] _data) { triggerAvailable = _triggerAvailable; captureAvailable = _captureAvailable; captureSession = _captureSession; audioFormat = _audioFormat; data = _data; } } } } Loading Loading
api/current.txt +2 −3 Original line number Original line Diff line number Diff line Loading @@ -27774,9 +27774,8 @@ package android.service.voice { } } public static class AlwaysOnHotwordDetector.EventPayload { public static class AlwaysOnHotwordDetector.EventPayload { field public final android.media.AudioFormat audioFormat; method public android.media.AudioFormat getCaptureAudioFormat(); field public final byte[] data; method public byte[] getTriggerAudio(); field public final boolean triggerAvailable; } } public class VoiceInteractionService extends android.app.Service { public class VoiceInteractionService extends android.app.Service {
core/java/android/service/voice/AlwaysOnHotwordDetector.java +61 −32 Original line number Original line Diff line number Diff line Loading @@ -187,48 +187,77 @@ public class AlwaysOnHotwordDetector { * Additional payload for {@link Callback#onDetected}. * Additional payload for {@link Callback#onDetected}. */ */ public static class EventPayload { public static class EventPayload { /** private final boolean mTriggerAvailable; * Indicates if {@code data} is the audio that triggered the keyphrase. // Indicates if {@code captureSession} can be used to continue capturing more audio // from the DSP hardware. private final boolean mCaptureAvailable; // The session to use when attempting to capture more audio from the DSP hardware. private final int mCaptureSession; private final AudioFormat mAudioFormat; // Raw data associated with the event. // This is the audio that triggered the keyphrase if {@code isTriggerAudio} is true. private final byte[] mData; private EventPayload(boolean triggerAvailable, boolean captureAvailable, AudioFormat audioFormat, int captureSession, byte[] data) { mTriggerAvailable = triggerAvailable; mCaptureAvailable = captureAvailable; mCaptureSession = captureSession; mAudioFormat = audioFormat; mData = data; } /** * Gets the format of the audio obtained using {@link #getTriggerAudio()}. * May be null if there's no audio present. */ */ public final boolean triggerAvailable; @Nullable public AudioFormat getCaptureAudioFormat() { return mAudioFormat; } /** /** * Indicates if {@code captureSession} can be used to continue capturing more audio from * Gets the raw audio that triggered the keyphrase. * the DSP hardware. * This may be null if the trigger audio isn't available. * If non-null, the format of the audio can be obtained by calling * {@link #getCaptureAudioFormat()}. * * * Candidate for public API * @see AlwaysOnHotwordDetector#RECOGNITION_FLAG_CAPTURE_TRIGGER_AUDIO * @hide */ */ public final boolean captureAvailable; @Nullable public byte[] getTriggerAudio() { if (mTriggerAvailable) { return mData; } else { return null; } } /** /** * The session to use when attempting to capture more audio from the DSP hardware. * Gets the session ID to start a capture from the DSP. * This may be null if streaming capture isn't possible. * If non-null, the format of the audio that can be captured can be * obtained using {@link #getCaptureAudioFormat()}. * * TODO: Candidate for Public API when the API to start capture with a session ID * is made public. * * TODO: Add this to {@link #getCaptureAudioFormat()}: * "Gets the format of the audio obtained using {@link #getTriggerAudio()} * or {@link #getCaptureSession()}. May be null if no audio can be obtained * for either the trigger or a streaming session." * * TODO: Should this return a known invalid value instead? * * * 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 * @hide */ */ public final int captureSession; /** * Format of {@code data}. * May be null if {@code triggerAvailable} is false. */ @Nullable @Nullable public final AudioFormat audioFormat; public Integer getCaptureSession() { /** if (mCaptureAvailable) { * Raw data associated with the event. return mCaptureSession; * This is the audio that triggered the keyphrase if {@code isTriggerAudio} is true. } else { */ return null; @Nullable } public final byte[] data; private EventPayload(boolean _triggerAvailable, boolean _captureAvailable, AudioFormat _audioFormat, int _captureSession, byte[] _data) { triggerAvailable = _triggerAvailable; captureAvailable = _captureAvailable; captureSession = _captureSession; audioFormat = _audioFormat; data = _data; } } } } Loading