Audio HAL VTS: Allow OK when setting a non existing parameter
setHwAvSync and setParameters were implemented in the pre-hidl interface
as set_parameters.
Unfortunately set_parameters did not return an error if a key was not
implemented.
As most HIDL implementation will be a wrapper around the pre-hidl
interface, allow those functions to return OK on not implemented key.
Test: vts-tradefed run vts --module VtsHalAudioV2_0Target
Test: call/play music/record/video...
Bug: 36311550
Change-Id: Icfcaa02b7d63e03375fddc90dc5a803754c1874f
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 b8e3454..20a093f 100644
--- a/audio/2.0/vts/functional/AudioPrimaryHidlHalTest.cpp
+++ b/audio/2.0/vts/functional/AudioPrimaryHidlHalTest.cpp
@@ -869,10 +869,10 @@
"deconnection",
testConnectedState(stream.get()))
-static auto invalidArgsOrNotSupported = {Result::INVALID_ARGUMENTS,
- Result::NOT_SUPPORTED};
+static auto invalidArgsOrNotSupportedOrOK = {Result::INVALID_ARGUMENTS,
+ Result::NOT_SUPPORTED, Result::OK};
TEST_IO_STREAM(SetHwAvSync, "Try to set hardware sync to an invalid value",
- ASSERT_RESULT(invalidArgsOrNotSupported,
+ ASSERT_RESULT(invalidArgsOrNotSupportedOrOK,
stream->setHwAvSync(666)))
TEST_IO_STREAM(GetHwAvSync, "Get hardware sync can not fail",
@@ -902,15 +902,17 @@
{"Non existing key"} /* keys */,
{Result::NOT_SUPPORTED}))
-static vector<Result> okOrInvalidArguments = {Result::OK,
- Result::INVALID_ARGUMENTS};
TEST_IO_STREAM(setEmptySetParameter,
"Set the values of an empty set of parameters",
- ASSERT_RESULT(okOrInvalidArguments, stream->setParameters({})))
+ ASSERT_RESULT(Result::OK, stream->setParameters({})))
TEST_IO_STREAM(
setNonExistingParameter, "Set the values of an non existing parameter",
- ASSERT_RESULT(Result::INVALID_ARGUMENTS,
+ // Unfortunately, the set_parameter legacy interface did not return any
+ // error code when a key is not supported.
+ // To allow implementation to just wrapped the legacy one, consider OK as a
+ // valid result for setting a non existing parameter.
+ ASSERT_RESULT(invalidArgsOrNotSupportedOrOK,
stream->setParameters({{"non existing key", "0"}})))
TEST_IO_STREAM(DebugDump,
@@ -964,6 +966,8 @@
ASSERT_OK(closeStream());
ASSERT_RESULT(Result::INVALID_STATE, closeStream()))
+static auto invalidArgsOrNotSupported = {Result::INVALID_ARGUMENTS,
+ Result::NOT_SUPPORTED};
static void testCreateTooBigMmapBuffer(IStream* stream) {
MmapBufferInfo info;
Result res;