OSDN Git Service

Don't mix internal AVDTP state when connecting to two devices
authorPavlin Radoslavov <pavlin@google.com>
Fri, 18 May 2018 03:38:44 +0000 (20:38 -0700)
committerPavlin Radoslavov <pavlin@google.com>
Tue, 22 May 2018 17:31:32 +0000 (10:31 -0700)
commit1e71c20b14e69adae973fba405d53eb1bde556e2
treeb117a8b13e86cff9f5c05f02b988be2da5b9d325
parent90174f35148c69502beec0325c93bce931d6f8f6
Don't mix internal AVDTP state when connecting to two devices

There is a race condition when connecting to two devices, and
the connection to one of the devices is not powered on.

Because of the race condition, the wrong tBTA_AV_LCB entry inside
bta_av_sig_chg() might be allocated for the connection to
the device that is powered on. As a result of that, when
the connection attempt to the powered off device times out,
we will use the wrong bta_handle to close the existing AVDTP connection to
the device that is connected.

Also:
 - Add a new function BTA_AvObtainPeerChannelIndex() to select the
   appropriate AvdtpCcb entry if there an outgoing connection request
   while an incoming connection is received.
 - Added/updated log messages to help debugging similar issues in the future
 - Removed unnecessary SetActivePeer() call inside the BtifAv state
   machine for A2DP Source to avoid additional internal/transient glitches

Test: Manual
Bug: 79697137
Change-Id: Ie55e3dcf6c6a15637ce3631f2828548a2423d881
Merged-In: Ie55e3dcf6c6a15637ce3631f2828548a2423d881
(cherry picked from commit 1e2cab39a42542f12862df1cd47bf6d90853138b)
bta/av/bta_av_aact.cc
bta/av/bta_av_act.cc
bta/av/bta_av_int.h
bta/av/bta_av_main.cc
bta/include/bta_av_api.h
btif/src/btif_av.cc
stack/a2dp/a2dp_api.cc
stack/avdt/avdt_ccb.cc
stack/avdt/avdt_l2c.cc
stack/sdp/sdp_main.cc