Implement a.h.audio.common@7.0-util module

This includes a rewrite of HidlUtils for V7.
A unit test is added for its conversion functions.

Made necessary minor adjustments to the HAL V7 types.
Also, fixed definition of 'audioFormatsList' to allow for
vendor extensions.

Bug: 142480271
Bug: 173647783
Test: m && atest android.hardware.audio.common@7.0-util_tests
Change-Id: Ib883f1c246fce78c004846516699aa724d4b5d44
diff --git a/audio/7.0/config/api/current.txt b/audio/7.0/config/api/current.txt
index fea6979..1da8b09 100644
--- a/audio/7.0/config/api/current.txt
+++ b/audio/7.0/config/api/current.txt
@@ -360,7 +360,7 @@
   public static class DevicePorts.DevicePort {
     ctor public DevicePorts.DevicePort();
     method @Nullable public String getAddress();
-    method @Nullable public java.util.List<android.audio.policy.configuration.V7_0.AudioFormat> getEncodedFormats();
+    method @Nullable public java.util.List<java.lang.String> getEncodedFormats();
     method @Nullable public android.audio.policy.configuration.V7_0.Gains getGains();
     method @Nullable public java.util.List<android.audio.policy.configuration.V7_0.Profile> getProfile();
     method @Nullable public android.audio.policy.configuration.V7_0.Role getRole();
@@ -368,7 +368,7 @@
     method @Nullable public String getType();
     method @Nullable public boolean get_default();
     method public void setAddress(@Nullable String);
-    method public void setEncodedFormats(@Nullable java.util.List<android.audio.policy.configuration.V7_0.AudioFormat>);
+    method public void setEncodedFormats(@Nullable java.util.List<java.lang.String>);
     method public void setGains(@Nullable android.audio.policy.configuration.V7_0.Gains);
     method public void setRole(@Nullable android.audio.policy.configuration.V7_0.Role);
     method public void setTagName(@Nullable String);
@@ -527,10 +527,10 @@
 
   public static class SurroundFormats.Format {
     ctor public SurroundFormats.Format();
-    method @Nullable public android.audio.policy.configuration.V7_0.AudioFormat getName();
-    method @Nullable public java.util.List<android.audio.policy.configuration.V7_0.AudioFormat> getSubformats();
-    method public void setName(@Nullable android.audio.policy.configuration.V7_0.AudioFormat);
-    method public void setSubformats(@Nullable java.util.List<android.audio.policy.configuration.V7_0.AudioFormat>);
+    method @Nullable public String getName();
+    method @Nullable public java.util.List<java.lang.String> getSubformats();
+    method public void setName(@Nullable String);
+    method public void setSubformats(@Nullable java.util.List<java.lang.String>);
   }
 
   public class SurroundSound {
diff --git a/audio/7.0/config/audio_policy_configuration.xsd b/audio/7.0/config/audio_policy_configuration.xsd
index 6784828..56b3a27 100644
--- a/audio/7.0/config/audio_policy_configuration.xsd
+++ b/audio/7.0/config/audio_policy_configuration.xsd
@@ -774,13 +774,13 @@
         </xs:sequence>
     </xs:complexType>
     <xs:simpleType name="audioFormatsList">
-        <xs:list itemType="audioFormat" />
+        <xs:list itemType="extendableAudioFormat" />
     </xs:simpleType>
     <xs:complexType name="surroundFormats">
         <xs:sequence>
             <xs:element name="format" minOccurs="0" maxOccurs="unbounded">
                 <xs:complexType>
-                    <xs:attribute name="name" type="audioFormat" use="required"/>
+                    <xs:attribute name="name" type="extendableAudioFormat" use="required"/>
                     <xs:attribute name="subformats" type="audioFormatsList" />
                 </xs:complexType>
             </xs:element>
diff --git a/audio/7.0/types.hal b/audio/7.0/types.hal
index 6cac9c9..1ae7bad 100644
--- a/audio/7.0/types.hal
+++ b/audio/7.0/types.hal
@@ -179,7 +179,8 @@
  * Used by StreamIn and Device
  */
 struct MicrophoneInfo {
-    /** Unique alphanumeric id for microphone. Guaranteed to be the same
+    /**
+     * Unique alphanumeric id for microphone. Guaranteed to be the same
      * even after rebooting.
      */
     string                                  deviceId;
@@ -187,18 +188,21 @@
      * Device specific information
      */
     DeviceAddress                           deviceAddress;
-    /** Each element of the vector must describe the channel with the same
-     *  index.
+    /**
+     * Each element of the vector must describe the channel with the same
+     * index.
      */
     vec<AudioMicrophoneChannelMapping>      channelMapping;
     /** Location of the microphone in regard to the body of the device */
     AudioMicrophoneLocation                 location;
-    /** Identifier to help group related microphones together
-     *  e.g. microphone arrays should belong to the same group
+    /**
+     * Identifier to help group related microphones together
+     * e.g. microphone arrays should belong to the same group
      */
     AudioMicrophoneGroup                    group;
-    /** Index of this microphone within the group.
-     *  (group, index) must be unique within the same device.
+    /**
+     * Index of this microphone within the group.
+     * (group, index) must be unique within the same device.
      */
     uint32_t                                indexInTheGroup;
     /** Level in dBFS produced by a 1000 Hz tone at 94 dB SPL */
@@ -209,17 +213,20 @@
     float                                   minSpl;
     /** Standard polar pattern of the microphone */
     AudioMicrophoneDirectionality           directionality;
-    /** Vector with ordered frequency responses (from low to high frequencies)
-     *  with the frequency response of the microphone.
-     *  Levels are in dB, relative to level at 1000 Hz
+    /**
+     * Vector with ordered frequency responses (from low to high frequencies)
+     * with the frequency response of the microphone.
+     * Levels are in dB, relative to level at 1000 Hz
      */
     vec<AudioFrequencyResponsePoint>        frequencyResponse;
-    /** Position of the microphone's capsule in meters, from the
-     *  bottom-left-back corner of the bounding box of device.
+    /**
+     * Position of the microphone's capsule in meters, from the
+     * bottom-left-back corner of the bounding box of device.
      */
     AudioMicrophoneCoordinate               position;
-    /** Normalized point to signal the main orientation of the microphone's
-     *  capsule. sqrt(x^2 + y^2 + z^2) = 1
+    /**
+     * Normalized point to signal the main orientation of the microphone's
+     * capsule. sqrt(x^2 + y^2 + z^2) = 1
      */
     AudioMicrophoneCoordinate               orientation;
 };