Resolve CallAudioRouteController issues.
This CL resolves recent bugs that have been filed around the refactored
audio route changes based on the initial fix that was put up. Namely, it
takes care of a stack overflow issue with SPEAKER_ON, resolves a NPE
with the LE audio service being unavailable, handles late SCO audio
connected messages received via BluetoothStateReceiver, handles removing
BT routes when there's a service disconnect from the
BluetoothProfileServiceListener, avoids processing duplicate pending
messages in PendingAudioRoute, ensures that video calls are defaulted
to speaker (unless a wired headset or BT device is connected), ensures
that mute functionality is working as intended both during and at the
end of a call (reset mute), and in the case that BT_AUDIO_CONNECTED is
processed before the HFP device is connected, ensures that we don't wait
to process it again.
There are still known issues around WhatsApp calls that occur as a
result of timing issues that are due to how the new code is structured
which will be investigated in a subsequent CL. Use cases involving
multiple BT devices have not been verified as there is currently an
issue with the bluetooth stack that is blocking Telecom, which is also
being investigated.
Bug: 328287261
Test: Manual tests with single BT scenarios (LE/HFP) in simple audio
routing switching cases as well as toggling on/off bluetooth and
disconnecting/reconnecting device during oncall. Also ran through MO/MT
cases to ensure that BT audio is connected accordingly during subsequent
calls.
Test: atest CallAudioRouteControllerTest
Change-Id: Ief1f0fe5e0b311594087414ff6a9084063468c73
7 files changed