HFP: Fix phone state change in Telecom and VoIP calls
* We used to ignore phone state change when devices are all disconnected
* Instead, phone state change should always be captured by HeadsetService's
HeadsetPhoneState regardless of device connection state.
* This prevents HeadsetService from notifying remote device wrong phone
state when just connected
* VoIP calls' phone state change should also be handled in
HeadsetService to allow multiple connected HFP devices to sync
* Add unit test for phone state change
* Synchronize HeadsetServce state cleanup and setters using
mStateMachines to avoid race condition
* Log the pid and uid of key SCO event callers
* Intents should be sent when audio is disconnected from headset
Call Policy after this change:
* VoIP call -> Telecom Call: Telecom call should cause VoIP call to stop
* Telecom call -> VoIP call: VoIP call should be rejected
* VoIP call state is no longer cleaned during SCO tear down, instead, it
should be teared down by the original caller to
startScoUsingVirtualVoiceCall() via stopScoUsingVirtualVoiceCall()
Bug: 76201254
Bug: 76114959
Test: HeadsetServiceTest, HeadsetServiceAndStateMachineTest
Connect to Bose QC35, call, turn off headset, end call, turn on
headset
Change-Id: I230f4da47fc57392208e26156f9e975ea2a1fad5
(cherry picked from commit a639b81f96c534c2f1066354b4a574c0dda2f713)
13 files changed