Update setting taskbar window height
Updated the logic to set the taskbar window height to accommodate the bubble bar with its maximum flyout height before the bubble bar animation begins. The height is reverted to the default value once the animation is completed. Fixes: 378400160 Flag: com.android.wm.shell.enable_bubble_bar Test: Manual. Set 3-button navigation mode and have the QSB placed above the hotseat. Send a notification that will display a bubble, and observe the bubble bar animation and final placement aligned with the QSB. Next, set gesture navigation mode and repeat the flow above. Observe that the bubble bar is aligned with the hotseat icons. Felix video: http://recall/-/gx8ASgewUeUS3QYohfrd1J/gYMVt0sH4si0KOpaBxIPem Tangor video: http://recall/-/gx8ASgewUeUS3QYohfrd1J/fz95MbjcjW3awStnuOl8BJ Change-Id: I239f935743c3936fed44822c3c62652073ffefe2
This commit is contained in:
1 parent
28907bcbd6
commit
3111daf2f1
14 files changed
+173
-137
No files matched your search
+66
-22
@@ -36,6 +36,7 @@ import androidx.test.platform.app.InstrumentationRegistry
|
||||
import com.android.launcher3.R
|
||||
import com.android.launcher3.taskbar.bubbles.BubbleBarBubble
|
||||
import com.android.launcher3.taskbar.bubbles.BubbleBarOverflow
|
||||
import com.android.launcher3.taskbar.bubbles.BubbleBarParentViewHeightUpdateNotifier
|
||||
import com.android.launcher3.taskbar.bubbles.BubbleBarView
|
||||
import com.android.launcher3.taskbar.bubbles.BubbleView
|
||||
import com.android.launcher3.taskbar.bubbles.flyout.BubbleBarFlyoutController
|
||||
@@ -69,6 +70,7 @@ class BubbleBarViewAnimatorTest {
|
||||
|
||||
private val context = ApplicationProvider.getApplicationContext<Context>()
|
||||
private lateinit var animatorScheduler: TestBubbleBarViewAnimatorScheduler
|
||||
private lateinit var bubbleBarParentViewController: TestBubbleBarParentViewHeightUpdateNotifier
|
||||
private lateinit var overflowView: BubbleView
|
||||
private lateinit var bubbleView: BubbleView
|
||||
private lateinit var bubble: BubbleBarBubble
|
||||
@@ -84,6 +86,7 @@ class BubbleBarViewAnimatorTest {
|
||||
@Before
|
||||
fun setUp() {
|
||||
animatorScheduler = TestBubbleBarViewAnimatorScheduler()
|
||||
bubbleBarParentViewController = TestBubbleBarParentViewHeightUpdateNotifier()
|
||||
PhysicsAnimatorTestUtils.prepareForTest()
|
||||
setupFlyoutController()
|
||||
}
|
||||
@@ -102,6 +105,7 @@ class BubbleBarViewAnimatorTest {
|
||||
bubbleBarView,
|
||||
bubbleStashController,
|
||||
flyoutController,
|
||||
bubbleBarParentViewController,
|
||||
onExpandedNoOp,
|
||||
animatorScheduler,
|
||||
)
|
||||
@@ -122,7 +126,7 @@ class BubbleBarViewAnimatorTest {
|
||||
assertThat(bubbleBarView.scaleY).isEqualTo(1)
|
||||
assertThat(bubbleBarView.translationY).isEqualTo(BAR_TRANSLATION_Y_FOR_TASKBAR)
|
||||
assertThat(animator.isAnimating).isTrue()
|
||||
|
||||
assertThat(bubbleBarParentViewController.timesInvoked).isEqualTo(1)
|
||||
waitForFlyoutToShow()
|
||||
|
||||
// execute the hide bubble animation
|
||||
@@ -135,6 +139,7 @@ class BubbleBarViewAnimatorTest {
|
||||
InstrumentationRegistry.getInstrumentation().runOnMainSync {}
|
||||
PhysicsAnimatorTestUtils.blockUntilAnimationsEnd(DynamicAnimation.TRANSLATION_Y)
|
||||
|
||||
assertThat(bubbleBarParentViewController.timesInvoked).isEqualTo(2)
|
||||
assertThat(handle.alpha).isEqualTo(1)
|
||||
assertThat(handle.translationY).isEqualTo(0)
|
||||
assertThat(bubbleBarView.alpha).isEqualTo(0)
|
||||
@@ -156,6 +161,7 @@ class BubbleBarViewAnimatorTest {
|
||||
bubbleBarView,
|
||||
bubbleStashController,
|
||||
flyoutController,
|
||||
bubbleBarParentViewController,
|
||||
onExpandedNoOp,
|
||||
animatorScheduler,
|
||||
)
|
||||
@@ -178,7 +184,7 @@ class BubbleBarViewAnimatorTest {
|
||||
assertThat(animator.isAnimating).isTrue()
|
||||
|
||||
verify(bubbleStashController, atLeastOnce()).updateTaskbarTouchRegion()
|
||||
|
||||
assertThat(bubbleBarParentViewController.timesInvoked).isEqualTo(1)
|
||||
waitForFlyoutToShow()
|
||||
|
||||
// verify the hide bubble animation is pending
|
||||
@@ -188,6 +194,7 @@ class BubbleBarViewAnimatorTest {
|
||||
|
||||
waitForFlyoutToHide()
|
||||
|
||||
assertThat(bubbleBarParentViewController.timesInvoked).isEqualTo(2)
|
||||
assertThat(animatorScheduler.delayedBlock).isNull()
|
||||
assertThat(bubbleBarView.alpha).isEqualTo(1)
|
||||
assertThat(bubbleBarView.visibility).isEqualTo(VISIBLE)
|
||||
@@ -209,6 +216,7 @@ class BubbleBarViewAnimatorTest {
|
||||
bubbleBarView,
|
||||
bubbleStashController,
|
||||
flyoutController,
|
||||
bubbleBarParentViewController,
|
||||
onExpandedNoOp,
|
||||
animatorScheduler,
|
||||
)
|
||||
@@ -255,6 +263,7 @@ class BubbleBarViewAnimatorTest {
|
||||
bubbleBarView,
|
||||
bubbleStashController,
|
||||
flyoutController,
|
||||
bubbleBarParentViewController,
|
||||
onExpandedNoOp,
|
||||
animatorScheduler,
|
||||
)
|
||||
@@ -266,7 +275,7 @@ class BubbleBarViewAnimatorTest {
|
||||
// let the animation start and wait for it to complete
|
||||
InstrumentationRegistry.getInstrumentation().runOnMainSync {}
|
||||
PhysicsAnimatorTestUtils.blockUntilAnimationsEnd(DynamicAnimation.TRANSLATION_Y)
|
||||
|
||||
assertThat(bubbleBarParentViewController.timesInvoked).isEqualTo(1)
|
||||
waitForFlyoutToShow()
|
||||
|
||||
// execute the hide bubble animation
|
||||
@@ -282,7 +291,7 @@ class BubbleBarViewAnimatorTest {
|
||||
InstrumentationRegistry.getInstrumentation().runOnMainSync {
|
||||
animator.onStashStateChangingWhileAnimating()
|
||||
}
|
||||
|
||||
assertThat(bubbleBarParentViewController.timesInvoked).isEqualTo(2)
|
||||
assertThat(animator.isAnimating).isFalse()
|
||||
verify(bubbleStashController).onNewBubbleAnimationInterrupted(any(), any())
|
||||
|
||||
@@ -306,6 +315,7 @@ class BubbleBarViewAnimatorTest {
|
||||
bubbleBarView,
|
||||
bubbleStashController,
|
||||
flyoutController,
|
||||
bubbleBarParentViewController,
|
||||
onExpandedNoOp,
|
||||
animatorScheduler,
|
||||
)
|
||||
@@ -344,6 +354,7 @@ class BubbleBarViewAnimatorTest {
|
||||
bubbleBarView,
|
||||
bubbleStashController,
|
||||
flyoutController,
|
||||
bubbleBarParentViewController,
|
||||
onExpanded,
|
||||
animatorScheduler,
|
||||
)
|
||||
@@ -389,6 +400,7 @@ class BubbleBarViewAnimatorTest {
|
||||
bubbleBarView,
|
||||
bubbleStashController,
|
||||
flyoutController,
|
||||
bubbleBarParentViewController,
|
||||
onExpanded,
|
||||
animatorScheduler,
|
||||
)
|
||||
@@ -440,6 +452,7 @@ class BubbleBarViewAnimatorTest {
|
||||
bubbleBarView,
|
||||
bubbleStashController,
|
||||
flyoutController,
|
||||
bubbleBarParentViewController,
|
||||
onExpanded,
|
||||
animatorScheduler,
|
||||
)
|
||||
@@ -454,7 +467,7 @@ class BubbleBarViewAnimatorTest {
|
||||
PhysicsAnimatorTestUtils.blockUntilAnimationsEnd(DynamicAnimation.TRANSLATION_Y)
|
||||
|
||||
assertThat(animator.isAnimating).isTrue()
|
||||
|
||||
assertThat(bubbleBarParentViewController.timesInvoked).isEqualTo(1)
|
||||
waitForFlyoutToShow()
|
||||
|
||||
// verify the hide bubble animation is pending
|
||||
@@ -469,6 +482,7 @@ class BubbleBarViewAnimatorTest {
|
||||
|
||||
waitForFlyoutToHide()
|
||||
|
||||
assertThat(bubbleBarParentViewController.timesInvoked).isEqualTo(2)
|
||||
assertThat(handle.alpha).isEqualTo(0)
|
||||
assertThat(handle.translationY)
|
||||
.isEqualTo(DIFF_BETWEEN_HANDLE_AND_BAR_CENTERS + BAR_TRANSLATION_Y_FOR_TASKBAR)
|
||||
@@ -495,6 +509,7 @@ class BubbleBarViewAnimatorTest {
|
||||
bubbleBarView,
|
||||
bubbleStashController,
|
||||
flyoutController,
|
||||
bubbleBarParentViewController,
|
||||
onExpandedNoOp,
|
||||
animatorScheduler,
|
||||
)
|
||||
@@ -510,7 +525,7 @@ class BubbleBarViewAnimatorTest {
|
||||
assertThat(animator.isAnimating).isTrue()
|
||||
assertThat(bubbleBarView.alpha).isEqualTo(1)
|
||||
assertThat(bubbleBarView.translationY).isEqualTo(BAR_TRANSLATION_Y_FOR_TASKBAR)
|
||||
|
||||
assertThat(bubbleBarParentViewController.timesInvoked).isEqualTo(1)
|
||||
waitForFlyoutToShow()
|
||||
|
||||
assertThat(animatorScheduler.delayedBlock).isNotNull()
|
||||
@@ -522,6 +537,7 @@ class BubbleBarViewAnimatorTest {
|
||||
PhysicsAnimatorTestUtils.blockUntilAnimationsEnd(DynamicAnimation.TRANSLATION_Y)
|
||||
|
||||
InstrumentationRegistry.getInstrumentation().waitForIdleSync()
|
||||
assertThat(bubbleBarParentViewController.timesInvoked).isEqualTo(2)
|
||||
assertThat(animator.isAnimating).isFalse()
|
||||
assertThat(bubbleBarView.alpha).isEqualTo(0)
|
||||
assertThat(handle.translationY).isEqualTo(0)
|
||||
@@ -550,6 +566,7 @@ class BubbleBarViewAnimatorTest {
|
||||
bubbleBarView,
|
||||
bubbleStashController,
|
||||
flyoutController,
|
||||
bubbleBarParentViewController,
|
||||
onExpanded,
|
||||
animatorScheduler,
|
||||
)
|
||||
@@ -585,6 +602,7 @@ class BubbleBarViewAnimatorTest {
|
||||
bubbleBarView,
|
||||
bubbleStashController,
|
||||
flyoutController,
|
||||
bubbleBarParentViewController,
|
||||
onExpandedNoOp,
|
||||
animatorScheduler,
|
||||
)
|
||||
@@ -600,7 +618,7 @@ class BubbleBarViewAnimatorTest {
|
||||
assertThat(animator.isAnimating).isTrue()
|
||||
assertThat(bubbleBarView.alpha).isEqualTo(1)
|
||||
assertThat(bubbleBarView.translationY).isEqualTo(BAR_TRANSLATION_Y_FOR_HOTSEAT)
|
||||
|
||||
assertThat(bubbleBarParentViewController.timesInvoked).isEqualTo(1)
|
||||
waitForFlyoutToShow()
|
||||
|
||||
assertThat(animatorScheduler.delayedBlock).isNotNull()
|
||||
@@ -608,6 +626,7 @@ class BubbleBarViewAnimatorTest {
|
||||
|
||||
waitForFlyoutToHide()
|
||||
|
||||
assertThat(bubbleBarParentViewController.timesInvoked).isEqualTo(2)
|
||||
assertThat(animator.isAnimating).isFalse()
|
||||
assertThat(bubbleBarView.alpha).isEqualTo(1)
|
||||
assertThat(bubbleBarView.translationY).isEqualTo(BAR_TRANSLATION_Y_FOR_HOTSEAT)
|
||||
@@ -629,6 +648,7 @@ class BubbleBarViewAnimatorTest {
|
||||
bubbleBarView,
|
||||
bubbleStashController,
|
||||
flyoutController,
|
||||
bubbleBarParentViewController,
|
||||
onExpanded,
|
||||
animatorScheduler,
|
||||
)
|
||||
@@ -678,6 +698,7 @@ class BubbleBarViewAnimatorTest {
|
||||
bubbleBarView,
|
||||
bubbleStashController,
|
||||
flyoutController,
|
||||
bubbleBarParentViewController,
|
||||
onExpanded,
|
||||
animatorScheduler,
|
||||
)
|
||||
@@ -689,7 +710,7 @@ class BubbleBarViewAnimatorTest {
|
||||
// wait for the animation to start
|
||||
InstrumentationRegistry.getInstrumentation().runOnMainSync {}
|
||||
PhysicsAnimatorTestUtils.blockUntilAnimationsEnd(DynamicAnimation.TRANSLATION_Y)
|
||||
|
||||
assertThat(bubbleBarParentViewController.timesInvoked).isEqualTo(1)
|
||||
waitForFlyoutToShow()
|
||||
|
||||
assertThat(animator.isAnimating).isTrue()
|
||||
@@ -704,6 +725,7 @@ class BubbleBarViewAnimatorTest {
|
||||
|
||||
// verify that the hide animation was canceled
|
||||
assertThat(animatorScheduler.delayedBlock).isNull()
|
||||
assertThat(bubbleBarParentViewController.timesInvoked).isEqualTo(2)
|
||||
|
||||
verifyBubbleBarIsExpandedWithTranslation(BAR_TRANSLATION_Y_FOR_HOTSEAT)
|
||||
assertThat(animator.isAnimating).isFalse()
|
||||
@@ -724,6 +746,7 @@ class BubbleBarViewAnimatorTest {
|
||||
bubbleBarView,
|
||||
bubbleStashController,
|
||||
flyoutController,
|
||||
bubbleBarParentViewController,
|
||||
onExpandedNoOp,
|
||||
animatorScheduler,
|
||||
)
|
||||
@@ -745,7 +768,7 @@ class BubbleBarViewAnimatorTest {
|
||||
InstrumentationRegistry.getInstrumentation().runOnMainSync {}
|
||||
barAnimator.assertIsRunning()
|
||||
PhysicsAnimatorTestUtils.blockUntilAnimationsEnd(DynamicAnimation.TRANSLATION_Y)
|
||||
|
||||
assertThat(bubbleBarParentViewController.timesInvoked).isEqualTo(1)
|
||||
waitForFlyoutToShow()
|
||||
|
||||
assertThat(animatorScheduler.delayedBlock).isNotNull()
|
||||
@@ -754,6 +777,7 @@ class BubbleBarViewAnimatorTest {
|
||||
waitForFlyoutToHide()
|
||||
|
||||
assertThat(animator.isAnimating).isFalse()
|
||||
assertThat(bubbleBarParentViewController.timesInvoked).isEqualTo(2)
|
||||
// the bubble bar translation y should be back to its initial value
|
||||
assertThat(bubbleBarView.translationY).isEqualTo(BAR_TRANSLATION_Y_FOR_HOTSEAT)
|
||||
|
||||
@@ -778,6 +802,7 @@ class BubbleBarViewAnimatorTest {
|
||||
bubbleBarView,
|
||||
bubbleStashController,
|
||||
flyoutController,
|
||||
bubbleBarParentViewController,
|
||||
onExpanded,
|
||||
animatorScheduler,
|
||||
)
|
||||
@@ -830,6 +855,7 @@ class BubbleBarViewAnimatorTest {
|
||||
bubbleBarView,
|
||||
bubbleStashController,
|
||||
flyoutController,
|
||||
bubbleBarParentViewController,
|
||||
onExpanded,
|
||||
animatorScheduler,
|
||||
)
|
||||
@@ -893,6 +919,7 @@ class BubbleBarViewAnimatorTest {
|
||||
bubbleBarView,
|
||||
bubbleStashController,
|
||||
flyoutController,
|
||||
bubbleBarParentViewController,
|
||||
onExpanded,
|
||||
animatorScheduler,
|
||||
)
|
||||
@@ -918,7 +945,7 @@ class BubbleBarViewAnimatorTest {
|
||||
// verify there is a pending hide animation
|
||||
assertThat(animatorScheduler.delayedBlock).isNotNull()
|
||||
assertThat(animator.isAnimating).isTrue()
|
||||
|
||||
assertThat(bubbleBarParentViewController.timesInvoked).isEqualTo(1)
|
||||
waitForFlyoutToShow()
|
||||
|
||||
InstrumentationRegistry.getInstrumentation().runOnMainSync {
|
||||
@@ -930,6 +957,7 @@ class BubbleBarViewAnimatorTest {
|
||||
|
||||
waitForFlyoutToHide()
|
||||
|
||||
assertThat(bubbleBarParentViewController.timesInvoked).isEqualTo(2)
|
||||
assertThat(animator.isAnimating).isFalse()
|
||||
assertThat(bubbleBarView.translationY).isEqualTo(BAR_TRANSLATION_Y_FOR_HOTSEAT)
|
||||
assertThat(bubbleBarView.isExpanded).isTrue()
|
||||
@@ -951,6 +979,7 @@ class BubbleBarViewAnimatorTest {
|
||||
bubbleBarView,
|
||||
bubbleStashController,
|
||||
flyoutController,
|
||||
bubbleBarParentViewController,
|
||||
onExpandedNoOp,
|
||||
animatorScheduler,
|
||||
)
|
||||
@@ -983,7 +1012,7 @@ class BubbleBarViewAnimatorTest {
|
||||
assertThat(bubbleBarView.scaleY).isEqualTo(1)
|
||||
assertThat(bubbleBarView.translationY).isEqualTo(BAR_TRANSLATION_Y_FOR_TASKBAR)
|
||||
assertThat(animator.isAnimating).isTrue()
|
||||
|
||||
assertThat(bubbleBarParentViewController.timesInvoked).isEqualTo(1)
|
||||
waitForFlyoutToShow()
|
||||
assertThat(flyoutView!!.findViewById<TextView>(R.id.bubble_flyout_text).text)
|
||||
.isEqualTo("updated message")
|
||||
@@ -998,6 +1027,7 @@ class BubbleBarViewAnimatorTest {
|
||||
InstrumentationRegistry.getInstrumentation().runOnMainSync {}
|
||||
PhysicsAnimatorTestUtils.blockUntilAnimationsEnd(DynamicAnimation.TRANSLATION_Y)
|
||||
|
||||
assertThat(bubbleBarParentViewController.timesInvoked).isEqualTo(2)
|
||||
assertThat(handle.alpha).isEqualTo(1)
|
||||
assertThat(handle.translationY).isEqualTo(0)
|
||||
assertThat(bubbleBarView.alpha).isEqualTo(0)
|
||||
@@ -1019,6 +1049,7 @@ class BubbleBarViewAnimatorTest {
|
||||
bubbleBarView,
|
||||
bubbleStashController,
|
||||
flyoutController,
|
||||
bubbleBarParentViewController,
|
||||
onExpandedNoOp,
|
||||
animatorScheduler,
|
||||
)
|
||||
@@ -1039,7 +1070,7 @@ class BubbleBarViewAnimatorTest {
|
||||
assertThat(bubbleBarView.scaleY).isEqualTo(1)
|
||||
assertThat(bubbleBarView.translationY).isEqualTo(BAR_TRANSLATION_Y_FOR_TASKBAR)
|
||||
assertThat(animator.isAnimating).isTrue()
|
||||
|
||||
assertThat(bubbleBarParentViewController.timesInvoked).isEqualTo(1)
|
||||
waitForFlyoutToShow()
|
||||
|
||||
assertThat(flyoutView!!.findViewById<TextView>(R.id.bubble_flyout_text).text)
|
||||
@@ -1072,6 +1103,7 @@ class BubbleBarViewAnimatorTest {
|
||||
InstrumentationRegistry.getInstrumentation().runOnMainSync {}
|
||||
PhysicsAnimatorTestUtils.blockUntilAnimationsEnd(DynamicAnimation.TRANSLATION_Y)
|
||||
|
||||
assertThat(bubbleBarParentViewController.timesInvoked).isEqualTo(2)
|
||||
assertThat(handle.alpha).isEqualTo(1)
|
||||
assertThat(handle.translationY).isEqualTo(0)
|
||||
assertThat(bubbleBarView.alpha).isEqualTo(0)
|
||||
@@ -1093,6 +1125,7 @@ class BubbleBarViewAnimatorTest {
|
||||
bubbleBarView,
|
||||
bubbleStashController,
|
||||
flyoutController,
|
||||
bubbleBarParentViewController,
|
||||
onExpandedNoOp,
|
||||
animatorScheduler,
|
||||
)
|
||||
@@ -1113,7 +1146,7 @@ class BubbleBarViewAnimatorTest {
|
||||
assertThat(bubbleBarView.scaleY).isEqualTo(1)
|
||||
assertThat(bubbleBarView.translationY).isEqualTo(BAR_TRANSLATION_Y_FOR_TASKBAR)
|
||||
assertThat(animator.isAnimating).isTrue()
|
||||
|
||||
assertThat(bubbleBarParentViewController.timesInvoked).isEqualTo(1)
|
||||
waitForFlyoutToShow()
|
||||
|
||||
assertThat(flyoutView!!.findViewById<TextView>(R.id.bubble_flyout_text).text)
|
||||
@@ -1134,6 +1167,7 @@ class BubbleBarViewAnimatorTest {
|
||||
// the flyout should now reverse and expand
|
||||
animatorTestRule.advanceTimeBy(400)
|
||||
}
|
||||
assertThat(bubbleBarParentViewController.timesInvoked).isEqualTo(2)
|
||||
|
||||
assertThat(flyoutView!!.findViewById<TextView>(R.id.bubble_flyout_text).text)
|
||||
.isEqualTo("updated message")
|
||||
@@ -1156,6 +1190,7 @@ class BubbleBarViewAnimatorTest {
|
||||
InstrumentationRegistry.getInstrumentation().runOnMainSync {}
|
||||
PhysicsAnimatorTestUtils.blockUntilAnimationsEnd(DynamicAnimation.TRANSLATION_Y)
|
||||
|
||||
assertThat(bubbleBarParentViewController.timesInvoked).isEqualTo(3)
|
||||
assertThat(handle.alpha).isEqualTo(1)
|
||||
assertThat(handle.translationY).isEqualTo(0)
|
||||
assertThat(bubbleBarView.alpha).isEqualTo(0)
|
||||
@@ -1177,6 +1212,7 @@ class BubbleBarViewAnimatorTest {
|
||||
bubbleBarView,
|
||||
bubbleStashController,
|
||||
flyoutController,
|
||||
bubbleBarParentViewController,
|
||||
onExpandedNoOp,
|
||||
animatorScheduler,
|
||||
)
|
||||
@@ -1197,7 +1233,7 @@ class BubbleBarViewAnimatorTest {
|
||||
assertThat(bubbleBarView.scaleY).isEqualTo(1)
|
||||
assertThat(bubbleBarView.translationY).isEqualTo(BAR_TRANSLATION_Y_FOR_TASKBAR)
|
||||
assertThat(animator.isAnimating).isTrue()
|
||||
|
||||
assertThat(bubbleBarParentViewController.timesInvoked).isEqualTo(1)
|
||||
waitForFlyoutToShow()
|
||||
|
||||
assertThat(flyoutView!!.findViewById<TextView>(R.id.bubble_flyout_text).text)
|
||||
@@ -1213,7 +1249,6 @@ class BubbleBarViewAnimatorTest {
|
||||
PhysicsAnimatorTestUtils.blockUntilFirstAnimationFrameWhereTrue(handleAnimator) {
|
||||
bubbleBarView.alpha < 0.5
|
||||
}
|
||||
|
||||
// we're about to interrupt the animation which will cancel the current animation and start
|
||||
// a new one. pause the scheduler to delay starting the new animation. this allows us to run
|
||||
// the test deterministically
|
||||
@@ -1226,9 +1261,11 @@ class BubbleBarViewAnimatorTest {
|
||||
animator.animateBubbleInForStashed(updatedBubble, isExpanding = false)
|
||||
}
|
||||
|
||||
// since animation was interrupted there shouldn`t be additional calls to adjust window
|
||||
assertThat(bubbleBarParentViewController.timesInvoked).isEqualTo(1)
|
||||
|
||||
InstrumentationRegistry.getInstrumentation().runOnMainSync {}
|
||||
PhysicsAnimatorTestUtils.blockUntilAnimationsEnd(DynamicAnimation.TRANSLATION_Y)
|
||||
|
||||
// verify there's a new job scheduled and start it. this is starting the animation from the
|
||||
// handle back to the bar
|
||||
assertThat(animatorScheduler.pausedBlock).isNotNull()
|
||||
@@ -1237,9 +1274,9 @@ class BubbleBarViewAnimatorTest {
|
||||
|
||||
InstrumentationRegistry.getInstrumentation().runOnMainSync {}
|
||||
PhysicsAnimatorTestUtils.blockUntilAnimationsEnd(DynamicAnimation.TRANSLATION_Y)
|
||||
|
||||
waitForFlyoutToShow()
|
||||
|
||||
assertThat(bubbleBarParentViewController.timesInvoked).isEqualTo(2)
|
||||
assertThat(flyoutView!!.findViewById<TextView>(R.id.bubble_flyout_text).text)
|
||||
.isEqualTo("updated message")
|
||||
assertThat(handle.alpha).isEqualTo(0)
|
||||
@@ -1255,7 +1292,6 @@ class BubbleBarViewAnimatorTest {
|
||||
InstrumentationRegistry.getInstrumentation().runOnMainSync(animatorScheduler.delayedBlock!!)
|
||||
|
||||
waitForFlyoutToHide()
|
||||
|
||||
PhysicsAnimatorTestUtils.blockUntilAnimationsEnd(DynamicAnimation.TRANSLATION_Y)
|
||||
|
||||
// verify the hide animation was rescheduled and run it
|
||||
@@ -1268,6 +1304,7 @@ class BubbleBarViewAnimatorTest {
|
||||
InstrumentationRegistry.getInstrumentation().runOnMainSync {}
|
||||
PhysicsAnimatorTestUtils.blockUntilAnimationsEnd(DynamicAnimation.TRANSLATION_Y)
|
||||
|
||||
assertThat(bubbleBarParentViewController.timesInvoked).isEqualTo(3)
|
||||
assertThat(handle.alpha).isEqualTo(1)
|
||||
assertThat(handle.translationY).isEqualTo(0)
|
||||
assertThat(bubbleBarView.alpha).isEqualTo(0)
|
||||
@@ -1289,6 +1326,7 @@ class BubbleBarViewAnimatorTest {
|
||||
bubbleBarView,
|
||||
bubbleStashController,
|
||||
flyoutController,
|
||||
bubbleBarParentViewController,
|
||||
onExpandedNoOp,
|
||||
animatorScheduler,
|
||||
)
|
||||
@@ -1389,10 +1427,6 @@ class BubbleBarViewAnimatorTest {
|
||||
}
|
||||
val flyoutCallbacks =
|
||||
object : FlyoutCallbacks {
|
||||
override fun extendTopBoundary(space: Int) {}
|
||||
|
||||
override fun resetTopBoundary() {}
|
||||
|
||||
override fun flyoutClicked() {}
|
||||
}
|
||||
val flyoutScheduler = FlyoutScheduler { block -> block.invoke() }
|
||||
@@ -1475,6 +1509,16 @@ class BubbleBarViewAnimatorTest {
|
||||
delayedBlock = null
|
||||
}
|
||||
}
|
||||
|
||||
private class TestBubbleBarParentViewHeightUpdateNotifier :
|
||||
BubbleBarParentViewHeightUpdateNotifier {
|
||||
|
||||
var timesInvoked: Int = 0
|
||||
|
||||
override fun updateTopBoundary() {
|
||||
timesInvoked++
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private const val DIFF_BETWEEN_HANDLE_AND_BAR_CENTERS = -20f
|
||||
|
||||
-53
@@ -127,46 +127,6 @@ class BubbleBarFlyoutControllerTest {
|
||||
assertThat(flyoutController.hasFlyout()).isFalse()
|
||||
}
|
||||
|
||||
@Test
|
||||
fun showFlyout_extendsTopBoundary() {
|
||||
// set negative translation for the flyout so that it will request to extend the top
|
||||
// boundary
|
||||
flyoutTy = -50f
|
||||
InstrumentationRegistry.getInstrumentation().runOnMainSync {
|
||||
setupAndShowFlyout()
|
||||
assertThat(flyoutContainer.childCount).isEqualTo(1)
|
||||
}
|
||||
InstrumentationRegistry.getInstrumentation().waitForIdleSync()
|
||||
InstrumentationRegistry.getInstrumentation().runOnMainSync {
|
||||
animatorTestRule.advanceTimeBy(showAnimationDuration)
|
||||
}
|
||||
assertThat(flyoutCallbacks.topBoundaryExtendedSpace).isEqualTo(50)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun showFlyout_withinBoundary() {
|
||||
InstrumentationRegistry.getInstrumentation().runOnMainSync {
|
||||
setupAndShowFlyout()
|
||||
assertThat(flyoutContainer.childCount).isEqualTo(1)
|
||||
}
|
||||
InstrumentationRegistry.getInstrumentation().waitForIdleSync()
|
||||
InstrumentationRegistry.getInstrumentation().runOnMainSync {
|
||||
animatorTestRule.advanceTimeBy(showAnimationDuration)
|
||||
}
|
||||
assertThat(flyoutCallbacks.topBoundaryExtendedSpace).isEqualTo(0)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun collapseFlyout_resetsTopBoundary() {
|
||||
InstrumentationRegistry.getInstrumentation().runOnMainSync {
|
||||
setupAndShowFlyout()
|
||||
assertThat(flyoutContainer.childCount).isEqualTo(1)
|
||||
flyoutController.collapseFlyout {}
|
||||
animatorTestRule.advanceTimeBy(hideAnimationDuration)
|
||||
}
|
||||
assertThat(flyoutCallbacks.topBoundaryReset).isTrue()
|
||||
}
|
||||
|
||||
@Test
|
||||
fun cancelFlyout_fadesOutFlyout() {
|
||||
InstrumentationRegistry.getInstrumentation().runOnMainSync {
|
||||
@@ -178,7 +138,6 @@ class BubbleBarFlyoutControllerTest {
|
||||
animatorTestRule.advanceTimeBy(hideAnimationDuration)
|
||||
assertThat(flyoutView.alpha).isEqualTo(0f)
|
||||
}
|
||||
assertThat(flyoutCallbacks.topBoundaryReset).isTrue()
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -217,7 +176,6 @@ class BubbleBarFlyoutControllerTest {
|
||||
assertThat(flyout.findViewById<TextView>(R.id.bubble_flyout_text).text)
|
||||
.isEqualTo("new message")
|
||||
}
|
||||
assertThat(flyoutCallbacks.topBoundaryExtendedSpace).isEqualTo(50)
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -246,7 +204,6 @@ class BubbleBarFlyoutControllerTest {
|
||||
animatorTestRule.advanceTimeBy(showAnimationDuration)
|
||||
assertThat(flyout.alpha).isEqualTo(1)
|
||||
}
|
||||
assertThat(flyoutCallbacks.topBoundaryExtendedSpace).isEqualTo(50)
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -290,18 +247,8 @@ class BubbleBarFlyoutControllerTest {
|
||||
|
||||
class FakeFlyoutCallbacks : FlyoutCallbacks {
|
||||
|
||||
var topBoundaryExtendedSpace = 0
|
||||
var topBoundaryReset = false
|
||||
var flyoutClicked = false
|
||||
|
||||
override fun extendTopBoundary(space: Int) {
|
||||
topBoundaryExtendedSpace = space
|
||||
}
|
||||
|
||||
override fun resetTopBoundary() {
|
||||
topBoundaryReset = true
|
||||
}
|
||||
|
||||
override fun flyoutClicked() {
|
||||
flyoutClicked = true
|
||||
}
|
||||
|
||||
+1
-1
@@ -76,7 +76,7 @@ class PersistentBubbleStashControllerTest {
|
||||
PersistentBubbleStashController(DefaultDimensionsProvider())
|
||||
setUpBubbleBarView()
|
||||
setUpBubbleBarController()
|
||||
persistentTaskBarStashController.setBubbleBarVerticalCenterForHome(HOTSEAT_VERTICAL_CENTER)
|
||||
persistentTaskBarStashController.bubbleBarVerticalCenterForHome = HOTSEAT_VERTICAL_CENTER
|
||||
persistentTaskBarStashController.init(
|
||||
taskbarInsetsController,
|
||||
bubbleBarViewController,
|
||||
|
||||
+1
-1
@@ -109,7 +109,7 @@ class TransientBubbleStashControllerTest {
|
||||
setUpStashedHandleView()
|
||||
setUpBubbleStashedHandleViewController()
|
||||
PhysicsAnimatorTestUtils.prepareForTest()
|
||||
mTransientBubbleStashController.setBubbleBarVerticalCenterForHome(HOTSEAT_VERTICAL_CENTER)
|
||||
mTransientBubbleStashController.bubbleBarVerticalCenterForHome = HOTSEAT_VERTICAL_CENTER
|
||||
mTransientBubbleStashController.init(
|
||||
taskbarInsetsController,
|
||||
bubbleBarViewController,
|
||||
|
||||
Reference in new issue
Block a user