audio: Allow Stream SM to stay in DRAINING state for early notify
Since for the "early notify" drain the stream sends `onDrainReady`
sligtly before the draining has actually finished, it should be
allowed to stay in the `DRAINING` state while sending this
notification. The stream gets into the `IDLE` state once the drain
has completed. While draining is ongoing, it is allowed for
the client to pause the stream.
As this is a new behavior in audio.core V3, extend VTS to skip
tests that verify this behavior for previous audio HAL versions.
Also, add previously missed `DrainOutAsync` scenario to the tests
list.
Bug: 363958142
Test: atest VtsHalAudioCoreTargetTest
Change-Id: I6878b07c2fa1ce4f19b3c9c5d0e0f2e5288e55c4
diff --git a/audio/aidl/default/Module.cpp b/audio/aidl/default/Module.cpp
index 51b6085..e96cf81 100644
--- a/audio/aidl/default/Module.cpp
+++ b/audio/aidl/default/Module.cpp
@@ -207,9 +207,9 @@
return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT);
}
const auto& flags = portConfigIt->flags.value();
- StreamContext::DebugParameters params{mDebug.streamTransientStateDelayMs,
- mVendorDebug.forceTransientBurst,
- mVendorDebug.forceSynchronousDrain};
+ StreamContext::DebugParameters params{
+ mDebug.streamTransientStateDelayMs, mVendorDebug.forceTransientBurst,
+ mVendorDebug.forceSynchronousDrain, mVendorDebug.forceDrainToDraining};
std::unique_ptr<StreamContext::DataMQ> dataMQ = nullptr;
std::shared_ptr<IStreamCallback> streamAsyncCallback = nullptr;
std::shared_ptr<ISoundDose> soundDose;
@@ -1524,6 +1524,7 @@
const std::string Module::VendorDebug::kForceTransientBurstName = "aosp.forceTransientBurst";
const std::string Module::VendorDebug::kForceSynchronousDrainName = "aosp.forceSynchronousDrain";
+const std::string Module::VendorDebug::kForceDrainToDrainingName = "aosp.forceDrainToDraining";
ndk::ScopedAStatus Module::getVendorParameters(const std::vector<std::string>& in_ids,
std::vector<VendorParameter>* _aidl_return) {
@@ -1538,6 +1539,10 @@
VendorParameter forceSynchronousDrain{.id = id};
forceSynchronousDrain.ext.setParcelable(Boolean{mVendorDebug.forceSynchronousDrain});
_aidl_return->push_back(std::move(forceSynchronousDrain));
+ } else if (id == VendorDebug::kForceDrainToDrainingName) {
+ VendorParameter forceDrainToDraining{.id = id};
+ forceDrainToDraining.ext.setParcelable(Boolean{mVendorDebug.forceDrainToDraining});
+ _aidl_return->push_back(std::move(forceDrainToDraining));
} else {
allParametersKnown = false;
LOG(VERBOSE) << __func__ << ": " << mType << ": unrecognized parameter \"" << id << "\"";
@@ -1578,6 +1583,10 @@
if (!extractParameter<Boolean>(p, &mVendorDebug.forceSynchronousDrain)) {
return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT);
}
+ } else if (p.id == VendorDebug::kForceDrainToDrainingName) {
+ if (!extractParameter<Boolean>(p, &mVendorDebug.forceDrainToDraining)) {
+ return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT);
+ }
} else {
allParametersKnown = false;
LOG(VERBOSE) << __func__ << ": " << mType << ": unrecognized parameter \"" << p.id