Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Skip to content
Commit 7b52eb75 authored by Pavlin Radoslavov's avatar Pavlin Radoslavov
Browse files

Update the A2dpService logic for creating/deleting state machine instances

* Create a new state machine instance for native stack events only if the
  event is CONNECTION_STATE_CONNECTED or CONNECTION_STATE_CONNECTING
* Add an early check to reject connect() request if there are too many
  connected devices.
* Fixed the logic inside updateOptionalCodecsSupport() so it cannot
  create a new state machine instance
* Unbonding a device will remove the state machine instance only
  if the device is disconnected
* If a device is disconnected, remove the state machine if
  the device is already unbond

Also:
 * Renamed canConnectToDevice() to connectionAllowedCheckMaxDevices()
 * Add new method A2dpService.getDevices() - used only for testing
 * Add a missing transition in the A2dpStateMachine from Connected
   to Disconnecting on A2dpStackEvent.CONNECTION_STATE_DISCONNECTING
   event.
 * Fix the logic for checking the maximum number of state machines
   to avoid DoS attack
 * Add checks that bond state events and native stack events
   contain a device
 * Change the A2dpServiceTest setting to use MAX_CONNECTED_AUDIO_DEVICES
   of 5 by default.
 * Add internal mechanism in A2dpServiceTest to
   - waitForNoIntent() - Wait and verify that no intent has been received
   - verifyNoConnectionStateIntent() - Wait and verify that no connection
     state intent has been received
 * Add unit tests:
   - testOutgoingConnectPriorityOff()
   - testMaxConnectDevices()
   - testCreateStateMachineStackEvents()
   - testDeleteStateMachineUnbondEvents()
   - testDeleteStateMachineDisconnectEvents()
 * Add a new helper method TestUtils.getTestDevice()
 * Minor cleanup: arguments renaming, etc.

Bug: 73212853
Test: Unit tests added:
    runtest bluetooth --test-class com.android.bluetooth.a2dp.A2dpServiceTest
Change-Id: I484fcc04b7ce800df1a0e1cf8930816edae6ab91
parent fd9c6bb4
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment