From d4710b90122a37d75963bbe568f60c8ba10f67ef Mon Sep 17 00:00:00 2001 From: Satish Kodishala Date: Thu, 4 Feb 2016 09:35:59 +0530 Subject: [PATCH] Update hf structure on phone state change only if SLC is up Usecase: 1. Enable multi-hf 2. Pair and connect A2DP to a headset(hs1). 3. Pair and connect HFP to another headset(hs2) 4. Accept call on AG 5. Disconnect hs2 by powering off headset 6. Disconnect the call 7. Power on the hs2 Failure: No A2DP playback on hs1 though music player is playing. Rootcause: When there is a call on AG, we update both hf structures about the call. However, when any headset gets disconnected, only its hf structure is cleared. After the call is ended, we don't clear hf structures since there is no hf connection. When A2DP queries for active call, we return true incorrectly since the hs1's structures are not updated when the call is ended. Fix: Update hf structures on phone state change only if SLC is connected on it. Updating both hf structures regardless of the SLC state causes hf state to indicate wrong status. Test: manual Change-Id: I487792038d97a2bac77639d7c699f49fc0b18f97 --- btif/src/btif_hf.cc | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/btif/src/btif_hf.cc b/btif/src/btif_hf.cc index 2646a56f6..cc0deb8bb 100644 --- a/btif/src/btif_hf.cc +++ b/btif/src/btif_hf.cc @@ -1498,9 +1498,12 @@ static bt_status_t phone_state_change(int num_active, int num_held, bthf_call_st update_call_states: for (i = 0; i < btif_max_hf_clients; i++) { - btif_hf_cb[i].num_active = num_active; - btif_hf_cb[i].num_held = num_held; - btif_hf_cb[i].call_setup_state = call_setup_state; + if (btif_hf_cb[i].state == BTHF_CONNECTION_STATE_SLC_CONNECTED) + { + btif_hf_cb[i].num_active = num_active; + btif_hf_cb[i].num_held = num_held; + btif_hf_cb[i].call_setup_state = call_setup_state; + } } return status; } -- 2.11.0