AudioService: fix SCO audio resume after call

In AudioDeviceBroker.setCommunicationRouteForClient(),
if the requested device is SCO audio, start BT SCO audio
not only when SCO was not requested before but also if SCO audio
is not active.

Bug: 206739623
Test: repro steps in bug.
Test: atest AudioCommunicationDeviceTest
Change-Id: I36bd1f32811e0cd4db4ffc54a5fb189f0352cfe8
This commit is contained in:
Eric Laurent
2021-12-10 17:54:50 +01:00
parent f49cf8a413
commit 7cf5ae1c79

View File

@@ -328,7 +328,7 @@ import java.util.concurrent.atomic.AtomicBoolean;
}
boolean isBtScoRequested = isBluetoothScoRequested();
if (isBtScoRequested && !wasBtScoRequested) {
if (isBtScoRequested && (!wasBtScoRequested || !isBluetoothScoActive())) {
if (!mBtHelper.startBluetoothSco(scoAudioMode, eventSource)) {
Log.w(TAG, "setCommunicationRouteForClient: failure to start BT SCO for pid: "
+ pid);