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
Showing
- system/bta/ag/bta_ag_act.cc 53 additions, 21 deletionssystem/bta/ag/bta_ag_act.cc
- system/bta/ag/bta_ag_int.h 3 additions, 1 deletionsystem/bta/ag/bta_ag_int.h
- system/bta/ag/bta_ag_main.cc 37 additions, 77 deletionssystem/bta/ag/bta_ag_main.cc
- system/btif/src/btif_hf.cc 6 additions, 5 deletionssystem/btif/src/btif_hf.cc
- system/stack/rfcomm/port_utils.cc 3 additions, 4 deletionssystem/stack/rfcomm/port_utils.cc
- system/stack/test/rfcomm/stack_rfcomm_test.cc 177 additions, 0 deletionssystem/stack/test/rfcomm/stack_rfcomm_test.cc
Loading
Please register or sign in to comment