OSDN Git Service

Reduce persistence on aquiring master role
authorMattias Agren <magren@broadcom.com>
Wed, 14 Oct 2015 15:05:58 +0000 (17:05 +0200)
committerScott James Remnant <keybuk@google.com>
Mon, 23 Nov 2015 20:12:55 +0000 (12:12 -0800)
Whenever a device has more than 1 ACL link active and transferring
data on one of its links via PAN, HH or JV (RFCOMM) the sys busy/idle
state toggles frequently. To avoid triggering role switches for each
of these events we filter this out and let the other SYS events handle
it in combination with other role policy management code. Ideally we
should revert the toggling to properly reflect the busy/idle state of
each profile but to limit risk of side effects at this stage we will
make this intermittent change.

This also affects audio streaming in certain cases.

Bug: 2457095925129209
Change-Id: I141e17ee069c82624e153fd8de5db90ae93724b9

bta/dm/bta_dm_act.c

index af879b7..a34a2c9 100644 (file)
@@ -3513,7 +3513,6 @@ static void bta_dm_disable_conn_down_timer_cback(timer_entry_t *p_te)
 *******************************************************************************/
 static void bta_dm_rm_cback(tBTA_SYS_CONN_STATUS status, UINT8 id, UINT8 app_id, BD_ADDR peer_addr)
 {
-
     UINT8 j;
     tBTA_PREF_ROLES role;
     tBTA_DM_PEER_DEVICE *p_dev;
@@ -3567,7 +3566,11 @@ static void bta_dm_rm_cback(tBTA_SYS_CONN_STATUS status, UINT8 id, UINT8 app_id,
         APPL_TRACE_WARNING("bta_dm_rm_cback:%d, status:%d", bta_dm_cb.cur_av_count, status);
     }
 
-    bta_dm_adjust_roles(FALSE);
+    /* Don't adjust roles for each busy/idle state transition to avoid
+       excessive switch requests when individual profile busy/idle status
+       changes */
+    if ((status != BTA_SYS_CONN_BUSY) && (status != BTA_SYS_CONN_IDLE))
+        bta_dm_adjust_roles(FALSE);
 }
 
 /*******************************************************************************