Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d6b68fe8 authored by Amitesh Chandra's avatar Amitesh Chandra
Browse files

Switch AV link to Master if any other ACL (including LE connection) is up

The current code switches AV link to Master role if another
BR/EDR connection exists. This logic explicitly skips the LE link.
This is a legacy that did not fully take into consideration the LE link capabilities.
Include both BR/EDR and LE links to determine role requirements.

Change-Id: Id5feb3492551b95de8136cf91cea8fca9779fb8d
bugid: 190578912
Test: A2DP tests with mutiple HoGP and HID links
parent a18be026
Loading
Loading
Loading
Loading
+3 −4
Original line number Diff line number Diff line
@@ -2683,16 +2683,15 @@ static void bta_dm_remove_sec_dev_entry(const RawAddress& remote_bd_addr) {
 ******************************************************************************/
static void bta_dm_adjust_roles(bool delay_role_switch) {
  uint8_t i;
  uint8_t br_count =
      bta_dm_cb.device_list.count - bta_dm_cb.device_list.le_count;
  if (br_count) {
  uint8_t link_count = bta_dm_cb.device_list.count;
  if (link_count) {
    for (i = 0; i < bta_dm_cb.device_list.count; i++) {
      if (bta_dm_cb.device_list.peer_device[i].conn_state == BTA_DM_CONNECTED &&
          bta_dm_cb.device_list.peer_device[i].transport ==
              BT_TRANSPORT_BR_EDR) {
        if ((bta_dm_cb.device_list.peer_device[i].pref_role ==
             BTA_CENTRAL_ROLE_ONLY) ||
            (br_count > 1)) {
            (link_count > 1)) {
          /* Initiating immediate role switch with certain remote devices
            has caused issues due to role  switch colliding with link encryption
            setup and