Add support for Multi-A2DP state machines per device

* Remove mStateMachine and use a single A2dpStateMachine instance per device
* Cleanup/simplify A2dpStateMachine internals - the BluetoothDevice per
  state machine doesn't change.
* Send the state changed broadcast message on enter() in a new state
  This fixes timing ordering issue exposed by some of the unit tests
* Remove a state machine when bonding for a device is removed
* Add a mechanism to set the active device
* Add a mechanism to track the maximum number of connected devices
* Updated the codec-related APIs to take a BluetoothDevice argument:
  - getCodecStatus()
  - setCodecConfigPrefereice()
  - enableOptionalCodecs()
  - disableOptionalCodecs()
* Add A2dpServiceTest unit tests for A2dpService
* Add ActiveDeviceManager that is responsible for keeping track of the
  connected devices and select which device is active.

Also:
* Updated the JNI codec-related calls to use const reference
  instead of a pointer
* Additional cleanup

Bug: 69269748
Test: Manual and unit tests
Change-Id: If379f0aa1403de09c485d4adb0dfdfe73190cbf9
Merged-In: If379f0aa1403de09c485d4adb0dfdfe73190cbf9
(cherry picked from commit bf9a5b6474c393b0172a74eb64fdad060cdb0f94)
11 files changed
tree: 38494c5d0b225db5a3dea01f21ca7a1547da9fd6
  1. android/