summaryrefslogtreecommitdiffstats
path: root/media
diff options
context:
space:
mode:
authorJean-Michel Trivi <jmtrivi@google.com>2012-10-10 12:03:41 -0700
committerJean-Michel Trivi <jmtrivi@google.com>2012-10-10 12:03:41 -0700
commitd677054ca63f55abaa1c478ea3c50f6be665a979 (patch)
treec27e68851c9140ad650d84245e9758625cfec0d5 /media
parenta8a6b0848d1c11c3ed0fcb846e3d6c39b91536a0 (diff)
downloadframeworks_base-d677054ca63f55abaa1c478ea3c50f6be665a979.zip
frameworks_base-d677054ca63f55abaa1c478ea3c50f6be665a979.tar.gz
frameworks_base-d677054ca63f55abaa1c478ea3c50f6be665a979.tar.bz2
Don't play notifications during speech recognition
Add support for querying AudioManager to know whether speech recognition is currently underway. Don't play a notification if speech recognition is underway. Bug 7314859 Change-Id: I1bd013a3168cfe1a6b6dcfd28565e1c3c512eb6a
Diffstat (limited to 'media')
-rw-r--r--media/java/android/media/AudioManager.java10
-rw-r--r--media/java/android/media/AudioSystem.java7
2 files changed, 17 insertions, 0 deletions
diff --git a/media/java/android/media/AudioManager.java b/media/java/android/media/AudioManager.java
index ee17bd3..035b282 100644
--- a/media/java/android/media/AudioManager.java
+++ b/media/java/android/media/AudioManager.java
@@ -1526,6 +1526,16 @@ 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
* If the stream is active locally or remotely, adjust its volume according to the enforced
* priority rules.
* Note: only AudioManager.STREAM_MUSIC is supported at the moment
diff --git a/media/java/android/media/AudioSystem.java b/media/java/android/media/AudioSystem.java
index 103e817..260ddc7 100644
--- a/media/java/android/media/AudioSystem.java
+++ b/media/java/android/media/AudioSystem.java
@@ -111,6 +111,13 @@ public class AudioSystem
public static native boolean isStreamActive(int stream, int inPastMs);
/*
+ * Checks whether the specified audio source is active.
+ *
+ * return true if any recorder using this source is currently recording
+ */
+ public static native boolean isSourceActive(int source);
+
+ /*
* Sets a group generic audio configuration parameters. The use of these parameters
* are platform dependent, see libaudio
*