OSDN Git Service

A2DP: Don't wait for role switch on a blacklisted device
authorCheney Ni <cheneyni@google.com>
Wed, 25 Sep 2019 13:33:25 +0000 (21:33 +0800)
committerMyles Watson <mylesgw@google.com>
Thu, 26 Sep 2019 15:43:52 +0000 (15:43 +0000)
When there are 2 or more ACL links, we will try to be the master for
better link quality, and setup flags to wait for the following role
switch results. Because this is an asynchronous task, we would check
flags for any further actions. However, there would not be other results
for role switch IOP, and could be just ignored.

Bug: 141177108
Test: Add headset to IOP and do A2DP playback manually
Change-Id: I0d9e92968765365410909908ffcaf6dc81161ea0

bta/av/bta_av_main.cc

index ef281a0..957760c 100644 (file)
@@ -1114,8 +1114,10 @@ bool bta_av_link_role_ok(tBTA_AV_SCB* p_scb, uint8_t bits) {
                   "%s: peer %s BTM_SwitchRole(BTM_ROLE_MASTER) error: %d",
                   __func__, p_scb->PeerAddress().ToString().c_str(), status);
       }
-      is_ok = false;
-      p_scb->wait |= BTA_AV_WAIT_ROLE_SW_RES_START;
+      if (status != BTM_DEV_BLACKLISTED) {
+        is_ok = false;
+        p_scb->wait |= BTA_AV_WAIT_ROLE_SW_RES_START;
+      }
     }
   }