audio policy: handle errors for usb broadcast device connection
When the USB is quickly connected and then disconnected, the broadcast device may not have enough time to read the USB info, preventing the dynamic profile from being created and causing routing errors. Therefore, when the usb broadcast device connection fails, setDeviceConnectionState will be interrupted
Bug: 360284877
Test:
Atest AudioPolicyManagerTestDeviceConnectionFailed
Change-Id: I3bd31f1455cfaf9f1041cf079b92b6b407c3a74e
diff --git a/services/audiopolicy/managerdefault/AudioPolicyManager.h b/services/audiopolicy/managerdefault/AudioPolicyManager.h
index c8cced6..257d328 100644
--- a/services/audiopolicy/managerdefault/AudioPolicyManager.h
+++ b/services/audiopolicy/managerdefault/AudioPolicyManager.h
@@ -1077,8 +1077,8 @@
// It can give a chance to HAL implementer to retrieve dynamic capabilities associated
// to this device for example.
// TODO avoid opening stream to retrieve capabilities of a profile.
- void broadcastDeviceConnectionState(const sp<DeviceDescriptor> &device,
- media::DeviceConnectedState state);
+ status_t broadcastDeviceConnectionState(const sp<DeviceDescriptor> &device,
+ media::DeviceConnectedState state);
// updates device caching and output for streams that can influence the
// routing of notifications