Stabilise flaky test by waiting for binder calls to be complete
The test is flaky with the error that play/pause button is not visible.
Add wait for binder calls to be completed and device to be idle.
Bug: 232183099
Bug: 232046773
Bug: 232340721
Test: atest PhotoPickerTest --iterations 20
Change-Id: Ic63377f491c8922fab6e37191f028672027e68a7
Merged-In: Ic63377f491c8922fab6e37191f028672027e68a7
(cherry picked from commit 7ba5cafdb8944d14e3aa0ff8554e703365444022)
diff --git a/tests/PhotoPicker/src/android/photopicker/cts/PhotoPickerTest.java b/tests/PhotoPicker/src/android/photopicker/cts/PhotoPickerTest.java
index 92c96a6..57d60f2 100644
--- a/tests/PhotoPicker/src/android/photopicker/cts/PhotoPickerTest.java
+++ b/tests/PhotoPicker/src/android/photopicker/cts/PhotoPickerTest.java
@@ -444,8 +444,6 @@
public void testMultiSelect_previewVideoControlsVisibility() throws Exception {
launchPreviewMultipleWithVideos(/* videoCount */ 3);
- mDevice.waitForIdle();
-
final UiObject playPauseButton = findPlayPauseButton();
final UiObject muteButton = findMuteButton();
// Check that buttons auto hide.
@@ -575,6 +573,10 @@
// buffering -> ready state takes around 10s.
final long playbackStartTimeout = 10000;
(findPreviewVideoImageView()).waitUntilGone(playbackStartTimeout);
+
+ // Wait for Binder calls to complete and device to be idle
+ MediaStore.waitForIdle(mContext.getContentResolver());
+ mDevice.waitForIdle();
}
private void setUpAndAssertStickyPlayerControls(UiObject playerView, UiObject playPauseButton,