OSDN Git Service

Update hf structure on phone state change only if SLC is up
authorSatish Kodishala <skodisha@codeaurora.org>
Thu, 4 Feb 2016 04:05:59 +0000 (09:35 +0530)
committerAndre Eisenbach <eisenbach@google.com>
Fri, 14 Oct 2016 20:14:25 +0000 (20:14 +0000)
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

index 2646a56..cc0deb8 100644 (file)
@@ -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;
 }