OSDN Git Service

HFP: Fix connection colision handling
authorJack He <siyuanh@google.com>
Mon, 23 Apr 2018 00:30:14 +0000 (17:30 -0700)
committerJack He <siyuanh@google.com>
Thu, 26 Apr 2018 08:38:41 +0000 (08:38 +0000)
commitb690c22637e522acdd8aebcd18699abc5dd0425c
tree9209cf02101184ffd243d940aa963c26fe88565a
parent272534fc2ce4433c89352d84fb07a5a8fc52ed50
HFP: Fix connection colision handling

* When there is a connection collison, and remote device is trying to
  connect to HFP server channel while we try to connect to remote's
  server channel as a client. If the remote device succssfully connect
  to us, we should drop our connection request to remote device and
  accept remote device's connection request. As result, we will observe
  1. Our connection request fails, this propagate up to Java layer and
  also clean up any states in these layers
  2. Remote connection request succeeds, this propagate up to Java layer
     as well as a new incoming connection
* Added BTA_AG_COLLISION_EVT to formally handle AG collision in state
  machine
* Modified bta_ag_resume_open to re-send BTA_AG_API_OPEN_EVT instead of
  modifying the state machine state directly. State machine states
  should only be modified by state machine handler
* Ignore RFCOMM open event if PORT_CheckConnection fails
* Added StackRfcommTest.TestConnectionCollision to reproduce this
  scenario with 100% certainty
* Add static checks to HFP BTA state machine to make sure action and
  event indices match enum sizes

Bug: 77224743
Test: connect to multiple remote devices with HFP, MAP and PBAP
      StackRfcommTest.TestConnectionCollision
      btestplans/details/158641/3975
Change-Id: Ib3652784b123abe195e7bd30421ef5f4345b1d4d
Merged-In: Ib3652784b123abe195e7bd30421ef5f4345b1d4d
(cherry picked from commit 88cc85a086bf90e1e669fd689276c6e658286af2)
bta/ag/bta_ag_act.cc
bta/ag/bta_ag_int.h
bta/ag/bta_ag_main.cc
btif/src/btif_hf.cc
stack/rfcomm/port_utils.cc
stack/test/rfcomm/stack_rfcomm_test.cc