HFP: Add support for Multi-HFP (1/2)
* Create one HeadsetStateMachine for each HFP/HSP device during the following event: - CONNECT request sent from API - CONNECTION_STATE_CHANGED event from stack * Use a HashMap to manage these state machines * Removed synchronized label for methods in HeadsetService because state machines are lazy initialized instead of being created in the beginning * Remove code in HeadsetStateMachine that used to deal with multiple headset devices. Instead, move these logic to HeadsetService * System state update is sent to one device at a time from the Java layer and updates from HFP/HSP devices are synced among them * SCO audio is restricted to one device at a time * In-band ringtone is disabled when multiple devices are connected * Audio paramters are device specific and are cached within each device's state machine. It is only set to the audio framework in AudioOn state * Reject connection request when number of connections goes above limit * Added unit tests for HeadsetService to test multi-device scenario * Add HeadsetObjectsFactory to ease mocking during unit tests Bug: 68952570 Test: runtest -j40 bluetooth, native unit tests, HFP regression for 1 device, simple tests for multiple devices Change-Id: Id22c5cbddfc4f9f95e35f035fcab6c4a5d797ebf
Loading
Please register or sign in to comment