From 2c80a9c1453230a62f538fc128f286005d91b802 Mon Sep 17 00:00:00 2001 From: Pierre-Hugues Husson Date: Mon, 13 Apr 2020 21:01:16 +0200 Subject: [PATCH 08/14] There are three SCO devices. Fallback from one to the others if needed Change-Id: I414dcb6b154855c00cb8520b23dc1069827864b2 --- .../managerdefinitions/src/HwModule.cpp | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/services/audiopolicy/common/managerdefinitions/src/HwModule.cpp b/services/audiopolicy/common/managerdefinitions/src/HwModule.cpp index d31e4437e1..b2ca5e85de 100644 --- a/services/audiopolicy/common/managerdefinitions/src/HwModule.cpp +++ b/services/audiopolicy/common/managerdefinitions/src/HwModule.cpp @@ -292,6 +292,27 @@ sp HwModuleCollection::getModuleForDeviceType(audio_devices_t type, } } } + //We didn't find one? Ok but all SCOs are equivalent surely? + if(type == AUDIO_DEVICE_OUT_BLUETOOTH_SCO || + type == AUDIO_DEVICE_OUT_BLUETOOTH_SCO_HEADSET || + type == AUDIO_DEVICE_OUT_BLUETOOTH_SCO_CARKIT) { + ALOGE("Fallback SCO"); + if(type != AUDIO_DEVICE_OUT_BLUETOOTH_SCO) { + auto ret = getModuleForDeviceType(AUDIO_DEVICE_OUT_BLUETOOTH_SCO, encodedFormat); + ALOGE("Fallback SCO simple? %s", (ret != nullptr) ? "yes" : "no"); + if(ret != nullptr) return ret; + } + if(type != AUDIO_DEVICE_OUT_BLUETOOTH_SCO_HEADSET) { + auto ret = getModuleForDeviceType(AUDIO_DEVICE_OUT_BLUETOOTH_SCO_HEADSET, encodedFormat); + ALOGE("Fallback SCO headset? %s", (ret != nullptr) ? "yes" : "no"); + if(ret != nullptr) return ret; + } + if(type != AUDIO_DEVICE_OUT_BLUETOOTH_SCO_CARKIT) { + auto ret = getModuleForDeviceType(AUDIO_DEVICE_OUT_BLUETOOTH_SCO_CARKIT, encodedFormat); + ALOGE("Fallback SCO carkit? %s", (ret != nullptr) ? "yes" : "no"); + if(ret != nullptr) return ret; + } + } return nullptr; } -- 2.17.1