Transport AudioPort to HAL
This CL is part of a chain of CLs to make
AudioManager#setWiredDeviceConnectionState contain information about the
device's supported capabilities. This CL takes care of some required
downstream changes:
- Adapt arguments of AudioSystem#setDeviceConnectionState to AudioPort,
which contains the device type, address, name and supported capabilities
- Adapt arguments of downstream methods as well,
until AudioPolicyManager#setDeviceConnectionStateInt
In AudioPolicyManager#setDeviceConnectionStateInt, AudioPort is
converted back to the previously used arguments (type, address, name)
before calling into mHwModules. In a follow-up change, mHwModules will
need to be adapted to take on the AudioPort argument as well.
Bug: 199846845
Test: atest audio_health_tests && atest audiopolicy_tests
Change-Id: I4f6b038f863aaadf2e3e05c37c181f9ae41c9e2f
diff --git a/services/audiopolicy/service/AudioPolicyInterfaceImpl.cpp b/services/audiopolicy/service/AudioPolicyInterfaceImpl.cpp
index 87a350f..582c048 100644
--- a/services/audiopolicy/service/AudioPolicyInterfaceImpl.cpp
+++ b/services/audiopolicy/service/AudioPolicyInterfaceImpl.cpp
@@ -119,14 +119,9 @@
}
Status AudioPolicyService::setDeviceConnectionState(
- const AudioDevice& deviceAidl,
media::AudioPolicyDeviceState stateAidl,
- const std::string& deviceNameAidl,
+ const android::media::audio::common::AudioPort& port,
const AudioFormatDescription& encodedFormatAidl) {
- audio_devices_t device;
- std::string address;
- RETURN_BINDER_STATUS_IF_ERROR(
- aidl2legacy_AudioDevice_audio_device(deviceAidl, &device, &address));
audio_policy_dev_state_t state = VALUE_OR_RETURN_BINDER_STATUS(
aidl2legacy_AudioPolicyDeviceState_audio_policy_dev_state_t(stateAidl));
audio_format_t encodedFormat = VALUE_OR_RETURN_BINDER_STATUS(
@@ -147,7 +142,7 @@
Mutex::Autolock _l(mLock);
AutoCallerClear acc;
status_t status = mAudioPolicyManager->setDeviceConnectionState(
- device, state, address.c_str(), deviceNameAidl.c_str(), encodedFormat);
+ state, port, encodedFormat);
if (status == NO_ERROR) {
onCheckSpatializer_l();
}