Loading core/jni/android_media_AudioRecord.cpp +9 −2 Original line number Original line Diff line number Diff line Loading @@ -190,7 +190,7 @@ android_media_AudioRecord_setup(JNIEnv *env, jobject thiz, jobject weak_this, int frameSize = nbChannels * bytesPerSample; int frameSize = nbChannels * bytesPerSample; size_t frameCount = buffSizeInBytes / frameSize; size_t frameCount = buffSizeInBytes / frameSize; if (uint32_t(source) >= AUDIO_SOURCE_CNT) { if ((uint32_t(source) >= AUDIO_SOURCE_CNT) && (uint32_t(source) != AUDIO_SOURCE_HOTWORD)) { ALOGE("Error creating AudioRecord: unknown source."); ALOGE("Error creating AudioRecord: unknown source."); return AUDIORECORD_ERROR_SETUP_INVALIDSOURCE; return AUDIORECORD_ERROR_SETUP_INVALIDSOURCE; } } Loading Loading @@ -387,6 +387,9 @@ static jint android_media_AudioRecord_readInByteArray(JNIEnv *env, jobject thiz (jint)recorderBuffSize : sizeInBytes ); (jint)recorderBuffSize : sizeInBytes ); env->ReleaseByteArrayElements(javaAudioData, recordBuff, 0); env->ReleaseByteArrayElements(javaAudioData, recordBuff, 0); if (readSize < 0) { readSize = AUDIORECORD_ERROR_INVALID_OPERATION; } return (jint) readSize; return (jint) readSize; } } Loading Loading @@ -427,8 +430,12 @@ static jint android_media_AudioRecord_readInDirectBuffer(JNIEnv *env, jobject t } } // read new data from the recorder // read new data from the recorder return (jint) lpRecorder->read(nativeFromJavaBuf, ssize_t readSize = lpRecorder->read(nativeFromJavaBuf, capacity < sizeInBytes ? capacity : sizeInBytes); capacity < sizeInBytes ? capacity : sizeInBytes); if (readSize < 0) { readSize = AUDIORECORD_ERROR_INVALID_OPERATION; } return (jint)readSize; } } Loading core/res/AndroidManifest.xml +8 −0 Original line number Original line Diff line number Diff line Loading @@ -2084,6 +2084,14 @@ android:description="@string/permdesc_captureAudioOutput" android:description="@string/permdesc_captureAudioOutput" android:protectionLevel="signature|system" /> android:protectionLevel="signature|system" /> <!-- Allows an application to capture audio for hotword detection. <p>Not for use by third-party applications.</p> @hide --> <permission android:name="android.permission.CAPTURE_AUDIO_HOTWORD" android:label="@string/permlab_captureAudioHotword" android:description="@string/permdesc_captureAudioHotword" android:protectionLevel="signature|system" /> <!-- Allows an application to capture video output. <!-- Allows an application to capture video output. <p>Not for use by third-party applications.</p> --> <p>Not for use by third-party applications.</p> --> <permission android:name="android.permission.CAPTURE_VIDEO_OUTPUT" <permission android:name="android.permission.CAPTURE_VIDEO_OUTPUT" Loading core/res/res/values/strings.xml +6 −0 Original line number Original line Diff line number Diff line Loading @@ -1404,6 +1404,12 @@ <!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. --> <!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. --> <string name="permdesc_captureAudioOutput">Allows the app to capture and redirect audio output.</string> <string name="permdesc_captureAudioOutput">Allows the app to capture and redirect audio output.</string> <!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. --> <string name="permlab_captureAudioHotword">Hotword detection</string> <!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. --> <string name="permdesc_captureAudioHotword">Allows the app to capture audio for Hotword detection. The capture can happen in the background but does not prevent other audio capture (e.g. Camcorder).</string> <!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. --> <!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. --> <string name="permlab_captureVideoOutput">capture video output</string> <string name="permlab_captureVideoOutput">capture video output</string> <!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. --> <!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. --> Loading media/java/android/media/AudioManager.java +0 −10 Original line number Original line Diff line number Diff line Loading @@ -1530,16 +1530,6 @@ public class AudioManager { return AudioSystem.isStreamActiveRemotely(STREAM_MUSIC, 0); return AudioSystem.isStreamActiveRemotely(STREAM_MUSIC, 0); } } /** * @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 * @hide * Checks whether the current audio focus is exclusive. * Checks whether the current audio focus is exclusive. Loading media/java/android/media/AudioRecord.java +2 −1 Original line number Original line Diff line number Diff line Loading @@ -252,7 +252,8 @@ public class AudioRecord //-------------- //-------------- // audio source // audio source if ( (audioSource < MediaRecorder.AudioSource.DEFAULT) || if ( (audioSource < MediaRecorder.AudioSource.DEFAULT) || (audioSource > MediaRecorder.getAudioSourceMax()) ) { ((audioSource > MediaRecorder.getAudioSourceMax()) && (audioSource != MediaRecorder.AudioSource.HOTWORD)) ) { throw new IllegalArgumentException("Invalid audio source."); throw new IllegalArgumentException("Invalid audio source."); } } mRecordSource = audioSource; mRecordSource = audioSource; Loading Loading
core/jni/android_media_AudioRecord.cpp +9 −2 Original line number Original line Diff line number Diff line Loading @@ -190,7 +190,7 @@ android_media_AudioRecord_setup(JNIEnv *env, jobject thiz, jobject weak_this, int frameSize = nbChannels * bytesPerSample; int frameSize = nbChannels * bytesPerSample; size_t frameCount = buffSizeInBytes / frameSize; size_t frameCount = buffSizeInBytes / frameSize; if (uint32_t(source) >= AUDIO_SOURCE_CNT) { if ((uint32_t(source) >= AUDIO_SOURCE_CNT) && (uint32_t(source) != AUDIO_SOURCE_HOTWORD)) { ALOGE("Error creating AudioRecord: unknown source."); ALOGE("Error creating AudioRecord: unknown source."); return AUDIORECORD_ERROR_SETUP_INVALIDSOURCE; return AUDIORECORD_ERROR_SETUP_INVALIDSOURCE; } } Loading Loading @@ -387,6 +387,9 @@ static jint android_media_AudioRecord_readInByteArray(JNIEnv *env, jobject thiz (jint)recorderBuffSize : sizeInBytes ); (jint)recorderBuffSize : sizeInBytes ); env->ReleaseByteArrayElements(javaAudioData, recordBuff, 0); env->ReleaseByteArrayElements(javaAudioData, recordBuff, 0); if (readSize < 0) { readSize = AUDIORECORD_ERROR_INVALID_OPERATION; } return (jint) readSize; return (jint) readSize; } } Loading Loading @@ -427,8 +430,12 @@ static jint android_media_AudioRecord_readInDirectBuffer(JNIEnv *env, jobject t } } // read new data from the recorder // read new data from the recorder return (jint) lpRecorder->read(nativeFromJavaBuf, ssize_t readSize = lpRecorder->read(nativeFromJavaBuf, capacity < sizeInBytes ? capacity : sizeInBytes); capacity < sizeInBytes ? capacity : sizeInBytes); if (readSize < 0) { readSize = AUDIORECORD_ERROR_INVALID_OPERATION; } return (jint)readSize; } } Loading
core/res/AndroidManifest.xml +8 −0 Original line number Original line Diff line number Diff line Loading @@ -2084,6 +2084,14 @@ android:description="@string/permdesc_captureAudioOutput" android:description="@string/permdesc_captureAudioOutput" android:protectionLevel="signature|system" /> android:protectionLevel="signature|system" /> <!-- Allows an application to capture audio for hotword detection. <p>Not for use by third-party applications.</p> @hide --> <permission android:name="android.permission.CAPTURE_AUDIO_HOTWORD" android:label="@string/permlab_captureAudioHotword" android:description="@string/permdesc_captureAudioHotword" android:protectionLevel="signature|system" /> <!-- Allows an application to capture video output. <!-- Allows an application to capture video output. <p>Not for use by third-party applications.</p> --> <p>Not for use by third-party applications.</p> --> <permission android:name="android.permission.CAPTURE_VIDEO_OUTPUT" <permission android:name="android.permission.CAPTURE_VIDEO_OUTPUT" Loading
core/res/res/values/strings.xml +6 −0 Original line number Original line Diff line number Diff line Loading @@ -1404,6 +1404,12 @@ <!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. --> <!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. --> <string name="permdesc_captureAudioOutput">Allows the app to capture and redirect audio output.</string> <string name="permdesc_captureAudioOutput">Allows the app to capture and redirect audio output.</string> <!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. --> <string name="permlab_captureAudioHotword">Hotword detection</string> <!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. --> <string name="permdesc_captureAudioHotword">Allows the app to capture audio for Hotword detection. The capture can happen in the background but does not prevent other audio capture (e.g. Camcorder).</string> <!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. --> <!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. --> <string name="permlab_captureVideoOutput">capture video output</string> <string name="permlab_captureVideoOutput">capture video output</string> <!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. --> <!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. --> Loading
media/java/android/media/AudioManager.java +0 −10 Original line number Original line Diff line number Diff line Loading @@ -1530,16 +1530,6 @@ public class AudioManager { return AudioSystem.isStreamActiveRemotely(STREAM_MUSIC, 0); return AudioSystem.isStreamActiveRemotely(STREAM_MUSIC, 0); } } /** * @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 * @hide * Checks whether the current audio focus is exclusive. * Checks whether the current audio focus is exclusive. Loading
media/java/android/media/AudioRecord.java +2 −1 Original line number Original line Diff line number Diff line Loading @@ -252,7 +252,8 @@ public class AudioRecord //-------------- //-------------- // audio source // audio source if ( (audioSource < MediaRecorder.AudioSource.DEFAULT) || if ( (audioSource < MediaRecorder.AudioSource.DEFAULT) || (audioSource > MediaRecorder.getAudioSourceMax()) ) { ((audioSource > MediaRecorder.getAudioSourceMax()) && (audioSource != MediaRecorder.AudioSource.HOTWORD)) ) { throw new IllegalArgumentException("Invalid audio source."); throw new IllegalArgumentException("Invalid audio source."); } } mRecordSource = audioSource; mRecordSource = audioSource; Loading