Revert^2 "Synchronize bar expansion with WM Shell"

799802cb7e

Flag: com.android.wm.shell.enable_bubble_bar
Fixes: 339683389
Test: atest BubbleBarViewAnimatorTest
Change-Id: Icd853eb76b20ee5ca035bd20c9360f5b60ecc00d
This commit is contained in:
Liran Binyamin
2024-08-15 08:18:42 +00:00
parent 799802cb7e
commit 02fdb75687
5 changed files with 158 additions and 22 deletions

View File

@@ -64,6 +64,7 @@ class BubbleBarViewAnimatorTest {
private lateinit var bubble: BubbleBarBubble
private lateinit var bubbleBarView: BubbleBarView
private lateinit var bubbleStashController: BubbleStashController
private val onExpandedNoOp = Runnable {}
@Before
fun setUp() {
@@ -81,7 +82,12 @@ class BubbleBarViewAnimatorTest {
whenever(bubbleStashController.getStashedHandlePhysicsAnimator()).thenReturn(handleAnimator)
val animator =
BubbleBarViewAnimator(bubbleBarView, bubbleStashController, animatorScheduler)
BubbleBarViewAnimator(
bubbleBarView,
bubbleStashController,
onExpandedNoOp,
animatorScheduler
)
InstrumentationRegistry.getInstrumentation().runOnMainSync {
animator.animateBubbleInForStashed(bubble, isExpanding = false)
@@ -125,7 +131,12 @@ class BubbleBarViewAnimatorTest {
whenever(bubbleStashController.getStashedHandlePhysicsAnimator()).thenReturn(handleAnimator)
val animator =
BubbleBarViewAnimator(bubbleBarView, bubbleStashController, animatorScheduler)
BubbleBarViewAnimator(
bubbleBarView,
bubbleStashController,
onExpandedNoOp,
animatorScheduler
)
InstrumentationRegistry.getInstrumentation().runOnMainSync {
animator.animateBubbleInForStashed(bubble, isExpanding = false)
@@ -168,7 +179,12 @@ class BubbleBarViewAnimatorTest {
whenever(bubbleStashController.getStashedHandlePhysicsAnimator()).thenReturn(handleAnimator)
val animator =
BubbleBarViewAnimator(bubbleBarView, bubbleStashController, animatorScheduler)
BubbleBarViewAnimator(
bubbleBarView,
bubbleStashController,
onExpandedNoOp,
animatorScheduler
)
InstrumentationRegistry.getInstrumentation().runOnMainSync {
animator.animateBubbleInForStashed(bubble, isExpanding = false)
@@ -208,7 +224,12 @@ class BubbleBarViewAnimatorTest {
whenever(bubbleStashController.getStashedHandlePhysicsAnimator()).thenReturn(handleAnimator)
val animator =
BubbleBarViewAnimator(bubbleBarView, bubbleStashController, animatorScheduler)
BubbleBarViewAnimator(
bubbleBarView,
bubbleStashController,
onExpandedNoOp,
animatorScheduler
)
InstrumentationRegistry.getInstrumentation().runOnMainSync {
animator.animateBubbleInForStashed(bubble, isExpanding = false)
@@ -249,7 +270,12 @@ class BubbleBarViewAnimatorTest {
whenever(bubbleStashController.getStashedHandlePhysicsAnimator()).thenReturn(handleAnimator)
val animator =
BubbleBarViewAnimator(bubbleBarView, bubbleStashController, animatorScheduler)
BubbleBarViewAnimator(
bubbleBarView,
bubbleStashController,
onExpandedNoOp,
animatorScheduler
)
InstrumentationRegistry.getInstrumentation().runOnMainSync {
animator.animateBubbleInForStashed(bubble, isExpanding = false)
@@ -278,8 +304,15 @@ class BubbleBarViewAnimatorTest {
val handleAnimator = PhysicsAnimator.getInstance(handle)
whenever(bubbleStashController.getStashedHandlePhysicsAnimator()).thenReturn(handleAnimator)
var notifiedExpanded = false
val onExpanded = Runnable { notifiedExpanded = true }
val animator =
BubbleBarViewAnimator(bubbleBarView, bubbleStashController, animatorScheduler)
BubbleBarViewAnimator(
bubbleBarView,
bubbleStashController,
onExpanded,
animatorScheduler
)
InstrumentationRegistry.getInstrumentation().runOnMainSync {
animator.animateBubbleInForStashed(bubble, isExpanding = true)
@@ -303,6 +336,7 @@ class BubbleBarViewAnimatorTest {
assertThat(animatorScheduler.delayedBlock).isNull()
verify(bubbleStashController).showBubbleBarImmediate()
assertThat(notifiedExpanded).isTrue()
}
@Test
@@ -314,8 +348,15 @@ class BubbleBarViewAnimatorTest {
val handleAnimator = PhysicsAnimator.getInstance(handle)
whenever(bubbleStashController.getStashedHandlePhysicsAnimator()).thenReturn(handleAnimator)
var notifiedExpanded = false
val onExpanded = Runnable { notifiedExpanded = true }
val animator =
BubbleBarViewAnimator(bubbleBarView, bubbleStashController, animatorScheduler)
BubbleBarViewAnimator(
bubbleBarView,
bubbleStashController,
onExpanded,
animatorScheduler
)
InstrumentationRegistry.getInstrumentation().runOnMainSync {
animator.animateBubbleInForStashed(bubble, isExpanding = false)
@@ -345,6 +386,7 @@ class BubbleBarViewAnimatorTest {
.isEqualTo(DIFF_BETWEEN_HANDLE_AND_BAR_CENTERS + BAR_TRANSLATION_Y_FOR_TASKBAR)
verifyBubbleBarIsExpandedWithTranslation(BAR_TRANSLATION_Y_FOR_TASKBAR)
assertThat(animator.isAnimating).isFalse()
assertThat(notifiedExpanded).isTrue()
}
@Test
@@ -356,8 +398,15 @@ class BubbleBarViewAnimatorTest {
val handleAnimator = PhysicsAnimator.getInstance(handle)
whenever(bubbleStashController.getStashedHandlePhysicsAnimator()).thenReturn(handleAnimator)
var notifiedExpanded = false
val onExpanded = Runnable { notifiedExpanded = true }
val animator =
BubbleBarViewAnimator(bubbleBarView, bubbleStashController, animatorScheduler)
BubbleBarViewAnimator(
bubbleBarView,
bubbleStashController,
onExpanded,
animatorScheduler
)
InstrumentationRegistry.getInstrumentation().runOnMainSync {
animator.animateBubbleInForStashed(bubble, isExpanding = false)
@@ -384,6 +433,7 @@ class BubbleBarViewAnimatorTest {
.isEqualTo(DIFF_BETWEEN_HANDLE_AND_BAR_CENTERS + BAR_TRANSLATION_Y_FOR_TASKBAR)
verifyBubbleBarIsExpandedWithTranslation(BAR_TRANSLATION_Y_FOR_TASKBAR)
assertThat(animator.isAnimating).isFalse()
assertThat(notifiedExpanded).isTrue()
}
@Test
@@ -400,7 +450,12 @@ class BubbleBarViewAnimatorTest {
val barAnimator = PhysicsAnimator.getInstance(bubbleBarView)
val animator =
BubbleBarViewAnimator(bubbleBarView, bubbleStashController, animatorScheduler)
BubbleBarViewAnimator(
bubbleBarView,
bubbleStashController,
onExpandedNoOp,
animatorScheduler
)
InstrumentationRegistry.getInstrumentation().runOnMainSync {
animator.animateToInitialState(bubble, isInApp = true, isExpanding = false)
@@ -442,8 +497,15 @@ class BubbleBarViewAnimatorTest {
val barAnimator = PhysicsAnimator.getInstance(bubbleBarView)
var notifiedExpanded = false
val onExpanded = Runnable { notifiedExpanded = true }
val animator =
BubbleBarViewAnimator(bubbleBarView, bubbleStashController, animatorScheduler)
BubbleBarViewAnimator(
bubbleBarView,
bubbleStashController,
onExpanded,
animatorScheduler
)
InstrumentationRegistry.getInstrumentation().runOnMainSync {
animator.animateToInitialState(bubble, isInApp = true, isExpanding = true)
@@ -459,6 +521,7 @@ class BubbleBarViewAnimatorTest {
assertThat(animatorScheduler.delayedBlock).isNull()
verify(bubbleStashController).showBubbleBarImmediate()
assertThat(notifiedExpanded).isTrue()
}
@Test
@@ -471,7 +534,12 @@ class BubbleBarViewAnimatorTest {
val barAnimator = PhysicsAnimator.getInstance(bubbleBarView)
val animator =
BubbleBarViewAnimator(bubbleBarView, bubbleStashController, animatorScheduler)
BubbleBarViewAnimator(
bubbleBarView,
bubbleStashController,
onExpandedNoOp,
animatorScheduler
)
InstrumentationRegistry.getInstrumentation().runOnMainSync {
animator.animateToInitialState(bubble, isInApp = false, isExpanding = false)
@@ -502,8 +570,15 @@ class BubbleBarViewAnimatorTest {
whenever(bubbleStashController.bubbleBarTranslationY)
.thenReturn(BAR_TRANSLATION_Y_FOR_HOTSEAT)
var notifiedExpanded = false
val onExpanded = Runnable { notifiedExpanded = true }
val animator =
BubbleBarViewAnimator(bubbleBarView, bubbleStashController, animatorScheduler)
BubbleBarViewAnimator(
bubbleBarView,
bubbleStashController,
onExpanded,
animatorScheduler
)
InstrumentationRegistry.getInstrumentation().runOnMainSync {
animator.animateToInitialState(bubble, isInApp = false, isExpanding = false)
@@ -533,6 +608,7 @@ class BubbleBarViewAnimatorTest {
verifyBubbleBarIsExpandedWithTranslation(BAR_TRANSLATION_Y_FOR_HOTSEAT)
assertThat(animator.isAnimating).isFalse()
verify(bubbleStashController).showBubbleBarImmediate()
assertThat(notifiedExpanded).isTrue()
}
@Test
@@ -542,8 +618,15 @@ class BubbleBarViewAnimatorTest {
whenever(bubbleStashController.bubbleBarTranslationY)
.thenReturn(BAR_TRANSLATION_Y_FOR_HOTSEAT)
var notifiedExpanded = false
val onExpanded = Runnable { notifiedExpanded = true }
val animator =
BubbleBarViewAnimator(bubbleBarView, bubbleStashController, animatorScheduler)
BubbleBarViewAnimator(
bubbleBarView,
bubbleStashController,
onExpanded,
animatorScheduler
)
InstrumentationRegistry.getInstrumentation().runOnMainSync {
animator.animateToInitialState(bubble, isInApp = false, isExpanding = false)
@@ -566,6 +649,7 @@ class BubbleBarViewAnimatorTest {
verifyBubbleBarIsExpandedWithTranslation(BAR_TRANSLATION_Y_FOR_HOTSEAT)
assertThat(animator.isAnimating).isFalse()
assertThat(notifiedExpanded).isTrue()
}
@Test
@@ -578,7 +662,12 @@ class BubbleBarViewAnimatorTest {
val barAnimator = PhysicsAnimator.getInstance(bubbleBarView)
val animator =
BubbleBarViewAnimator(bubbleBarView, bubbleStashController, animatorScheduler)
BubbleBarViewAnimator(
bubbleBarView,
bubbleStashController,
onExpandedNoOp,
animatorScheduler
)
InstrumentationRegistry.getInstrumentation().runOnMainSync {
animator.animateBubbleBarForCollapsed(bubble, isExpanding = false)
@@ -617,8 +706,15 @@ class BubbleBarViewAnimatorTest {
val barAnimator = PhysicsAnimator.getInstance(bubbleBarView)
var notifiedExpanded = false
val onExpanded = Runnable { notifiedExpanded = true }
val animator =
BubbleBarViewAnimator(bubbleBarView, bubbleStashController, animatorScheduler)
BubbleBarViewAnimator(
bubbleBarView,
bubbleStashController,
onExpanded,
animatorScheduler
)
InstrumentationRegistry.getInstrumentation().runOnMainSync {
animator.animateBubbleBarForCollapsed(bubble, isExpanding = true)
@@ -645,6 +741,7 @@ class BubbleBarViewAnimatorTest {
assertThat(bubbleBarView.translationY).isEqualTo(BAR_TRANSLATION_Y_FOR_HOTSEAT)
assertThat(bubbleBarView.isExpanded).isTrue()
verify(bubbleStashController).showBubbleBarImmediate()
assertThat(notifiedExpanded).isTrue()
}
@Test
@@ -656,8 +753,15 @@ class BubbleBarViewAnimatorTest {
val barAnimator = PhysicsAnimator.getInstance(bubbleBarView)
var notifiedExpanded = false
val onExpanded = Runnable { notifiedExpanded = true }
val animator =
BubbleBarViewAnimator(bubbleBarView, bubbleStashController, animatorScheduler)
BubbleBarViewAnimator(
bubbleBarView,
bubbleStashController,
onExpanded,
animatorScheduler
)
InstrumentationRegistry.getInstrumentation().runOnMainSync {
animator.animateBubbleBarForCollapsed(bubble, isExpanding = false)
@@ -695,6 +799,7 @@ class BubbleBarViewAnimatorTest {
assertThat(bubbleBarView.translationY).isEqualTo(BAR_TRANSLATION_Y_FOR_HOTSEAT)
assertThat(bubbleBarView.isExpanded).isTrue()
verify(bubbleStashController).showBubbleBarImmediate()
assertThat(notifiedExpanded).isTrue()
}
@Test
@@ -706,8 +811,15 @@ class BubbleBarViewAnimatorTest {
val barAnimator = PhysicsAnimator.getInstance(bubbleBarView)
var notifiedExpanded = false
val onExpanded = Runnable { notifiedExpanded = true }
val animator =
BubbleBarViewAnimator(bubbleBarView, bubbleStashController, animatorScheduler)
BubbleBarViewAnimator(
bubbleBarView,
bubbleStashController,
onExpanded,
animatorScheduler
)
InstrumentationRegistry.getInstrumentation().runOnMainSync {
animator.animateBubbleBarForCollapsed(bubble, isExpanding = false)
@@ -742,6 +854,7 @@ class BubbleBarViewAnimatorTest {
assertThat(bubbleBarView.translationY).isEqualTo(BAR_TRANSLATION_Y_FOR_HOTSEAT)
assertThat(bubbleBarView.isExpanded).isTrue()
verify(bubbleStashController).showBubbleBarImmediate()
assertThat(notifiedExpanded).isTrue()
}
private fun setUpBubbleBar() {