HFP: Redesign HeadsetStateMachine
* Remove unused variables and unused states for single connected device * Remove unnecessary default values * Use final keyword whenever we could * Move state transition broadcasts into enter() method of states * Created Disconnecting, AudioConnecting, AudioDisconnecting state to be more explicit about state tracking * Create HeadsetStateBase class to implement methods shared among all states such as state aware logging, previous state tracking and crash on illegal state transitions * Created ConnectedBase class to implement sharable methods among four connected states: Connected, AudioConnecting, AudioOn, AudioDisconnecting. They share common handler for functional messages besides connection events. * Created helper methods to translate event value to string * Created unit tests to verify every individual state transitions based on the state diagram drawn offline Bug: 68952425 Test: make, runtest bluetooth Change-Id: If2c8878e86a4c34fcc27b625dcd7a3153e8e0daa
Loading
Please register or sign in to comment