Fix flake in BubbleBarViewAnimatorTest
100x run: http://ab/I70900010339337557
Flag: EXEMPT test only
Fixes: 381093181
Test: http://ab/I70900010339337557
Change-Id: Ifd126156d6e69f885b37487743e06d482c2e3921
diff --git a/quickstep/tests/multivalentTests/src/com/android/launcher3/taskbar/bubbles/animation/BubbleBarViewAnimatorTest.kt b/quickstep/tests/multivalentTests/src/com/android/launcher3/taskbar/bubbles/animation/BubbleBarViewAnimatorTest.kt
index e12876f..8beceb0 100644
--- a/quickstep/tests/multivalentTests/src/com/android/launcher3/taskbar/bubbles/animation/BubbleBarViewAnimatorTest.kt
+++ b/quickstep/tests/multivalentTests/src/com/android/launcher3/taskbar/bubbles/animation/BubbleBarViewAnimatorTest.kt
@@ -821,10 +821,12 @@
whenever(bubbleStashController.bubbleBarTranslationY)
.thenReturn(BAR_TRANSLATION_Y_FOR_HOTSEAT)
- val barAnimator = PhysicsAnimator.getInstance(bubbleBarView)
-
+ val semaphore = Semaphore(0)
var notifiedExpanded = false
- val onExpanded = Runnable { notifiedExpanded = true }
+ val onExpanded = Runnable {
+ notifiedExpanded = true
+ semaphore.release()
+ }
val animator =
BubbleBarViewAnimator(
bubbleBarView,
@@ -847,6 +849,10 @@
animatorTestRule.advanceTimeBy(100)
}
+ // verify there is a pending hide animation
+ assertThat(animatorScheduler.delayedBlock).isNotNull()
+ assertThat(animator.isAnimating).isTrue()
+
// send the expand signal in the middle of the lift animation
InstrumentationRegistry.getInstrumentation().runOnMainSync {
animator.expandedWhileAnimating()
@@ -857,14 +863,11 @@
animatorTestRule.advanceTimeBy(150)
}
- // verify there is a pending hide animation
- assertThat(animatorScheduler.delayedBlock).isNotNull()
- assertThat(animator.isAnimating).isTrue()
-
// the lift animation is complete; the spring back animation should start now. wait for it
// to complete
InstrumentationRegistry.getInstrumentation().runOnMainSync {}
- barAnimator.assertIsRunning()
+
+ assertThat(semaphore.tryAcquire(5, TimeUnit.SECONDS)).isTrue()
PhysicsAnimatorTestUtils.blockUntilAnimationsEnd(DynamicAnimation.TRANSLATION_Y)
// verify that the hide animation was canceled