Merge "Wait stream to idle after Preview unbind in UseCaseCombinationTest" into androidx-main
diff --git a/camera/integration-tests/coretestapp/src/androidTest/java/androidx/camera/integration/core/UseCaseCombinationTest.kt b/camera/integration-tests/coretestapp/src/androidTest/java/androidx/camera/integration/core/UseCaseCombinationTest.kt
index 827363f..619337d 100644
--- a/camera/integration-tests/coretestapp/src/androidTest/java/androidx/camera/integration/core/UseCaseCombinationTest.kt
+++ b/camera/integration-tests/coretestapp/src/androidTest/java/androidx/camera/integration/core/UseCaseCombinationTest.kt
@@ -44,6 +44,7 @@
 import java.util.concurrent.TimeUnit
 import kotlinx.coroutines.Dispatchers
 import kotlinx.coroutines.asExecutor
+import kotlinx.coroutines.delay
 import kotlinx.coroutines.runBlocking
 import kotlinx.coroutines.withContext
 import org.junit.After
@@ -399,7 +400,8 @@
         withContext(Dispatchers.Main) {
             cameraProvider.unbind(preview)
         }
-        previewMonitor.waitForStreamIdle()
+        delay(1000) // Unbind and stop the output stream should be done within 1 sec.
+        previewMonitor.waitForStreamIdle(count = 1, timeMillis = TimeUnit.SECONDS.toMillis(2))
 
         // Assert
         imageCapture.waitForCapturing()