OSDN Git Service

Correcting sniff behaviour in multi-connection scenario
authorMatadeen Mishra <matade@codeaurora.org>
Mon, 1 Feb 2016 13:50:54 +0000 (19:20 +0530)
committerAndre Eisenbach <eisenbach@google.com>
Fri, 4 Mar 2016 19:26:13 +0000 (19:26 +0000)
Use case: When multiple profiles are connected on same link and if any one of the
profiles deregisters with powermanager, powermanager will initiate a sniff when it
removes the timer for one profile, even if a timeout did not trigger for other profiles.

Steps:
1. Turn on BT
2. Pair with Mi band (Wearable device)
3. Pair with carkit
4. Turn off BT
5. Turn on BT
HF and A2DP connection should successful after BT on to carkit.

Failure: HF connection fails.

Root Cause: powermanager initiates a sniff when it removes the timer for one profile
Even if a timeout did not trigger for other profiles.

Fix: When multiple profiles connect on the same link and if any one profile
deregisters with powermanager, pm should stop the timer for that profile
and restart the other profiles timers.

Change-Id: I8e215a9d868291976c70ff32b61145b4360a7f8f

bta/dm/bta_dm_pm.c

index ea19d35..bbd4fed 100644 (file)
@@ -345,6 +345,7 @@ static void bta_dm_pm_cback(tBTA_SYS_CONN_STATUS status, UINT8 id, UINT8 app_id,
     UINT8 i,j;
     UINT8 *p = NULL;
     tBTA_DM_PEER_DEVICE *p_dev;
+    tBTA_DM_PM_REQ  pm_req = BTA_DM_PM_NEW_REQ;
 
 #if (BTM_SSR_INCLUDED == TRUE)
     int               index = BTA_DM_PM_SSR0;
@@ -450,6 +451,11 @@ static void bta_dm_pm_cback(tBTA_SYS_CONN_STATUS status, UINT8 id, UINT8 app_id,
 
     /* stop timer */
     bta_dm_pm_stop_timer(peer_addr);
+    if (bta_dm_conn_srvcs.count > 0) {
+        pm_req = BTA_DM_PM_RESTART;
+        APPL_TRACE_DEBUG("%s bta_dm_pm_stop_timer for current service, restart other "
+           "service timers: count = %d", __func__, bta_dm_conn_srvcs.count);
+    }
 
     if(p_dev)
     {
@@ -486,7 +492,7 @@ static void bta_dm_pm_cback(tBTA_SYS_CONN_STATUS status, UINT8 id, UINT8 app_id,
     }
 #endif
 
-    bta_dm_pm_set_mode(peer_addr, BTA_DM_PM_NO_ACTION, BTA_DM_PM_NEW_REQ);
+    bta_dm_pm_set_mode(peer_addr, BTA_DM_PM_NO_ACTION, pm_req);
 
     /* perform the HID link workaround if needed
     ** 1. If SCO up/down event is received OR