summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinux Build Service Account <lnxbuild@localhost>2016-05-03 09:17:46 -0700
committerGerrit - the friendly Code Review server <code-review@localhost>2016-05-03 09:17:46 -0700
commita58d5dc70a39f92453d62dd7d70b6ea7519f63a6 (patch)
tree5d2d40d168d01a028ac55d85aed2f6eac81e8ec3
parentfd6cc91f1a4c09f65ffc3bfad2a59c818414c403 (diff)
parent74eb673ebd4372164bd0591070e7e1f37f01fdd6 (diff)
downloadandroid_packages_apps_Snap-a58d5dc70a39f92453d62dd7d70b6ea7519f63a6.zip
android_packages_apps_Snap-a58d5dc70a39f92453d62dd7d70b6ea7519f63a6.tar.gz
android_packages_apps_Snap-a58d5dc70a39f92453d62dd7d70b6ea7519f63a6.tar.bz2
Merge "SnapdragonCamera: request audio focus before starting video recording" into camera.lnx.1.0-dev.1.0
-rw-r--r--src/com/android/camera/VideoModule.java18
1 files changed, 11 insertions, 7 deletions
diff --git a/src/com/android/camera/VideoModule.java b/src/com/android/camera/VideoModule.java
index b2175d7..c21a56a 100644
--- a/src/com/android/camera/VideoModule.java
+++ b/src/com/android/camera/VideoModule.java
@@ -1731,13 +1731,17 @@ public class VideoModule implements CameraModule,
* Make sure we're not recording music playing in the background, ask the
* MediaPlaybackService to pause playback.
*/
- private void pauseAudioPlayback() {
- // Shamelessly copied from MediaPlaybackService.java, which
- // should be public, but isn't.
- Intent i = new Intent("com.android.music.musicservicecommand");
- i.putExtra("command", "pause");
+ private void requestAudioFocus() {
+ AudioManager am = (AudioManager)mActivity.getSystemService(Context.AUDIO_SERVICE);
+
+ // Send request to obtain audio focus. This will stop other
+ // music stream.
+ int result = am.requestAudioFocus(null, AudioManager.STREAM_MUSIC,
+ AudioManager.AUDIOFOCUS_GAIN);
- mActivity.sendBroadcast(i);
+ if (result == AudioManager.AUDIOFOCUS_REQUEST_FAILED) {
+ Log.v(TAG, "Audio focus request failed");
+ }
}
// For testing.
@@ -1805,7 +1809,7 @@ public class VideoModule implements CameraModule,
return false;
}
- pauseAudioPlayback();
+ requestAudioFocus();
try {
mMediaRecorder.start(); // Recording is now started