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/media/libaudioclient/AudioSystem.cpp b/media/libaudioclient/AudioSystem.cpp
index be81481..40efb38 100644
--- a/media/libaudioclient/AudioSystem.cpp
+++ b/media/libaudioclient/AudioSystem.cpp
@@ -834,33 +834,18 @@
     aps->onNewAudioModulesAvailable();
 }
 
-status_t AudioSystem::setDeviceConnectionState(audio_devices_t device,
-                                               audio_policy_dev_state_t state,
-                                               const char* device_address,
-                                               const char* device_name,
+status_t AudioSystem::setDeviceConnectionState(audio_policy_dev_state_t state,
+                                               const android::media::audio::common::AudioPort& port,
                                                audio_format_t encodedFormat) {
     const sp<IAudioPolicyService>& aps = AudioSystem::get_audio_policy_service();
-    const char* address = "";
-    const char* name = "";
 
     if (aps == 0) return PERMISSION_DENIED;
 
-    if (device_address != NULL) {
-        address = device_address;
-    }
-    if (device_name != NULL) {
-        name = device_name;
-    }
-
-    AudioDevice deviceAidl = VALUE_OR_RETURN_STATUS(
-            legacy2aidl_audio_device_AudioDevice(device, address));
-
     return statusTFromBinderStatus(
             aps->setDeviceConnectionState(
-                    deviceAidl,
                     VALUE_OR_RETURN_STATUS(
                             legacy2aidl_audio_policy_dev_state_t_AudioPolicyDeviceState(state)),
-                    name,
+                    port,
                     VALUE_OR_RETURN_STATUS(
                             legacy2aidl_audio_format_t_AudioFormatDescription(encodedFormat))));
 }