Cuttlefish: Switch to Audio HAL V6

Switch cuttlefish to Audio HAL V6.

Update hidl_implementation_test.

Fix primary audio HAL to be compliant with the VTS test.

Bug: 143257085
Test: atest VtsHalAudioV6_0TargetTest
      atest VtsHalAudioEffectV6_0TargetTest
      atest hidl_implementation_test

Change-Id: I4420b1b524856c128a2b3d014388f6d420150986
diff --git a/guest/hals/audio/audio_hw.c b/guest/hals/audio/audio_hw.c
index 41a0543..7db1ec1 100644
--- a/guest/hals/audio/audio_hw.c
+++ b/guest/hals/audio/audio_hw.c
@@ -331,6 +331,7 @@
     struct str_parms *parms;
     char value[32];
     int success;
+    int ret = -EINVAL;
 
     if (kvpairs == NULL || kvpairs[0] == 0) {
         return 0;
@@ -342,12 +343,19 @@
     // Instead, it should use create_audio_patch API.
     assert(("Must not use set parameters API to set audio devices", success < 0));
 
+    if (str_parms_has_key(parms, AUDIO_PARAMETER_STREAM_FORMAT)) {
+        // match the return value of out_set_format
+        ret = -ENOSYS;
+    }
+
     str_parms_destroy(parms);
 
-    ALOGW("%s(), unsupported parameter %s", __func__, kvpairs);
-    // There is not any key supported for set_parameters API.
-    // Return error when there is non-null value passed in.
-    return -EINVAL;
+    if (ret == -EINVAL) {
+        ALOGW("%s(), unsupported parameter %s", __func__, kvpairs);
+        // There is not any key supported for set_parameters API.
+        // Return error when there is non-null value passed in.
+    }
+    return ret;
 }
 
 static char * out_get_parameters(const struct audio_stream *stream, const char *keys)
@@ -847,6 +855,7 @@
     struct str_parms *parms;
     char value[32];
     int success;
+    int ret = -EINVAL;
 
     if (kvpairs == NULL || kvpairs[0] == 0) {
         return 0;
@@ -858,12 +867,19 @@
     // Instead, it should use create_audio_patch API.
     assert(("Must not use set parameters API to set audio devices", success < 0));
 
+    if (str_parms_has_key(parms, AUDIO_PARAMETER_STREAM_FORMAT)) {
+        // match the return value of in_set_format
+        ret = -ENOSYS;
+    }
+
     str_parms_destroy(parms);
 
-    ALOGW("%s(), unsupported parameter %s", __func__, kvpairs);
-    // There is not any key supported for set_parameters API.
-    // Return error when there is non-null value passed in.
-    return -EINVAL;
+    if (ret == -EINVAL) {
+        ALOGW("%s(), unsupported parameter %s", __func__, kvpairs);
+        // There is not any key supported for set_parameters API.
+        // Return error when there is non-null value passed in.
+    }
+    return ret;
 }
 
 static char * in_get_parameters(const struct audio_stream *stream,
diff --git a/shared/config/manifest.xml b/shared/config/manifest.xml
index cde4e443..6783068 100644
--- a/shared/config/manifest.xml
+++ b/shared/config/manifest.xml
@@ -21,7 +21,7 @@
     <hal format="hidl">
         <name>android.hardware.audio</name>
         <transport>hwbinder</transport>
-        <version>5.0</version>
+        <version>6.0</version>
         <interface>
             <name>IDevicesFactory</name>
             <instance>default</instance>
@@ -30,7 +30,7 @@
     <hal format="hidl">
         <name>android.hardware.audio.effect</name>
         <transport>hwbinder</transport>
-        <version>5.0</version>
+        <version>6.0</version>
         <interface>
             <name>IEffectsFactory</name>
             <instance>default</instance>
diff --git a/shared/device.mk b/shared/device.mk
index 955232a..aa9e3d0 100644
--- a/shared/device.mk
+++ b/shared/device.mk
@@ -209,8 +209,8 @@
 PRODUCT_PACKAGES += \
     audio.primary.cutf \
     audio.r_submix.default \
-    android.hardware.audio@5.0-impl:32 \
-    android.hardware.audio.effect@5.0-impl:32 \
+    android.hardware.audio@6.0-impl:32 \
+    android.hardware.audio.effect@6.0-impl:32 \
     android.hardware.audio@2.0-service \
     android.hardware.soundtrigger@2.0-impl \
 
diff --git a/tests/hidl/hidl_implementation_test.cpp b/tests/hidl/hidl_implementation_test.cpp
index 3eedc96..bb0709f 100644
--- a/tests/hidl/hidl_implementation_test.cpp
+++ b/tests/hidl/hidl_implementation_test.cpp
@@ -28,10 +28,10 @@
     "android.frameworks.vr.composer@2.0",
     "android.hardware.audio@2.0",
     "android.hardware.audio@4.0",
-    "android.hardware.audio@6.0",
+    "android.hardware.audio@5.0",
     "android.hardware.audio.effect@2.0",
     "android.hardware.audio.effect@4.0",
-    "android.hardware.audio.effect@6.0",
+    "android.hardware.audio.effect@5.0",
     "android.hardware.automotive.audiocontrol@1.0",
     "android.hardware.automotive.can@1.0",
     "android.hardware.automotive.evs@1.0",