diff options
author | Eric Laurent <elaurent@google.com> | 2013-09-09 10:31:59 -0700 |
---|---|---|
committer | Sandeep Siddhartha <sansid@google.com> | 2013-09-10 18:03:10 -0700 |
commit | 357263da0ec2bc2be9d48c1becc3d94288c2f3ed (patch) | |
tree | 386ba527fe3820dea80bffdc4495cac6536e2a9a /media | |
parent | d9f4e0cf2c2466d9e05f8562e55d342934f7ed0d (diff) | |
download | frameworks_base-357263da0ec2bc2be9d48c1becc3d94288c2f3ed.zip frameworks_base-357263da0ec2bc2be9d48c1becc3d94288c2f3ed.tar.gz frameworks_base-357263da0ec2bc2be9d48c1becc3d94288c2f3ed.tar.bz2 |
Add HOTWORD as an AudioSource
- This is a low-priority source that can be preempted by others
- This is required for scenarios where someone wants an alway-on
graceful microphone
Bug: 10640877.
Change-Id: Idb3577541103717cb713a7a93d3762ad2c2f4710
Diffstat (limited to 'media')
-rw-r--r-- | media/java/android/media/AudioManager.java | 10 | ||||
-rw-r--r-- | media/java/android/media/AudioRecord.java | 3 | ||||
-rw-r--r-- | media/java/android/media/MediaRecorder.java | 13 |
3 files changed, 15 insertions, 11 deletions
diff --git a/media/java/android/media/AudioManager.java b/media/java/android/media/AudioManager.java index 1dcf0e9..9bda852f 100644 --- a/media/java/android/media/AudioManager.java +++ b/media/java/android/media/AudioManager.java @@ -1532,16 +1532,6 @@ public class AudioManager { /** * @hide - * Checks whether speech recognition is active - * @return true if a recording with source {@link MediaRecorder.AudioSource#VOICE_RECOGNITION} - * is underway. - */ - public boolean isSpeechRecognitionActive() { - return AudioSystem.isSourceActive(MediaRecorder.AudioSource.VOICE_RECOGNITION); - } - - /** - * @hide * Checks whether the current audio focus is exclusive. * @return true if the top of the audio focus stack requested focus * with {@link #AUDIOFOCUS_GAIN_TRANSIENT_EXCLUSIVE} diff --git a/media/java/android/media/AudioRecord.java b/media/java/android/media/AudioRecord.java index d20f5b9..f49ef2e 100644 --- a/media/java/android/media/AudioRecord.java +++ b/media/java/android/media/AudioRecord.java @@ -252,7 +252,8 @@ public class AudioRecord //-------------- // audio source if ( (audioSource < MediaRecorder.AudioSource.DEFAULT) || - (audioSource > MediaRecorder.getAudioSourceMax()) ) { + ((audioSource > MediaRecorder.getAudioSourceMax()) && + (audioSource != MediaRecorder.AudioSource.HOTWORD)) ) { throw new IllegalArgumentException("Invalid audio source."); } mRecordSource = audioSource; diff --git a/media/java/android/media/MediaRecorder.java b/media/java/android/media/MediaRecorder.java index 1d2b889..8dcbd6b 100644 --- a/media/java/android/media/MediaRecorder.java +++ b/media/java/android/media/MediaRecorder.java @@ -200,6 +200,19 @@ public class MediaRecorder * </p> */ public static final int REMOTE_SUBMIX = 8; + + /** + * Audio source for preemptible, low-priority software hotword detection + * It presents the same gain and pre processing tuning as {@link #VOICE_RECOGNITION}. + * <p> + * An application should use this audio source when it wishes to do + * always-on software hotword detection, while gracefully giving in to any other application + * that might want to read from the microphone. + * </p> + * This is a hidden audio source. + * @hide + */ + protected static final int HOTWORD = 1999; } /** |