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
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;
}