Browse files

am 96dba44: am 6a6687b: am 37a8d1b: Fix issue 2192673: Music Pausing …

…Even when notifications are set to silent.

Merge commit '96dba44972a593f4e876a8297d5584434b9a0de0'

* commit '96dba44972a593f4e876a8297d5584434b9a0de0':
  Fix issue 2192673: Music Pausing Even when notifications are set to silent.
  • Loading branch information...
2 parents 2d2d89c + 96dba44 commit bf0314d772e1a471a57039d8965b9d1d1e2c4210 Eric Laurent committed with Android Git Automerger Dec 1, 2009
Showing with 9 additions and 4 deletions.
  1. +9 −4 src/com/android/alarmclock/AlarmKlaxon.java
View
13 src/com/android/alarmclock/AlarmKlaxon.java
@@ -229,10 +229,15 @@ public boolean onError(MediaPlayer mp, int what, int extra) {
private void startAlarm(MediaPlayer player)
throws java.io.IOException, IllegalArgumentException,
IllegalStateException {
- player.setAudioStreamType(AudioManager.STREAM_ALARM);
- player.setLooping(true);
- player.prepare();
- player.start();
+ final AudioManager audioManager = (AudioManager)getSystemService(Context.AUDIO_SERVICE);
+ // do not play alarms if stream volume is 0
+ // (typically because ringer mode is silent).
+ if (audioManager.getStreamVolume(AudioManager.STREAM_ALARM) != 0) {
+ player.setAudioStreamType(AudioManager.STREAM_ALARM);
+ player.setLooping(true);
+ player.prepare();
+ player.start();
+ }
}
private void setDataSourceFromResource(Resources resources,

0 comments on commit bf0314d

Please sign in to comment.