Ensure audio mode is updated when the foreground call changes.
In the past, the audio mode (voip/modem) was triggered in a few cases where new calls started or calls swap, as a side effect of notifying the CallAudioRoute/ModeStateMachines of those operations. There are two cases where that was not enough: 1) When an ongoing unholdable pstn call is disconnected due to a voip call being answered. 2) When swapping between an ongoing PSTN call and VOIP call in some cases the new foreground call would not correctly be set -- this caused the fg call to be tracked incorrectly and the audio mode not to be set. To correct this, updated the logic to determine which call is the foreground call so that it will preferentially use an active or dialing call which is not locally disconnecting (ie this is the original bug case) to become the foreground call. Failing that it'll fall back to the old behavior of choosing the first call. Finally, to make audio mode changing more reliable, added code which is executed on change of foreground call. We will now send a FOREGROUND_VOIP_MODE_CHANGE event to the CallAudioModeStateMachine so that it can properly transition between voip/modem audio modes. This signal does overlap with some of the other cases (new call added for example), however the net effect is no audio mode state transition would happen in those cases. Test: Manual test for repro steps mentioned in bug. Test: Added new unit test coverage for this case in CallAudioManagerTest Fixes: 289861657 Change-Id: Ie337985f8dea9ca688af4f6a08a5a9dc9a92943b
Loading
Please register or sign in to comment