audio policy: LE audio broadcast routing policy
Implement routing policy for LE audio broadcast device.
LE audio broadcast device is only used if:
- No call is active
- Either MEDIA or SONIFICATION_RESPECTFUL is the highest priority active strategy
OR the LE audio unicast device is not active
Bug: 213188698
Test: make
Change-Id: I47eb42066fe41c01867c35b1256241037583420b
diff --git a/services/audiopolicy/managerdefault/AudioPolicyManager.h b/services/audiopolicy/managerdefault/AudioPolicyManager.h
index 68ae8cb..3d77924 100644
--- a/services/audiopolicy/managerdefault/AudioPolicyManager.h
+++ b/services/audiopolicy/managerdefault/AudioPolicyManager.h
@@ -597,9 +597,9 @@
audio_mode_t getPhoneState();
// true if device is in a telephony or VoIP call
- virtual bool isInCall();
+ virtual bool isInCall() const;
// true if given state represents a device in a telephony or VoIP call
- virtual bool isStateInCall(int state);
+ virtual bool isStateInCall(int state) const;
// true if playback to call TX or capture from call RX is possible
bool isCallAudioAccessible();
@@ -886,6 +886,21 @@
void closeActiveClients(const sp<AudioInputDescriptor>& input);
void closeClient(audio_port_handle_t portId);
+ /**
+ * @brief isAnyDeviceTypeActive: returns true if at least one active client is routed to
+ * one of the specified devices
+ * @param deviceTypes list of devices to consider
+ */
+ bool isAnyDeviceTypeActive(const DeviceTypeSet& deviceTypes) const;
+ /**
+ * @brief isLeUnicastActive: returns true if a call is active or at least one active client
+ * is routed to a LE unicast device
+ */
+ bool isLeUnicastActive() const;
+
+ void checkLeBroadcastRoutes(bool wasUnicastActive,
+ sp<SwAudioOutputDescriptor> ignoredOutput, uint32_t delayMs);
+
const uid_t mUidCached; // AID_AUDIOSERVER
AudioPolicyClientInterface *mpClientInterface; // audio policy client interface
sp<SwAudioOutputDescriptor> mPrimaryOutput; // primary output descriptor