Android-x86
Fork
Donation

  • R/O
  • HTTP
  • SSH
  • HTTPS

packages-apps-AlarmClock: Commit

packages/apps/AlarmClock


Commit MetaInfo

Revision37a8d1bf4744287d078836e105e01391cf7fe2e8 (tree)
Time2009-11-27 22:09:58
AuthorEric Laurent <elaurent@goog...>
CommiterEric Laurent

Log Message

Fix issue 2192673: Music Pausing Even when notifications are set to silent.

Do not play alarms if alarm stream volume is 0.

Change Summary

Incremental Difference

--- a/src/com/android/alarmclock/AlarmKlaxon.java
+++ b/src/com/android/alarmclock/AlarmKlaxon.java
@@ -229,10 +229,15 @@ public class AlarmKlaxon extends Service {
229229 private void startAlarm(MediaPlayer player)
230230 throws java.io.IOException, IllegalArgumentException,
231231 IllegalStateException {
232- player.setAudioStreamType(AudioManager.STREAM_ALARM);
233- player.setLooping(true);
234- player.prepare();
235- player.start();
232+ final AudioManager audioManager = (AudioManager)getSystemService(Context.AUDIO_SERVICE);
233+ // do not play alarms if stream volume is 0
234+ // (typically because ringer mode is silent).
235+ if (audioManager.getStreamVolume(AudioManager.STREAM_ALARM) != 0) {
236+ player.setAudioStreamType(AudioManager.STREAM_ALARM);
237+ player.setLooping(true);
238+ player.prepare();
239+ player.start();
240+ }
236241 }
237242
238243 private void setDataSourceFromResource(Resources resources,
Show on old repository browser