AudioPolicyManager: distinguish between mirroring and rerouting
In the screen mirroring case, the notification manager queries
the policy to see if media "is playing remotely": if yes, it
will not request audio focus before playing a notification.
This is the correct behavior for screen mirroring, but doesn't
work when audio is rerouted to an external policy.
This change consists in not reporting "remote" activity when
playing to a mix of an external policy by looking at the address
of the output on which playback is active for the given stream
type.
Bug 16009464
Change-Id: Iebbf5a8c738ab36c1cf2055e921c0a3472503125
diff --git a/services/audiopolicy/AudioPolicyManager.h b/services/audiopolicy/AudioPolicyManager.h
index 4214131..3eef8fe 100644
--- a/services/audiopolicy/AudioPolicyManager.h
+++ b/services/audiopolicy/AudioPolicyManager.h
@@ -155,6 +155,8 @@
// return whether a stream is playing remotely, override to change the definition of
// local/remote playback, used for instance by notification manager to not make
// media players lose audio focus when not playing locally
+ // For the base implementation, "remotely" means playing during screen mirroring which
+ // uses an output for playback with a non-empty, non "0" address.
virtual bool isStreamActiveRemotely(audio_stream_type_t stream, uint32_t inPastMs = 0) const;
virtual bool isSourceActive(audio_source_t source) const;