Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 98379599 authored by Eric Laurent's avatar Eric Laurent
Browse files

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

Do not play alarms if alarm stream volume is 0.
parent ddacabc2
Loading
Loading
Loading
Loading
+9 −4
Original line number Diff line number Diff line
@@ -229,11 +229,16 @@ public class AlarmKlaxon extends Service {
    private void startAlarm(MediaPlayer player)
            throws java.io.IOException, IllegalArgumentException,
                   IllegalStateException {
        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,
            MediaPlayer player, int res) throws java.io.IOException {