From ab77bc7189e49fd35e8638509df9d2c090f23817 Mon Sep 17 00:00:00 2001 From: Shreyas Nagasandra Chandrasekhar Date: Wed, 8 Oct 2014 15:56:46 +0530 Subject: audio: Changes to enable BT A2DP For Proxy thread to be started , a2dp state has to updated from the audiopolicy. Now , added changes to send the BT A2DP status to audio HAL. - A- Family doesn't support separate output for a2dp , removed the getA2dpOutput(). getDeviceForStrategy() is selecting the proper device using mA2dpSuspended flag. CRs-Fixed: 751090 Change-Id: I599de562a8674ee611e10575fcc85e4715707a63 --- .../managerdefinitions/src/AudioOutputDescriptor.cpp | 4 ++++ .../audiopolicy/managerdefault/AudioPolicyManager.cpp | 18 ++++++++++++++++++ 2 files changed, 22 insertions(+) (limited to 'services/audiopolicy') diff --git a/services/audiopolicy/common/managerdefinitions/src/AudioOutputDescriptor.cpp b/services/audiopolicy/common/managerdefinitions/src/AudioOutputDescriptor.cpp index 5ddeaed..cefbe79 100644 --- a/services/audiopolicy/common/managerdefinitions/src/AudioOutputDescriptor.cpp +++ b/services/audiopolicy/common/managerdefinitions/src/AudioOutputDescriptor.cpp @@ -428,7 +428,11 @@ audio_io_handle_t SwAudioOutputCollection::getA2dpOutput() const return this->keyAt(i); } } +#ifdef LEGACY_ALSA_AUDIO + return 1; +#else return 0; +#endif } sp SwAudioOutputCollection::getPrimaryOutput() const diff --git a/services/audiopolicy/managerdefault/AudioPolicyManager.cpp b/services/audiopolicy/managerdefault/AudioPolicyManager.cpp index ee3b72e..45efbe1 100644 --- a/services/audiopolicy/managerdefault/AudioPolicyManager.cpp +++ b/services/audiopolicy/managerdefault/AudioPolicyManager.cpp @@ -89,6 +89,12 @@ status_t AudioPolicyManager::setDeviceConnectionStateInt(audio_devices_t device, ALOGV("setDeviceConnectionState() connecting device %x", device); #ifdef LEGACY_ALSA_AUDIO + if (device & AUDIO_DEVICE_OUT_ALL_A2DP) { + AudioParameter param; + param.add(String8("a2dp_connected"), String8("true")); + mpClientInterface->setParameters(0, param.toString()); + } + if (device & AUDIO_DEVICE_OUT_USB_ACCESSORY) { AudioParameter param; param.add(String8("usb_connected"), String8("true")); @@ -148,6 +154,12 @@ status_t AudioPolicyManager::setDeviceConnectionStateInt(audio_devices_t device, mAvailableOutputDevices.remove(devDesc); #ifdef LEGACY_ALSA_AUDIO + if (device & AUDIO_DEVICE_OUT_ALL_A2DP) { + AudioParameter param; + param.add(String8("a2dp_connected"), String8("false")); + mpClientInterface->setParameters(0, param.toString()); + } + if (device & AUDIO_DEVICE_OUT_USB_ACCESSORY) { AudioParameter param; param.add(String8("usb_connected"), String8("true")); @@ -3905,11 +3917,13 @@ void AudioPolicyManager::checkOutputForAllStrategies() void AudioPolicyManager::checkA2dpSuspend() { +#ifndef LEGACY_ALSA_AUDIO audio_io_handle_t a2dpOutput = mOutputs.getA2dpOutput(); if (a2dpOutput == 0) { mA2dpSuspended = false; return; } +#endif bool isScoConnected = ((mAvailableInputDevices.types() & AUDIO_DEVICE_IN_BLUETOOTH_SCO_HEADSET & @@ -3934,7 +3948,9 @@ void AudioPolicyManager::checkA2dpSuspend() ((mEngine->getPhoneState() != AUDIO_MODE_IN_CALL) && (mEngine->getPhoneState() != AUDIO_MODE_RINGTONE))) { +#ifndef LEGACY_ALSA_AUDIO mpClientInterface->restoreOutput(a2dpOutput); +#endif mA2dpSuspended = false; } } else { @@ -3944,7 +3960,9 @@ void AudioPolicyManager::checkA2dpSuspend() ((mEngine->getPhoneState() == AUDIO_MODE_IN_CALL) || (mEngine->getPhoneState() == AUDIO_MODE_RINGTONE))) { +#ifndef LEGACY_ALSA_AUDIO mpClientInterface->suspendOutput(a2dpOutput); +#endif mA2dpSuspended = true; } } -- cgit v1.1