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

Commit 1ce9d548 authored by Mikhail Naganov's avatar Mikhail Naganov
Browse files

audio VTS: Fix handling of ULTRASOUND sources

When opening a stream on an ultrasound input
(AUDIO_INPUT_FLAG_ULTRASOUND), the source type
AUDIO_SOURCE_ULTRASOUND must be used.

Bug: 231275185
Test: atest VtsHalAudioV7_0TargetTest
Test: atest VtsHalAudioV7_1TargetTest
Change-Id: Ib1fb5b8218eb0c52edf31789fa937c0a8b6c5082
parent fa82476e
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -715,7 +715,7 @@ class PcmOnlyConfigInputStreamTest : public InputStreamTest {
            sink.base.channelMask.value(getConfig().base.channelMask);
            sink.ext.mix({});
            sink.ext.mix().ioHandle = helper.getIoHandle();
            sink.ext.mix().useCase.source(toString(xsd::AudioSource::AUDIO_SOURCE_MIC));
            sink.ext.mix().useCase.source(initMetadata.tracks[0].source);
            EXPECT_OK(getDevice()->createAudioPatch(hidl_vec<AudioPortConfig>{source},
                                                    hidl_vec<AudioPortConfig>{sink},
                                                    returnIn(res, mPatchHandle)));
+10 −3
Original line number Diff line number Diff line
@@ -1239,23 +1239,30 @@ class InputStreamTest
    : public OpenStreamTest<::android::hardware::audio::CORE_TYPES_CPP_VERSION::IStreamIn> {
    void SetUp() override {
        ASSERT_NO_FATAL_FAILURE(OpenStreamTest::SetUp());  // setup base
        auto flags = getInputFlags();
#if MAJOR_VERSION <= 6
        address.device = AudioDevice::IN_DEFAULT;
#elif MAJOR_VERSION >= 7
        auto maybeSourceAddress = getCachedPolicyConfig().getSourceDeviceForMixPort(
                getDeviceName(), getMixPortName());
        auto& metadata = initMetadata.tracks[0];
        if (maybeSourceAddress.has_value() &&
            !xsd::isTelephonyDevice(maybeSourceAddress.value().deviceType)) {
            address = maybeSourceAddress.value();
            auto& metadata = initMetadata.tracks[0];
            metadata.source = toString(xsd::AudioSource::AUDIO_SOURCE_UNPROCESSED);
            metadata.channelMask = getConfig().base.channelMask;
        } else {
            address.deviceType = toString(xsd::AudioDevice::AUDIO_DEVICE_IN_DEFAULT);
        }
#endif
#if MAJOR_VERSION == 7 && MINOR_VERSION >= 1
        auto flagsIt = std::find(flags.begin(), flags.end(),
                                 toString(xsd::AudioInOutFlag::AUDIO_INPUT_FLAG_ULTRASOUND));
        if (flagsIt != flags.end()) {
            metadata.source = toString(xsd::AudioSource::AUDIO_SOURCE_ULTRASOUND);
        }
#endif  // 7.1
#endif  // MAJOR_VERSION >= 7
        const AudioConfig& config = getConfig();
        auto flags = getInputFlags();
        testOpen(
                [&](AudioIoHandle handle, AudioConfig config, auto cb) {
                    return getDevice()->openInputStream(handle, address, config, flags,