Fix speakerphone logic when connecting/disconnecting dock.
The previous Telecom logic enabled speakerphone in the base speaker state,
which meant that both Quiescent and Active speaker state would result in
the global speaker state changing.
Moved logic to enable speakerphone to the ActiveSpeakerState.
When dock connects/disconnects while in QuiescentEarpieceState, switch to
QuiescentSpeakerState to ensure when a call starts we CAN use the speaker.
Also, added some better logging in CallAudioRouteStateMachine so we can
see the current state in the telecom dumpsys.
Test: Added CallAudioRouteStateMachineTest#testDockWhenInQuiescentState which verifies connect/disconnect dock behavior while idle does not activate speaker phone.
Test: Added CallAudioRouteTransitionTests to verify correct audio mode transitions when docking/undocking.
Test: Manual test; ran adb shell dumpsys DockObserver set state 3 while idle and verified that telecom dumpsys reports QuiesecentSpeakerState.
Test: Manual test; ran adb shell dumpsys DockObserver set state 0 while idle and verified telecom dumpsys reports QuiescentEarpiece state.
Test: Manual test; start call, ran adb shell dumpsys DockObserver set state 3 to enter dock; verified call enters speaker.
Test: Manual test; from previous manual test ran adb shell dumpsys DockObserver set state 0 to exist dock. Verified call leaves speaker state.
Fixes: 227560170
Change-Id: I409a49a2b75ea72f558ba5ed8906f1bcd2e82de3
5 files changed