hal: restore a2dp device for active usecases when out of suspended
Routing request to a2dp could come before a2dp out of suspended
thus the request is ignored, and audio continues on the last device.
Restore device to a2dp for all current active usecases if a2dp is
requsted before.
CRs-Fixed: 2063836
Change-Id: I43a9f65315dcf0ccd19cf30485c3093ec47853ca
diff --git a/hal/audio_extn/a2dp.c b/hal/audio_extn/a2dp.c
index cc53277..0c51ec0 100644
--- a/hal/audio_extn/a2dp.c
+++ b/hal/audio_extn/a2dp.c
@@ -794,6 +794,8 @@
a2dp.audio_suspend_stream();
} else if (a2dp.a2dp_suspended == true) {
ALOGD("Resetting a2dp suspend state");
+ struct audio_usecase *uc_info;
+ struct listnode *node;
if(a2dp.clear_a2dpsuspend_flag)
a2dp.clear_a2dpsuspend_flag();
a2dp.a2dp_suspended = false;
@@ -818,6 +820,13 @@
}
}
}
+ // restore A2DP device for active usecases
+ list_for_each(node, &a2dp.adev->usecase_list) {
+ uc_info = node_to_item(node, struct audio_usecase, list);
+ if ((uc_info->stream.out->devices & AUDIO_DEVICE_OUT_ALL_A2DP) &&
+ (uc_info->out_snd_device != SND_DEVICE_OUT_BT_A2DP))
+ select_devices(a2dp.adev, uc_info->id);
+ }
}
}
goto param_handled;