hal: route to speaker, when USB HS is unplugged
When USB headset is disconnected the music platback paused
and the policy manager send routing=0. If USB headset is
connected before the standby time, AFE is not closed and opened,
so routing to speker will guarantee AFE reconfiguration and
AFE will be opend once USB is connected again, within standby
time.
CRs-fixed: 2219129
Change-Id: I69985dda312de34e2c86c85ac448a722f7f31f42
diff --git a/hal/audio_extn/usb.c b/hal/audio_extn/usb.c
index 8766c0e..2af255b 100644
--- a/hal/audio_extn/usb.c
+++ b/hal/audio_extn/usb.c
@@ -1151,6 +1151,26 @@
return access(path, F_OK) == 0;
}
+bool audio_extn_usb_connected(struct str_parms *parms) {
+ int card;
+ struct listnode *node_i;
+ struct usb_card_config *usb_card_info;
+ bool usb_connected = false;
+
+ if (str_parms_get_int(parms, "card", &card) >= 0) {
+ usb_connected = audio_extn_usb_alive(card);
+ } else {
+ list_for_each(node_i, &usbmod->usb_card_conf_list) {
+ usb_card_info = node_to_item(node_i, struct usb_card_config, list);
+ if (audio_extn_usb_alive(usb_card_info->usb_card)) {
+ usb_connected = true;
+ break;
+ }
+ }
+ }
+ return usb_connected;
+}
+
void audio_extn_usb_init(void *adev)
{
if (usbmod == NULL) {