Merge change I524dc046 into eclair
* changes: Fix issue 2192673: Music Pausing Even when notifications are set to silent.
This commit is contained in:
@ -669,8 +669,14 @@ status_t CameraService::Client::startRecording()
|
|||||||
LOGD("startRecording (pid %d)", getCallingPid());
|
LOGD("startRecording (pid %d)", getCallingPid());
|
||||||
|
|
||||||
if (mMediaPlayerBeep.get() != NULL) {
|
if (mMediaPlayerBeep.get() != NULL) {
|
||||||
mMediaPlayerBeep->seekTo(0);
|
// do not play record jingle if stream volume is 0
|
||||||
mMediaPlayerBeep->start();
|
// (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);
|
mHardware->enableMsgType(CAMERA_MSG_VIDEO_FRAME);
|
||||||
@ -888,8 +894,14 @@ void CameraService::Client::handleShutter(
|
|||||||
{
|
{
|
||||||
// Play shutter sound.
|
// Play shutter sound.
|
||||||
if (mMediaPlayerClick.get() != NULL) {
|
if (mMediaPlayerClick.get() != NULL) {
|
||||||
mMediaPlayerClick->seekTo(0);
|
// do not play shutter sound if stream volume is 0
|
||||||
mMediaPlayerClick->start();
|
// (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.
|
// Screen goes black after the buffer is unregistered.
|
||||||
|
@ -63,11 +63,13 @@ public class Ringtone {
|
|||||||
private AssetFileDescriptor mAssetFileDescriptor;
|
private AssetFileDescriptor mAssetFileDescriptor;
|
||||||
|
|
||||||
private int mStreamType = AudioManager.STREAM_RING;
|
private int mStreamType = AudioManager.STREAM_RING;
|
||||||
|
private AudioManager mAudioManager;
|
||||||
|
|
||||||
private Context mContext;
|
private Context mContext;
|
||||||
|
|
||||||
Ringtone(Context context) {
|
Ringtone(Context context) {
|
||||||
mContext = context;
|
mContext = context;
|
||||||
|
mAudioManager = (AudioManager) mContext.getSystemService(Context.AUDIO_SERVICE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -209,7 +211,11 @@ public class Ringtone {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (mAudio != null) {
|
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();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -704,6 +704,9 @@ class NotificationManagerService extends INotificationManager.Stub
|
|||||||
&& (!(old != null
|
&& (!(old != null
|
||||||
&& (notification.flags & Notification.FLAG_ONLY_ALERT_ONCE) != 0 ))
|
&& (notification.flags & Notification.FLAG_ONLY_ALERT_ONCE) != 0 ))
|
||||||
&& mSystemReady) {
|
&& mSystemReady) {
|
||||||
|
|
||||||
|
final AudioManager audioManager = (AudioManager) mContext
|
||||||
|
.getSystemService(Context.AUDIO_SERVICE);
|
||||||
// sound
|
// sound
|
||||||
final boolean useDefaultSound =
|
final boolean useDefaultSound =
|
||||||
(notification.defaults & Notification.DEFAULT_SOUND) != 0;
|
(notification.defaults & Notification.DEFAULT_SOUND) != 0;
|
||||||
@ -722,18 +725,20 @@ class NotificationManagerService extends INotificationManager.Stub
|
|||||||
audioStreamType = DEFAULT_STREAM_TYPE;
|
audioStreamType = DEFAULT_STREAM_TYPE;
|
||||||
}
|
}
|
||||||
mSoundNotification = r;
|
mSoundNotification = r;
|
||||||
long identity = Binder.clearCallingIdentity();
|
// do not play notifications if stream volume is 0
|
||||||
try {
|
// (typically because ringer mode is silent).
|
||||||
mSound.play(mContext, uri, looping, audioStreamType);
|
if (audioManager.getStreamVolume(audioStreamType) != 0) {
|
||||||
}
|
long identity = Binder.clearCallingIdentity();
|
||||||
finally {
|
try {
|
||||||
Binder.restoreCallingIdentity(identity);
|
mSound.play(mContext, uri, looping, audioStreamType);
|
||||||
|
}
|
||||||
|
finally {
|
||||||
|
Binder.restoreCallingIdentity(identity);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// vibrate
|
// vibrate
|
||||||
final AudioManager audioManager = (AudioManager) mContext
|
|
||||||
.getSystemService(Context.AUDIO_SERVICE);
|
|
||||||
final boolean useDefaultVibrate =
|
final boolean useDefaultVibrate =
|
||||||
(notification.defaults & Notification.DEFAULT_VIBRATE) != 0;
|
(notification.defaults & Notification.DEFAULT_VIBRATE) != 0;
|
||||||
if ((useDefaultVibrate || notification.vibrate != null)
|
if ((useDefaultVibrate || notification.vibrate != null)
|
||||||
|
Reference in New Issue
Block a user