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

Commit 97ad2cd1 authored by Jean-Michel Trivi's avatar Jean-Michel Trivi
Browse files

No AudioFocus for notifications when media played remotely

Don't use AudioFocus when playing a notification when media is
 playing remotely. This behavior may be accompanied by
 rules in the device's audio policy to not route the notifications
 to the remote display.

Bug 7485803

Change-Id: I8b96aa59cace75f6e9a0e73799ef8c75e9ee97aa
parent d21267a2
Loading
Loading
Loading
Loading
+8 −6
Original line number Diff line number Diff line
@@ -90,6 +90,7 @@ public class NotificationPlayer implements OnCompletionListener {
                    player.prepare();
                    if ((mCmd.uri != null) && (mCmd.uri.getEncodedPath() != null)
                            && (mCmd.uri.getEncodedPath().length() > 0)) {
                        if (!audioManager.isMusicActiveRemotely()) {
                            if (mCmd.looping) {
                                audioManager.requestAudioFocus(null, mCmd.stream,
                                        AudioManager.AUDIOFOCUS_GAIN);
@@ -98,6 +99,7 @@ public class NotificationPlayer implements OnCompletionListener {
                                        AudioManager.AUDIOFOCUS_GAIN_TRANSIENT_MAY_DUCK);
                            }
                        }
                    }
                    player.setOnCompletionListener(NotificationPlayer.this);
                    player.start();
                    if (mPlayer != null) {