Audio HAL VTS: differentiate getParam success/failure/not_implemented
When sending parameters to the HAL (and some getters are implemented
with getParameters), the client expect a status consistent
with the other HIDL methods. Ie: not implemented or success and failure.
Unfortunately, the legacy get_parameter interface, which currently most
Audio HIDL implementation are a wrapper around, do not return such error
code.
Get parameters return a list of key values.
- If a requested key does not return a key value pair, consider it not
implemented
- If a requested key returns a key not followed by a correct value,
consider it a failure
- otherwise it is a success
Test: vts-tradefed run vts --module VtsHalAudioV2_0Target
Test: call/play music/record/video...
Bug: 36311550
Change-Id: Id6711e9c1974fe5a336b6de83a9b6d14f74437c9
Signed-off-by: Kevin Rocard <krocard@google.com>
diff --git a/audio/2.0/vts/functional/AudioPrimaryHidlHalTest.cpp b/audio/2.0/vts/functional/AudioPrimaryHidlHalTest.cpp
index e1c9549..b8e3454 100644
--- a/audio/2.0/vts/functional/AudioPrimaryHidlHalTest.cpp
+++ b/audio/2.0/vts/functional/AudioPrimaryHidlHalTest.cpp
@@ -878,8 +878,8 @@
TEST_IO_STREAM(GetHwAvSync, "Get hardware sync can not fail",
ASSERT_TRUE(device->getHwAvSync().isOk()))
-static void checkGetParameter(IStream* stream, hidl_vec<hidl_string> keys,
- vector<Result> expectedResults) {
+static void checkGetNoParameter(IStream* stream, hidl_vec<hidl_string> keys,
+ vector<Result> expectedResults) {
hidl_vec<ParameterValue> parameters;
Result res;
ASSERT_OK(stream->getParameters(keys, returnIn(res, parameters)));
@@ -892,16 +892,15 @@
/* Get/Set parameter is intended to be an opaque channel between vendors app and
* their HALs.
* Thus can not be meaningfully tested.
- * TODO: Doc missing. Should asking for an empty set of params raise an error ?
*/
TEST_IO_STREAM(getEmptySetParameter, "Retrieve the values of an empty set",
- checkGetParameter(stream.get(), {} /* keys */,
- {Result::OK, Result::INVALID_ARGUMENTS}))
+ checkGetNoParameter(stream.get(), {} /* keys */, {Result::OK}))
TEST_IO_STREAM(getNonExistingParameter,
"Retrieve the values of an non existing parameter",
- checkGetParameter(stream.get(), {"Non existing key"} /* keys */,
- {Result::INVALID_ARGUMENTS}))
+ checkGetNoParameter(stream.get(),
+ {"Non existing key"} /* keys */,
+ {Result::NOT_SUPPORTED}))
static vector<Result> okOrInvalidArguments = {Result::OK,
Result::INVALID_ARGUMENTS};