summaryrefslogtreecommitdiffstats
path: root/services/audiopolicy
diff options
context:
space:
mode:
authorShreyas Nagasandra Chandrasekhar <snagas@codeaurora.org>2014-10-08 15:56:46 +0530
committerSteve Kondik <shade@chemlab.org>2015-11-20 14:02:48 -0800
commitab77bc7189e49fd35e8638509df9d2c090f23817 (patch)
tree98e02b9be21b1531eaf30a33fee3576fa481098c /services/audiopolicy
parentd9887ccfe9c5838bffc47ee04ac0294ec9e332a8 (diff)
downloadframeworks_av-ab77bc7189e49fd35e8638509df9d2c090f23817.zip
frameworks_av-ab77bc7189e49fd35e8638509df9d2c090f23817.tar.gz
frameworks_av-ab77bc7189e49fd35e8638509df9d2c090f23817.tar.bz2
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
Diffstat (limited to 'services/audiopolicy')
-rw-r--r--services/audiopolicy/common/managerdefinitions/src/AudioOutputDescriptor.cpp4
-rw-r--r--services/audiopolicy/managerdefault/AudioPolicyManager.cpp18
2 files changed, 22 insertions, 0 deletions
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<SwAudioOutputDescriptor> 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;
}
}