Add missing A2dpStateMachine lookup when processing native events
Fixed a bug in the code after messageFromNative() was refactored
to create state machine entries only when connecting to a device.
Because of that bug, some events (Audio State and Codec Changed updates)
were not processed properly.
Also added unit test to capture similar issues in the future:
Test: Manual with switching codec configuration in Developer options
Unit test:
runtest bluetooth --test-class com.android.bluetooth.a2dp.A2dpServiceTest \
--test-method testProcessAudioStateChangedCodecConfigChangedEvents
Bug: 73379307
Change-Id: I58f42acb4e7e0d312a04ede49d7538c42e210333
2 files changed