Respect user switch BT from ringing call state.

When the call audio is in RINGING_FOCUS and inband ringtone is disabled,
Telecom will route to RingingBluetoothRoute as an intermediary audio
state and wait until focus becomes ACTIVE_FOCUS in order to initiate
SCO (legacy call audio routing). Once we do receive active focus,
Telecom will try to arbitrarily connect to an available device and this
would ignore auto routing to watches.

Considering the scenario if a watch ICS requests audio routing to the
watch (via ICS#requestBluetoothAudio) during the ringing state with
inband ringtone disabled, Telecom will ignore the route switch and wait
to arbitrarily connect to a device once the call becomes active. Since,
auto routing to watches is ignored, the client selection is ignored.

In the new refactored changes, Telecom would route to the inactive BT
route of the watch device but from the way this code is designed, we
will consider that device as active when it is the current audio route.
So, when Telecom receives ACTIVE_FOCUS and performs base routing, it
will route to the watch since it's the active device.

This CL buffs the logic in the refactored changes by ensuring that any
client selection from the available BT devices is honored once the call
audio focus is ACTIVE_FOCUS. For instance, if a watch and another
headset have been connected (where the headset is the most recently
reported active device) and the ICS requests a switch to the watch,
Telecom will ensure that audio ends up routing to the watch and not the
headset.

Bug: 350808955
Test: atest CallAudioRouteControllerTest
Flag: com.android.server.telecom.flags.use_refactored_audio_route_switching
Change-Id: Ied8a1e08297f872bd975ec527e73e302f4a6b475
2 files changed