Revert "Revert "Switch the framework AIDL to use AudioChannelLayout""

This reverts commit b75b624f0a2b9a3e0ae6b89ceb6158e82df71b66.

'AudioChannelLayout' is a new type that will be used both by HAL
and framework interfaces. This CL changes the framework interfaces
to use it instead of 'AudioChannelMask' type which was used to
pass legacy 'audio_channel_mask_t' transparently via the AIDL
layer.

Remove the implementation of 'Parcelable' from AudioProfile and
AudioPortConfig in libaudiofoundation because the implementation
not used after converting audio fwk interfaces to AIDL, and
Parcelable's interface methods do not allow passing in any
context. In our case the context is the direction of the I/O
('isInput' flag) which is usually available externally, but absent
from the encapsulated data of these classes.

Update the audiofoundation_parcelable_test, switch to use of static
libs for the framework code so they can run on a device with
default system libraries.

Bug: 188932434
Test: check audio on device
Test: atest audiofoundation_parcelable_test
Test: app-compat/G3Compat/main
Change-Id: I95c56040855187464bfbe7fcc7daf27f69fea55b
diff --git a/services/audioflinger/AudioFlinger.cpp b/services/audioflinger/AudioFlinger.cpp
index 1e1db31..a1fb304 100644
--- a/services/audioflinger/AudioFlinger.cpp
+++ b/services/audioflinger/AudioFlinger.cpp
@@ -1876,10 +1876,10 @@
 void AudioFlinger::ioConfigChanged(audio_io_config_event_t event,
                                    const sp<AudioIoDescriptor>& ioDesc,
                                    pid_t pid) {
-    media::AudioIoDescriptor descAidl = VALUE_OR_FATAL(
-            legacy2aidl_AudioIoDescriptor_AudioIoDescriptor(ioDesc));
     media::AudioIoConfigEvent eventAidl = VALUE_OR_FATAL(
             legacy2aidl_audio_io_config_event_t_AudioIoConfigEvent(event));
+    media::AudioIoDescriptor descAidl = VALUE_OR_FATAL(
+            legacy2aidl_AudioIoDescriptor_AudioIoDescriptor(ioDesc));
 
     Mutex::Autolock _l(mClientLock);
     size_t size = mNotificationClients.size();
@@ -2610,9 +2610,9 @@
     audio_module_handle_t module = VALUE_OR_RETURN_STATUS(
             aidl2legacy_int32_t_audio_module_handle_t(request.module));
     audio_config_t halConfig = VALUE_OR_RETURN_STATUS(
-            aidl2legacy_AudioConfig_audio_config_t(request.halConfig));
+            aidl2legacy_AudioConfig_audio_config_t(request.halConfig, false /*isInput*/));
     audio_config_base_t mixerConfig = VALUE_OR_RETURN_STATUS(
-            aidl2legacy_AudioConfigBase_audio_config_base_t(request.mixerConfig));
+            aidl2legacy_AudioConfigBase_audio_config_base_t(request.mixerConfig, false/*isInput*/));
     sp<DeviceDescriptorBase> device = VALUE_OR_RETURN_STATUS(
             aidl2legacy_DeviceDescriptorBase(request.device));
     audio_output_flags_t flags = VALUE_OR_RETURN_STATUS(
@@ -2665,8 +2665,8 @@
             mmapThread->ioConfigChanged(AUDIO_OUTPUT_OPENED);
         }
         response->output = VALUE_OR_RETURN_STATUS(legacy2aidl_audio_io_handle_t_int32_t(output));
-        response->config =
-                VALUE_OR_RETURN_STATUS(legacy2aidl_audio_config_t_AudioConfig(halConfig));
+        response->config = VALUE_OR_RETURN_STATUS(
+                legacy2aidl_audio_config_t_AudioConfig(halConfig, false /*isInput*/));
         response->latencyMs = VALUE_OR_RETURN_STATUS(convertIntegral<int32_t>(latencyMs));
         response->flags = VALUE_OR_RETURN_STATUS(
                 legacy2aidl_audio_output_flags_t_int32_t_mask(flags));
@@ -2834,7 +2834,7 @@
     audio_io_handle_t input = VALUE_OR_RETURN_STATUS(
             aidl2legacy_int32_t_audio_io_handle_t(request.input));
     audio_config_t config = VALUE_OR_RETURN_STATUS(
-            aidl2legacy_AudioConfig_audio_config_t(request.config));
+            aidl2legacy_AudioConfig_audio_config_t(request.config, true /*isInput*/));
 
     sp<ThreadBase> thread = openInput_l(
             VALUE_OR_RETURN_STATUS(aidl2legacy_int32_t_audio_module_handle_t(request.module)),
@@ -2848,7 +2848,8 @@
             String8{});
 
     response->input = VALUE_OR_RETURN_STATUS(legacy2aidl_audio_io_handle_t_int32_t(input));
-    response->config = VALUE_OR_RETURN_STATUS(legacy2aidl_audio_config_t_AudioConfig(config));
+    response->config = VALUE_OR_RETURN_STATUS(
+            legacy2aidl_audio_config_t_AudioConfig(config, true /*isInput*/));
     response->device = request.device;
 
     if (thread != 0) {