OSDN Git Service

A2DP: Be more careful in allocating a BtifAvPeer instance
authorCheney Ni <cheneyni@google.com>
Fri, 27 Mar 2020 03:54:28 +0000 (11:54 +0800)
committerCheney Ni <cheneyni@google.com>
Tue, 14 Apr 2020 09:43:46 +0000 (17:43 +0800)
commitf92966049c67cae0edcea4e8d5648579512d79c1
treeb13d90b9bff34483f70924001bbfaae966468dcf
parente134c6f179a319d648dcad2715f2e9c3a1e6c3b8
A2DP: Be more careful in allocating a BtifAvPeer instance

While a new peer is coming either by in-coming or out-going connection,
the stack first tries to find or create an associated BtifAvPeer object
for it, but uses an unknown BTA handle if BTA_AV is still registering.
This handle will be updated after BTA_AV registered, but causes
a mismatch in the handle usage between BTIF and BTA layers since the
register process just finished. This change disallows to use an unknown
BTA handle, so it prevents such abnormal cases. Besides, it adds more
log messages about BTA_AV registering, and also makes sure the disabling
flag won't be activated after disabled.

Bug: 135655859
Bug: 152597903
Test: Switch BT state quickly between STATE_BLE_ON and STATE_ON
Change-Id: I9df3d64f301dffbecdeaf3de18dd455be1c63ce2
Merged-In: I9df3d64f301dffbecdeaf3de18dd455be1c63ce2
(cherry picked from commit 714e639cb7291ecfb9feb12acad9bc7c8f455ba0)
bta/ar/bta_ar.cc
bta/av/bta_av_act.cc
bta/av/bta_av_main.cc
btif/src/btif_av.cc