Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d2c99594 authored by Mikhail Naganov's avatar Mikhail Naganov Committed by Cherrypicker Worker
Browse files

audio: Skip stream I/O test for "echo reference" input device

This is aligned with the HIDL implementation VTS. The echo reference
device can't provide any input until certain preconditions are met,
and modeling these preconditions in the test is not trivial.

Also, add the information into the mix port into the trace scope
for easier identification on test failure.

Bug: 328010709
Test: atest VtsHalAudioCoreTargetTest
(cherry picked from https://android-review.googlesource.com/q/commit:a62c5df181b37bb7a066cbd154cb13a59a596345)
Merged-In: I737479d8ef1961791ac3bd82aeb779453d2e49f4
Change-Id: I737479d8ef1961791ac3bd82aeb779453d2e49f4
24D1-dev is based on 24Q2-release. Therefore, we merged this CL to 24D1-dev.
parent f821367c
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -551,6 +551,11 @@ std::vector<AudioPortConfig> ModuleConfig::generateAudioDevicePortConfigs(
    return result;
}

std::optional<AudioPort> ModuleConfig::getPort(int32_t portId) {
    auto portsIt = findById(mPorts, portId);
    return portsIt != mPorts.end() ? std::optional<AudioPort>(*portsIt) : std::nullopt;
}

ndk::ScopedAStatus ModuleConfig::onExternalDeviceConnected(IModule* module, const AudioPort& port) {
    RETURN_STATUS_IF_ERROR(module->getAudioPorts(&mPorts));
    RETURN_STATUS_IF_ERROR(module->getAudioRoutes(&mRoutes));
+2 −0
Original line number Diff line number Diff line
@@ -166,6 +166,8 @@ class ModuleConfig {
        return *config.begin();
    }

    std::optional<aidl::android::media::audio::common::AudioPort> getPort(int32_t portId);

    ndk::ScopedAStatus onExternalDeviceConnected(
            aidl::android::hardware::audio::core::IModule* module,
            const aidl::android::media::audio::common::AudioPort& port);
+10 −0
Original line number Diff line number Diff line
@@ -2980,6 +2980,11 @@ static bool skipStreamIoTestForMixPortConfig(const AudioPortConfig& portConfig)
                     AudioOutputFlags::COMPRESS_OFFLOAD, AudioOutputFlags::INCALL_MUSIC}));
}

// Certain types of devices can not be used without special preconditions.
static bool skipStreamIoTestForDevice(const AudioDevice& device) {
    return device.type.type == AudioDeviceType::IN_ECHO_REFERENCE;
}

template <typename Stream>
class StreamFixtureWithWorker {
  public:
@@ -3888,6 +3893,9 @@ class AudioStreamIo : public AudioCoreModuleBase,
            GTEST_SKIP() << "No mix ports have attached devices";
        }
        for (const auto& portConfig : allPortConfigs) {
            auto port = moduleConfig->getPort(portConfig.portId);
            ASSERT_TRUE(port.has_value());
            SCOPED_TRACE(port->toString());
            SCOPED_TRACE(portConfig.toString());
            if (skipStreamIoTestForMixPortConfig(portConfig)) continue;
            const bool isNonBlocking =
@@ -3970,6 +3978,7 @@ class AudioStreamIo : public AudioCoreModuleBase,
        StreamFixture<Stream> stream;
        ASSERT_NO_FATAL_FAILURE(
                stream.SetUpStreamForMixPortConfig(module.get(), moduleConfig.get(), portConfig));
        if (skipStreamIoTestForDevice(stream.getDevice())) return;
        ASSERT_EQ("", stream.skipTestReason());
        StreamLogicDefaultDriver driver(commandsAndStates,
                                        stream.getStreamContext()->getFrameSizeBytes());
@@ -3998,6 +4007,7 @@ class AudioStreamIo : public AudioCoreModuleBase,
        StreamFixture<Stream> stream;
        ASSERT_NO_FATAL_FAILURE(
                stream.SetUpPatchForMixPortConfig(module.get(), moduleConfig.get(), portConfig));
        if (skipStreamIoTestForDevice(stream.getDevice())) return;
        ASSERT_EQ("", stream.skipTestReason());
        ASSERT_NO_FATAL_FAILURE(stream.TeardownPatchSetUpStream(module.get()));
        StreamLogicDefaultDriver driver(commandsAndStates,