diff options
author | Linux Build Service Account <lnxbuild@localhost> | 2016-05-03 09:17:46 -0700 |
---|---|---|
committer | Gerrit - the friendly Code Review server <code-review@localhost> | 2016-05-03 09:17:46 -0700 |
commit | a58d5dc70a39f92453d62dd7d70b6ea7519f63a6 (patch) | |
tree | 5d2d40d168d01a028ac55d85aed2f6eac81e8ec3 /src/com/android/camera | |
parent | fd6cc91f1a4c09f65ffc3bfad2a59c818414c403 (diff) | |
parent | 74eb673ebd4372164bd0591070e7e1f37f01fdd6 (diff) | |
download | android_packages_apps_Snap-a58d5dc70a39f92453d62dd7d70b6ea7519f63a6.tar.gz android_packages_apps_Snap-a58d5dc70a39f92453d62dd7d70b6ea7519f63a6.tar.bz2 android_packages_apps_Snap-a58d5dc70a39f92453d62dd7d70b6ea7519f63a6.zip |
Merge "SnapdragonCamera: request audio focus before starting video recording" into camera.lnx.1.0-dev.1.0
Diffstat (limited to 'src/com/android/camera')
-rw-r--r-- | src/com/android/camera/VideoModule.java | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/src/com/android/camera/VideoModule.java b/src/com/android/camera/VideoModule.java index b2175d7b2..c21a56ae8 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 |