Loading services/audiopolicy/enginedefault/src/Engine.cpp +15 −7 Original line number Diff line number Diff line Loading @@ -166,8 +166,12 @@ void Engine::filterOutputDevicesForStrategy(legacy_strategy strategy, // - cannot route from voice call RX OR // - audio HAL version is < 3.0 and TX device is on the primary HW module if (getPhoneState() == AUDIO_MODE_IN_CALL) { audio_devices_t txDevice = getDeviceForInputSource( AUDIO_SOURCE_VOICE_COMMUNICATION)->type(); audio_devices_t txDevice = AUDIO_DEVICE_NONE; sp<DeviceDescriptor> txDeviceDesc = getDeviceForInputSource(AUDIO_SOURCE_VOICE_COMMUNICATION); if (txDeviceDesc != nullptr) { txDevice = txDeviceDesc->type(); } sp<AudioOutputDescriptor> primaryOutput = outputs.getPrimaryOutput(); LOG_ALWAYS_FATAL_IF(primaryOutput == nullptr, "Primary output not found"); DeviceVector availPrimaryInputDevices = Loading Loading @@ -594,22 +598,26 @@ sp<DeviceDescriptor> Engine::getDeviceForInputSource(audio_source_t inputSource) } } switch (commDeviceType) { case AUDIO_DEVICE_OUT_BLE_HEADSET: device = availableDevices.getDevice( AUDIO_DEVICE_IN_BLE_HEADSET, String8(""), AUDIO_FORMAT_DEFAULT); break; case AUDIO_DEVICE_OUT_SPEAKER: device = availableDevices.getFirstExistingDevice({ AUDIO_DEVICE_IN_BACK_MIC, AUDIO_DEVICE_IN_BUILTIN_MIC, AUDIO_DEVICE_IN_USB_DEVICE, AUDIO_DEVICE_IN_USB_HEADSET}); break; case AUDIO_DEVICE_OUT_BLE_HEADSET: device = availableDevices.getDevice( AUDIO_DEVICE_IN_BLE_HEADSET, String8(""), AUDIO_FORMAT_DEFAULT); if (device != nullptr) { break; } ALOGE("%s LE Audio selected for communication but input device not available", __func__); FALLTHROUGH_INTENDED; default: // FORCE_NONE device = availableDevices.getFirstExistingDevice({ AUDIO_DEVICE_IN_WIRED_HEADSET, AUDIO_DEVICE_IN_USB_HEADSET, AUDIO_DEVICE_IN_USB_DEVICE, AUDIO_DEVICE_IN_BLUETOOTH_BLE, AUDIO_DEVICE_IN_BUILTIN_MIC}); break; } break; Loading services/audiopolicy/managerdefault/AudioPolicyManager.cpp +9 −2 Original line number Diff line number Diff line Loading @@ -671,7 +671,10 @@ status_t AudioPolicyManager::updateCallRoutingInternal( audio_attributes_t attr = { .source = AUDIO_SOURCE_VOICE_COMMUNICATION }; auto txSourceDevice = mEngine->getInputDeviceForAttributes(attr); ALOG_ASSERT(txSourceDevice != 0, "%s() input selected device not available", __func__); if (txSourceDevice == nullptr) { ALOGE("%s() selected input device not available", __func__); return INVALID_OPERATION; } ALOGV("%s device rxDevice %s txDevice %s", __func__, rxDevices.itemAt(0)->toString().c_str(), txSourceDevice->toString().c_str()); Loading Loading @@ -5327,7 +5330,11 @@ status_t AudioPolicyManager::acquireSoundTriggerSession(audio_session_t *session *session = (audio_session_t)mpClientInterface->newAudioUniqueId(AUDIO_UNIQUE_ID_USE_SESSION); *ioHandle = (audio_io_handle_t)mpClientInterface->newAudioUniqueId(AUDIO_UNIQUE_ID_USE_INPUT); audio_attributes_t attr = { .source = AUDIO_SOURCE_HOTWORD }; *device = mEngine->getInputDeviceForAttributes(attr)->type(); sp<DeviceDescriptor> deviceDesc = mEngine->getInputDeviceForAttributes(attr); if (deviceDesc == nullptr) { return INVALID_OPERATION; } *device = deviceDesc->type(); return mSoundTriggerSessions.acquireSession(*session, *ioHandle); } Loading Loading
services/audiopolicy/enginedefault/src/Engine.cpp +15 −7 Original line number Diff line number Diff line Loading @@ -166,8 +166,12 @@ void Engine::filterOutputDevicesForStrategy(legacy_strategy strategy, // - cannot route from voice call RX OR // - audio HAL version is < 3.0 and TX device is on the primary HW module if (getPhoneState() == AUDIO_MODE_IN_CALL) { audio_devices_t txDevice = getDeviceForInputSource( AUDIO_SOURCE_VOICE_COMMUNICATION)->type(); audio_devices_t txDevice = AUDIO_DEVICE_NONE; sp<DeviceDescriptor> txDeviceDesc = getDeviceForInputSource(AUDIO_SOURCE_VOICE_COMMUNICATION); if (txDeviceDesc != nullptr) { txDevice = txDeviceDesc->type(); } sp<AudioOutputDescriptor> primaryOutput = outputs.getPrimaryOutput(); LOG_ALWAYS_FATAL_IF(primaryOutput == nullptr, "Primary output not found"); DeviceVector availPrimaryInputDevices = Loading Loading @@ -594,22 +598,26 @@ sp<DeviceDescriptor> Engine::getDeviceForInputSource(audio_source_t inputSource) } } switch (commDeviceType) { case AUDIO_DEVICE_OUT_BLE_HEADSET: device = availableDevices.getDevice( AUDIO_DEVICE_IN_BLE_HEADSET, String8(""), AUDIO_FORMAT_DEFAULT); break; case AUDIO_DEVICE_OUT_SPEAKER: device = availableDevices.getFirstExistingDevice({ AUDIO_DEVICE_IN_BACK_MIC, AUDIO_DEVICE_IN_BUILTIN_MIC, AUDIO_DEVICE_IN_USB_DEVICE, AUDIO_DEVICE_IN_USB_HEADSET}); break; case AUDIO_DEVICE_OUT_BLE_HEADSET: device = availableDevices.getDevice( AUDIO_DEVICE_IN_BLE_HEADSET, String8(""), AUDIO_FORMAT_DEFAULT); if (device != nullptr) { break; } ALOGE("%s LE Audio selected for communication but input device not available", __func__); FALLTHROUGH_INTENDED; default: // FORCE_NONE device = availableDevices.getFirstExistingDevice({ AUDIO_DEVICE_IN_WIRED_HEADSET, AUDIO_DEVICE_IN_USB_HEADSET, AUDIO_DEVICE_IN_USB_DEVICE, AUDIO_DEVICE_IN_BLUETOOTH_BLE, AUDIO_DEVICE_IN_BUILTIN_MIC}); break; } break; Loading
services/audiopolicy/managerdefault/AudioPolicyManager.cpp +9 −2 Original line number Diff line number Diff line Loading @@ -671,7 +671,10 @@ status_t AudioPolicyManager::updateCallRoutingInternal( audio_attributes_t attr = { .source = AUDIO_SOURCE_VOICE_COMMUNICATION }; auto txSourceDevice = mEngine->getInputDeviceForAttributes(attr); ALOG_ASSERT(txSourceDevice != 0, "%s() input selected device not available", __func__); if (txSourceDevice == nullptr) { ALOGE("%s() selected input device not available", __func__); return INVALID_OPERATION; } ALOGV("%s device rxDevice %s txDevice %s", __func__, rxDevices.itemAt(0)->toString().c_str(), txSourceDevice->toString().c_str()); Loading Loading @@ -5327,7 +5330,11 @@ status_t AudioPolicyManager::acquireSoundTriggerSession(audio_session_t *session *session = (audio_session_t)mpClientInterface->newAudioUniqueId(AUDIO_UNIQUE_ID_USE_SESSION); *ioHandle = (audio_io_handle_t)mpClientInterface->newAudioUniqueId(AUDIO_UNIQUE_ID_USE_INPUT); audio_attributes_t attr = { .source = AUDIO_SOURCE_HOTWORD }; *device = mEngine->getInputDeviceForAttributes(attr)->type(); sp<DeviceDescriptor> deviceDesc = mEngine->getInputDeviceForAttributes(attr); if (deviceDesc == nullptr) { return INVALID_OPERATION; } *device = deviceDesc->type(); return mSoundTriggerSessions.acquireSession(*session, *ioHandle); } Loading