From 31d1a2b52507df33f13d19ed2349585dfa490542 Mon Sep 17 00:00:00 2001 From: Matadeen Mishra Date: Mon, 1 Feb 2016 19:20:54 +0530 Subject: [PATCH] Correcting sniff behaviour in multi-connection scenario 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 | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/bta/dm/bta_dm_pm.c b/bta/dm/bta_dm_pm.c index ea19d3593..bbd4fed54 100644 --- a/bta/dm/bta_dm_pm.c +++ b/bta/dm/bta_dm_pm.c @@ -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 -- 2.11.0