Fix issue where incoming call ringing persiste on BT headset.

b/358249447 fixed some issues with the separate binding to BT ICS code
which meant we'd always unbind from BT before sending the onCallRemoved
update.

However, that uncovered a latent issue in the original code.  In
CallAudioManager we decide if a disconnect tone should be played or not;
if no disconnect tone is played, then the BT ICS unbind future will never
get the "tone finished" callback and the 5 sec timeout on that future
will end up being hit to cause the state update to the BT ICS.  We never
noticed this in the past because the state update always happened AFTER
Telecom unbinded from BT ICS, so it was a no-op.  Now that we're sending
the state correctly before unbinding, this is indeed an issue.

To remedy this, CallAudioManager will complete the disconnect tone future
immediately for disconnected calls when no tone is played.

Flag: com.android.server.telecom.flags.separately_bind_to_bt_incall_service
Fixes: 368495329
Test: Verify disconnect tone playback remains on BT headset and unbind
takes place.
Test: Verify incoming call state update to BT occurs immediately with
no delay.

Change-Id: Iada5e5b08e2885ff4d8ee3781760f84d2d58e2fb
2 files changed