audio: Fix AudioRecordTest#testTimestamp CTS on CF
After experimenting, it seems that the input poll
is more stable after the PCM input on CF has just
been opened. Since calling 'flush' on an input
stream puts it into the 'STANDBY' state, explicitly
call 'StreamAlsa::standby' after 'flush' in the
primary input stream implementation.
Bug: 340899868
Bug: 362852052
Bug: 372951987
Test: atest CtsMediaAudioTestCases
Test: atest VtsHalAudioCoreTargetTest
Change-Id: Ic1df6835ce00323ca3f0905ea46d3bc151e05fc4
diff --git a/audio/aidl/default/primary/StreamPrimary.cpp b/audio/aidl/default/primary/StreamPrimary.cpp
index 1176d05..c1c1f03 100644
--- a/audio/aidl/default/primary/StreamPrimary.cpp
+++ b/audio/aidl/default/primary/StreamPrimary.cpp
@@ -56,7 +56,9 @@
}
::android::status_t StreamPrimary::flush() {
- return isStubStreamOnWorker() ? mStubDriver.flush() : StreamAlsa::flush();
+ RETURN_STATUS_IF_ERROR(isStubStreamOnWorker() ? mStubDriver.flush() : StreamAlsa::flush());
+ // TODO(b/372951987): consider if this needs to be done from 'StreamInWorkerLogic::cycle'.
+ return mIsInput ? standby() : ::android::OK;
}
::android::status_t StreamPrimary::pause() {