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

Commit eeda2b2e authored by Shunkai Yao's avatar Shunkai Yao
Browse files

Effect AIDL VTS: skip state check after STOP if draining is not supported

some HAL implementations may need to do draining before transit to IDLE
Draining state introduced in kDrainSupportedVersion

Flag: EXEMPT bugfix
Bug: 386161796
Test: atest --test-mapping hardware/interfaces/audio/aidl/vts:presubmit
Change-Id: I74d3d674950cbdaf4ae5e6d839dd06f96b2e8142
parent bbfc9866
Loading
Loading
Loading
Loading
+11 −2
Original line number Diff line number Diff line
@@ -47,6 +47,7 @@ using aidl::android::hardware::audio::effect::getEffectTypeUuidSpatializer;
using aidl::android::hardware::audio::effect::getRange;
using aidl::android::hardware::audio::effect::IEffect;
using aidl::android::hardware::audio::effect::isRangeValid;
using aidl::android::hardware::audio::effect::kDrainSupportedVersion;
using aidl::android::hardware::audio::effect::kEffectTypeUuidSpatializer;
using aidl::android::hardware::audio::effect::kEventFlagDataMqNotEmpty;
using aidl::android::hardware::audio::effect::kEventFlagDataMqUpdate;
@@ -195,8 +196,11 @@ class EffectHelper {
                ASSERT_TRUE(expectState(effect, State::PROCESSING));
                break;
            case CommandId::STOP:
                // Enforce the state checking after kDrainSupportedVersion
                if (getHalVersion(effect) >= kDrainSupportedVersion) {
                    ASSERT_TRUE(expectState(effect, State::IDLE) ||
                                expectState(effect, State::DRAINING));
                }
                break;
            case CommandId::RESET:
                ASSERT_TRUE(expectState(effect, State::IDLE));
@@ -518,6 +522,11 @@ class EffectHelper {
        }
    }

    static int getHalVersion(const std::shared_ptr<IEffect>& effect) {
        int version = 0;
        return (effect && effect->getInterfaceVersion(&version).isOk()) ? version : 0;
    }

    bool mIsSpatializer;
    Descriptor mDescriptor;
    size_t mInputFrameSize, mOutputFrameSize;