Loading services/audioflinger/AudioFlinger.cpp +11 −12 Original line number Diff line number Diff line Loading @@ -428,23 +428,22 @@ int32_t AudioFlinger::getAAudioHardwareBurstMinUsec() const { status_t AudioFlinger::setDeviceConnectedState(const struct audio_port_v7 *port, media::DeviceConnectedState state) { status_t final_result = NO_INIT; status_t result = NO_INIT; audio_utils::lock_guard _l(mutex()); audio_utils::lock_guard lock(hardwareMutex()); AudioHwDevice *audioHwDevice = mAudioHwDevs.valueFor(port->ext.device.hw_module); if (audioHwDevice != nullptr) { mHardwareStatus = AUDIO_HW_SET_CONNECTED_STATE; for (size_t i = 0; i < mAudioHwDevs.size(); i++) { sp<DeviceHalInterface> dev = mAudioHwDevs.valueAt(i)->hwDevice(); status_t result = state == media::DeviceConnectedState::PREPARE_TO_DISCONNECT sp<DeviceHalInterface> dev = audioHwDevice->hwDevice(); result = state == media::DeviceConnectedState::PREPARE_TO_DISCONNECT ? dev->prepareToDisconnectExternalDevice(port) : dev->setConnectedState(port, state == media::DeviceConnectedState::CONNECTED); // Same logic as with setParameter: it's a success if at least one // HAL module accepts the update. if (final_result != NO_ERROR) { final_result = result; } } mHardwareStatus = AUDIO_HW_IDLE; return final_result; } else { ALOGE("%s could not find HAL module %d for device %#x", __func__, port->ext.device.hw_module, port->ext.device.type); } return result; } status_t AudioFlinger::setSimulateDeviceConnections(bool enabled) { Loading Loading
services/audioflinger/AudioFlinger.cpp +11 −12 Original line number Diff line number Diff line Loading @@ -428,23 +428,22 @@ int32_t AudioFlinger::getAAudioHardwareBurstMinUsec() const { status_t AudioFlinger::setDeviceConnectedState(const struct audio_port_v7 *port, media::DeviceConnectedState state) { status_t final_result = NO_INIT; status_t result = NO_INIT; audio_utils::lock_guard _l(mutex()); audio_utils::lock_guard lock(hardwareMutex()); AudioHwDevice *audioHwDevice = mAudioHwDevs.valueFor(port->ext.device.hw_module); if (audioHwDevice != nullptr) { mHardwareStatus = AUDIO_HW_SET_CONNECTED_STATE; for (size_t i = 0; i < mAudioHwDevs.size(); i++) { sp<DeviceHalInterface> dev = mAudioHwDevs.valueAt(i)->hwDevice(); status_t result = state == media::DeviceConnectedState::PREPARE_TO_DISCONNECT sp<DeviceHalInterface> dev = audioHwDevice->hwDevice(); result = state == media::DeviceConnectedState::PREPARE_TO_DISCONNECT ? dev->prepareToDisconnectExternalDevice(port) : dev->setConnectedState(port, state == media::DeviceConnectedState::CONNECTED); // Same logic as with setParameter: it's a success if at least one // HAL module accepts the update. if (final_result != NO_ERROR) { final_result = result; } } mHardwareStatus = AUDIO_HW_IDLE; return final_result; } else { ALOGE("%s could not find HAL module %d for device %#x", __func__, port->ext.device.hw_module, port->ext.device.type); } return result; } status_t AudioFlinger::setSimulateDeviceConnections(bool enabled) { Loading