diff options
author | Eric Laurent <elaurent@google.com> | 2009-11-30 10:05:52 -0800 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2009-11-30 10:05:52 -0800 |
commit | 55da000c1d2e0f50bf96953ea967d69b27d70ea3 (patch) | |
tree | 1cfd348a62f9a36a1900477c952968d546a4a7c6 | |
parent | a615139dc33968e2ef69073cc925217879569db4 (diff) | |
parent | bb3bb57a6330f71323fcd7e93e88dbdab55daec3 (diff) | |
download | frameworks_base-55da000c1d2e0f50bf96953ea967d69b27d70ea3.zip frameworks_base-55da000c1d2e0f50bf96953ea967d69b27d70ea3.tar.gz frameworks_base-55da000c1d2e0f50bf96953ea967d69b27d70ea3.tar.bz2 |
am bb3bb57a: Merge change I524dc046 into eclair
Merge commit 'bb3bb57a6330f71323fcd7e93e88dbdab55daec3' into eclair-plus-aosp
* commit 'bb3bb57a6330f71323fcd7e93e88dbdab55daec3':
Fix issue 2192673: Music Pausing Even when notifications are set to silent.
-rw-r--r-- | camera/libcameraservice/CameraService.cpp | 20 | ||||
-rw-r--r-- | media/java/android/media/Ringtone.java | 8 | ||||
-rwxr-xr-x | services/java/com/android/server/NotificationManagerService.java | 21 |
3 files changed, 36 insertions, 13 deletions
diff --git a/camera/libcameraservice/CameraService.cpp b/camera/libcameraservice/CameraService.cpp index df59dcf..6419a5c 100644 --- a/camera/libcameraservice/CameraService.cpp +++ b/camera/libcameraservice/CameraService.cpp @@ -669,8 +669,14 @@ status_t CameraService::Client::startRecording() LOGD("startRecording (pid %d)", getCallingPid()); if (mMediaPlayerBeep.get() != NULL) { - mMediaPlayerBeep->seekTo(0); - mMediaPlayerBeep->start(); + // do not play record jingle if stream volume is 0 + // (typically because ringer mode is silent). + int index; + AudioSystem::getStreamVolumeIndex(AudioSystem::ENFORCED_AUDIBLE, &index); + if (index != 0) { + mMediaPlayerBeep->seekTo(0); + mMediaPlayerBeep->start(); + } } mHardware->enableMsgType(CAMERA_MSG_VIDEO_FRAME); @@ -888,8 +894,14 @@ void CameraService::Client::handleShutter( { // Play shutter sound. if (mMediaPlayerClick.get() != NULL) { - mMediaPlayerClick->seekTo(0); - mMediaPlayerClick->start(); + // do not play shutter sound if stream volume is 0 + // (typically because ringer mode is silent). + int index; + AudioSystem::getStreamVolumeIndex(AudioSystem::ENFORCED_AUDIBLE, &index); + if (index != 0) { + mMediaPlayerClick->seekTo(0); + mMediaPlayerClick->start(); + } } // Screen goes black after the buffer is unregistered. diff --git a/media/java/android/media/Ringtone.java b/media/java/android/media/Ringtone.java index 1713324..0ce3526 100644 --- a/media/java/android/media/Ringtone.java +++ b/media/java/android/media/Ringtone.java @@ -63,11 +63,13 @@ public class Ringtone { private AssetFileDescriptor mAssetFileDescriptor; private int mStreamType = AudioManager.STREAM_RING; + private AudioManager mAudioManager; private Context mContext; Ringtone(Context context) { mContext = context; + mAudioManager = (AudioManager) mContext.getSystemService(Context.AUDIO_SERVICE); } /** @@ -215,7 +217,11 @@ public class Ringtone { } } if (mAudio != null) { - mAudio.start(); + // do not ringtones if stream volume is 0 + // (typically because ringer mode is silent). + if (mAudioManager.getStreamVolume(mStreamType) != 0) { + mAudio.start(); + } } } diff --git a/services/java/com/android/server/NotificationManagerService.java b/services/java/com/android/server/NotificationManagerService.java index ff23a13..94aa458 100755 --- a/services/java/com/android/server/NotificationManagerService.java +++ b/services/java/com/android/server/NotificationManagerService.java @@ -704,6 +704,9 @@ class NotificationManagerService extends INotificationManager.Stub && (!(old != null && (notification.flags & Notification.FLAG_ONLY_ALERT_ONCE) != 0 )) && mSystemReady) { + + final AudioManager audioManager = (AudioManager) mContext + .getSystemService(Context.AUDIO_SERVICE); // sound final boolean useDefaultSound = (notification.defaults & Notification.DEFAULT_SOUND) != 0; @@ -722,18 +725,20 @@ class NotificationManagerService extends INotificationManager.Stub audioStreamType = DEFAULT_STREAM_TYPE; } mSoundNotification = r; - long identity = Binder.clearCallingIdentity(); - try { - mSound.play(mContext, uri, looping, audioStreamType); - } - finally { - Binder.restoreCallingIdentity(identity); + // do not play notifications if stream volume is 0 + // (typically because ringer mode is silent). + if (audioManager.getStreamVolume(audioStreamType) != 0) { + long identity = Binder.clearCallingIdentity(); + try { + mSound.play(mContext, uri, looping, audioStreamType); + } + finally { + Binder.restoreCallingIdentity(identity); + } } } // vibrate - final AudioManager audioManager = (AudioManager) mContext - .getSystemService(Context.AUDIO_SERVICE); final boolean useDefaultVibrate = (notification.defaults & Notification.DEFAULT_VIBRATE) != 0; if ((useDefaultVibrate || notification.vibrate != null) |