hal: Avoid A2dp route updation for delayed a2dp/hfp disconnect
- Existing code routes to speaker until stream goes to
standby on A2dp disconnect. This is done to not block
writes from audioflinger.
- Consider a dual a2dp/hfp scenario with A2dp connected
and hfp being constantly reconnected.
- In failure case, routing=0 from hfp disconnect comes in
late i.e. during hfp reconnect. Stream is resumed and
until hfp connect is processed, it is routed to speaker.
- Fix this by not routing to speaker if A2dp has not
disconnected by checking lower stack.
Change-Id: Idd6c827a391777e943b3d59f33f8f4e98f98e802
diff --git a/hal/audio_hw.c b/hal/audio_hw.c
index 6097028..dca1602 100644
--- a/hal/audio_hw.c
+++ b/hal/audio_hw.c
@@ -3596,7 +3596,8 @@
* Avoid this by routing audio to speaker until standby.
*/
if ((out->devices & AUDIO_DEVICE_OUT_ALL_A2DP) &&
- (val == AUDIO_DEVICE_NONE)) {
+ (val == AUDIO_DEVICE_NONE) &&
+ !audio_extn_a2dp_is_ready()) {
val = AUDIO_DEVICE_OUT_SPEAKER;
}
/* To avoid a2dp to sco overlapping / BT device improper state