update SoundTrigger queryParameter
Update the documentation and usage when HAL implementation wants to
convey the parameter ID is not supported.
Bug: 141929369
Test: build and boot smoke test
&& verify unsupported parameter use case with test app
Change-Id: I2124d8e5e9b136bd0797c16e71aa0b4049c9ed58
diff --git a/soundtrigger/2.3/ISoundTriggerHw.hal b/soundtrigger/2.3/ISoundTriggerHw.hal
index 270b00e..3e761e5 100644
--- a/soundtrigger/2.3/ISoundTriggerHw.hal
+++ b/soundtrigger/2.3/ISoundTriggerHw.hal
@@ -114,8 +114,10 @@
* @return status Operation completion status: 0 in case of success
* -ENODEV if the native service cannot be reached
* -EINVAL invalid input parameter
- * @return retval ModelParameter structure indicating supported attributes
- * of the parameter for the given model handle
+ * @return retval OptionalModelParameterRange safe union structure wrapping
+ * ModelParameterRange. This structure indicates supported attributes
+ * of the parameter for the given model handle. If the parameter is not
+ * supported the Monostate of the union is used.
*/
queryParameter(SoundModelHandle modelHandle, ModelParameter modelParam)
generates (int32_t status, OptionalModelParameterRange retval);
diff --git a/soundtrigger/2.3/default/SoundTriggerHw.cpp b/soundtrigger/2.3/default/SoundTriggerHw.cpp
index d3136b9..8fe3108 100644
--- a/soundtrigger/2.3/default/SoundTriggerHw.cpp
+++ b/soundtrigger/2.3/default/SoundTriggerHw.cpp
@@ -889,7 +889,7 @@
int32_t status = mHwDevice->query_parameter(
mHwDevice, client->getHalHandle(), convertModelParameterToHal(modelParam), ¶mRange);
- if (status == 0) {
+ if (status == 0 && paramRange.is_supported) {
optionalParamRange.range({.start = paramRange.start, .end = paramRange.end});
}
_hidl_cb(status, optionalParamRange);