Loading packages/SystemUI/aconfig/systemui.aconfig +0 −10 Original line number Diff line number Diff line Loading @@ -170,16 +170,6 @@ flag { } } flag { name: "notifications_hun_shared_animation_values" namespace: "systemui" description: "Adds a shared class for fetching HUN animation values." bug: "393369891" metadata { purpose: PURPOSE_BUGFIX } } flag { name: "notification_avalanche_throttle_hun" namespace: "systemui" Loading packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/headsup/HeadsUpAnimatorTest.kt +0 −1 Original line number Diff line number Diff line Loading @@ -30,7 +30,6 @@ import org.junit.runner.RunWith @SmallTest @RunWith(AndroidJUnit4::class) @EnableFlags(NotificationsHunSharedAnimationValues.FLAG_NAME) class HeadsUpAnimatorTest : SysuiTestCase() { private val kosmos = testKosmos() Loading packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/stack/StackScrollAlgorithmTest.kt +12 −32 Original line number Diff line number Diff line Loading @@ -31,7 +31,6 @@ import com.android.systemui.statusbar.notification.footer.ui.view.FooterView import com.android.systemui.statusbar.notification.footer.ui.view.FooterView.FooterViewState import com.android.systemui.statusbar.notification.headsup.AvalancheController import com.android.systemui.statusbar.notification.headsup.HeadsUpAnimator import com.android.systemui.statusbar.notification.headsup.NotificationsHunSharedAnimationValues import com.android.systemui.statusbar.notification.promoted.PromotedNotificationUi import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow import com.android.systemui.statusbar.notification.row.ExpandableView Loading Loading @@ -118,10 +117,7 @@ class StackScrollAlgorithmTest(flags: FlagsParameterization) : SysuiTestCase() { @JvmStatic @Parameters(name = "{0}") fun getParams(): List<FlagsParameterization> { return FlagsParameterization.allCombinationsOf( NotificationsHunSharedAnimationValues.FLAG_NAME ) .andSceneContainer() return FlagsParameterization.allCombinationsOf().andSceneContainer() } } Loading @@ -144,15 +140,9 @@ class StackScrollAlgorithmTest(flags: FlagsParameterization) : SysuiTestCase() { hostView.addView(notificationRow) if (NotificationsHunSharedAnimationValues.isEnabled) { headsUpAnimator = HeadsUpAnimator(context, kosmos.fakeSystemBarUtilsProxy) } stackScrollAlgorithm = StackScrollAlgorithm( context, hostView, if (::headsUpAnimator.isInitialized) headsUpAnimator else null, ) StackScrollAlgorithm(context, hostView, headsUpAnimator) } private fun isTv(): Boolean { Loading Loading @@ -754,11 +744,7 @@ class StackScrollAlgorithmTest(flags: FlagsParameterization) : SysuiTestCase() { ambientState.setLayoutMinHeight(2500) // Mock the height of shade ambientState.stackY = 2500f // Scroll over the max translation stackScrollAlgorithm.setIsExpanded(true) // Mark the shade open if (NotificationsHunSharedAnimationValues.isEnabled) { headsUpAnimator.headsUpAppearHeightBottom = bottomOfScreen.toInt() } else { stackScrollAlgorithm.setHeadsUpAppearHeightBottom(bottomOfScreen.toInt()) } whenever(notificationRow.mustStayOnScreen()).thenReturn(true) whenever(notificationRow.isHeadsUp).thenReturn(true) whenever(notificationRow.isAboveShelf).thenReturn(true) Loading @@ -774,9 +760,7 @@ class StackScrollAlgorithmTest(flags: FlagsParameterization) : SysuiTestCase() { val topMargin = 100f ambientState.maxHeadsUpTranslation = 2000f ambientState.stackTopMargin = topMargin.toInt() if (NotificationsHunSharedAnimationValues.isEnabled) { headsUpAnimator.stackTopMargin = topMargin.toInt() } whenever(notificationRow.intrinsicHeight).thenReturn(100) whenever(notificationRow.isHeadsUpAnimatingAway).thenReturn(true) Loading @@ -786,17 +770,17 @@ class StackScrollAlgorithmTest(flags: FlagsParameterization) : SysuiTestCase() { } @Test @EnableFlags(NotificationsHunSharedAnimationValues.FLAG_NAME, PromotedNotificationUi.FLAG_NAME) @EnableFlags(PromotedNotificationUi.FLAG_NAME) fun resetViewStates_hunAnimatingAway_noStatusBarChip_hunTranslatedToTopOfScreen() { val topMargin = 100f ambientState.maxHeadsUpTranslation = 2000f ambientState.stackTopMargin = topMargin.toInt() headsUpAnimator?.stackTopMargin = topMargin.toInt() headsUpAnimator.stackTopMargin = topMargin.toInt() whenever(notificationRow.intrinsicHeight).thenReturn(100) val statusBarHeight = 432 kosmos.fakeSystemBarUtilsProxy.fakeStatusBarHeight = statusBarHeight headsUpAnimator!!.updateResources(context) headsUpAnimator.updateResources(context) whenever(notificationRow.isHeadsUpAnimatingAway).thenReturn(true) whenever(notificationRow.hasStatusBarChipDuringHeadsUpAnimation()).thenReturn(false) Loading @@ -807,17 +791,17 @@ class StackScrollAlgorithmTest(flags: FlagsParameterization) : SysuiTestCase() { } @Test @EnableFlags(NotificationsHunSharedAnimationValues.FLAG_NAME, PromotedNotificationUi.FLAG_NAME) @EnableFlags(PromotedNotificationUi.FLAG_NAME) fun resetViewStates_hunAnimatingAway_withStatusBarChip_hunTranslatedToBottomOfStatusBar() { val topMargin = 100f ambientState.maxHeadsUpTranslation = 2000f ambientState.stackTopMargin = topMargin.toInt() headsUpAnimator?.stackTopMargin = topMargin.toInt() headsUpAnimator.stackTopMargin = topMargin.toInt() whenever(notificationRow.intrinsicHeight).thenReturn(100) val statusBarHeight = 432 kosmos.fakeSystemBarUtilsProxy.fakeStatusBarHeight = statusBarHeight headsUpAnimator!!.updateResources(context) headsUpAnimator.updateResources(context) whenever(notificationRow.isHeadsUpAnimatingAway).thenReturn(true) whenever(notificationRow.hasStatusBarChipDuringHeadsUpAnimation()).thenReturn(true) Loading Loading @@ -1904,11 +1888,7 @@ class StackScrollAlgorithmTest(flags: FlagsParameterization) : SysuiTestCase() { fullStackHeight: Float = 3000f, ) { ambientState.headsUpTop = headsUpTop if (NotificationsHunSharedAnimationValues.isEnabled) { headsUpAnimator.headsUpAppearHeightBottom = headsUpBottom.roundToInt() } else { ambientState.headsUpBottom = headsUpBottom } ambientState.stackTop = stackTop ambientState.drawBounds = RectF(0f, stackTop, 400f, stackBottom) Loading packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/stack/StackStateAnimatorTest.kt +6 −89 Original line number Diff line number Diff line Loading @@ -27,7 +27,6 @@ import com.android.systemui.SysuiTestCase import com.android.systemui.animation.AnimatorTestRule import com.android.systemui.res.R import com.android.systemui.statusbar.notification.headsup.HeadsUpAnimator import com.android.systemui.statusbar.notification.headsup.NotificationsHunSharedAnimationValues import com.android.systemui.statusbar.notification.promoted.PromotedNotificationUi import com.android.systemui.statusbar.notification.row.ExpandableView import com.android.systemui.statusbar.notification.stack.NotificationStackScrollLayout.AnimationEvent Loading Loading @@ -83,9 +82,7 @@ class StackStateAnimatorTest : SysuiTestCase() { whenever(stackScroller.context).thenReturn(context) whenever(view.viewState).thenReturn(viewState) if (NotificationsHunSharedAnimationValues.isEnabled) { headsUpAnimator = HeadsUpAnimator(context, kosmos.fakeSystemBarUtilsProxy) } stackStateAnimator = StackStateAnimator( mContext, Loading @@ -95,30 +92,7 @@ class StackStateAnimatorTest : SysuiTestCase() { } @Test @DisableFlags(NotificationsHunSharedAnimationValues.FLAG_NAME) fun startAnimationForEvents_headsUpFromTop_startsHeadsUpAppearAnim_flagOff() { val topMargin = 50f val expectedStartY = -topMargin - stackStateAnimator.mHeadsUpAppearStartAboveScreen val event = AnimationEvent(view, AnimationEvent.ANIMATION_TYPE_HEADS_UP_APPEAR) stackStateAnimator.setStackTopMargin(topMargin.toInt()) stackStateAnimator.startAnimationForEvents(arrayListOf(event), 0) verify(view).setFinalActualHeight(VIEW_HEIGHT) verify(view, description("should animate from the top")).translationY = expectedStartY verify(view) .performAddAnimation( /* delay= */ 0L, /* duration= */ ANIMATION_DURATION_HEADS_UP_APPEAR.toLong(), /* isHeadsUpAppear= */ true, /* isHeadsUpCycling= */ false, /* onEndRunnable= */ null, ) } @Test @EnableFlags(NotificationsHunSharedAnimationValues.FLAG_NAME) fun startAnimationForEvents_headsUpFromTop_startsHeadsUpAppearAnim_flagOn() { fun startAnimationForEvents_headsUpFromTop_startsHeadsUpAppearAnim() { val topMargin = 50f val expectedStartY = -topMargin - HEADS_UP_ABOVE_SCREEN val event = AnimationEvent(view, AnimationEvent.ANIMATION_TYPE_HEADS_UP_APPEAR) Loading @@ -139,7 +113,7 @@ class StackStateAnimatorTest : SysuiTestCase() { } @Test @EnableFlags(NotificationsHunSharedAnimationValues.FLAG_NAME, PromotedNotificationUi.FLAG_NAME) @EnableFlags(PromotedNotificationUi.FLAG_NAME) fun startAnimationForEvents_headsUpFromTop_andHasStatusBarChipFalse() { val statusBarHeight = 156 val topMargin = 50f Loading Loading @@ -167,7 +141,7 @@ class StackStateAnimatorTest : SysuiTestCase() { } @Test @EnableFlags(NotificationsHunSharedAnimationValues.FLAG_NAME, PromotedNotificationUi.FLAG_NAME) @EnableFlags(PromotedNotificationUi.FLAG_NAME) fun startAnimationForEvents_headsUpFromTop_andHasStatusBarChipTrue() { val statusBarHeight = 156 val topMargin = 50f Loading Loading @@ -195,33 +169,7 @@ class StackStateAnimatorTest : SysuiTestCase() { } @Test @DisableFlags(NotificationsHunSharedAnimationValues.FLAG_NAME) fun startAnimationForEvents_headsUpFromBottom_startsHeadsUpAppearAnim_flagOff() { val screenHeight = 2000f val expectedStartY = screenHeight + stackStateAnimator.mHeadsUpAppearStartAboveScreen val event = AnimationEvent(view, AnimationEvent.ANIMATION_TYPE_HEADS_UP_APPEAR).apply { headsUpFromBottom = true } stackStateAnimator.setHeadsUpAppearHeightBottom(screenHeight.toInt()) stackStateAnimator.startAnimationForEvents(arrayListOf(event), 0) verify(view).setFinalActualHeight(VIEW_HEIGHT) verify(view, description("should animate from the bottom")).translationY = expectedStartY verify(view) .performAddAnimation( /* delay= */ 0L, /* duration= */ ANIMATION_DURATION_HEADS_UP_APPEAR.toLong(), /* isHeadsUpAppear= */ true, /* isHeadsUpCycling= */ false, /* onEndRunnable= */ null, ) } @Test @EnableFlags(NotificationsHunSharedAnimationValues.FLAG_NAME) fun startAnimationForEvents_headsUpFromBottom_startsHeadsUpAppearAnim_flagOn() { fun startAnimationForEvents_headsUpFromBottom_startsHeadsUpAppearAnim() { val screenHeight = 2000f val expectedStartY = screenHeight + HEADS_UP_ABOVE_SCREEN val event = Loading @@ -245,39 +193,8 @@ class StackStateAnimatorTest : SysuiTestCase() { } @Test @DisableFlags(NotificationsHunSharedAnimationValues.FLAG_NAME, Flags.FLAG_PHYSICAL_NOTIFICATION_MOVEMENT) fun startAnimationForEvents_startsHeadsUpDisappearAnim_flagOff() { val disappearDuration = ANIMATION_DURATION_HEADS_UP_DISAPPEAR.toLong() val event = AnimationEvent(view, AnimationEvent.ANIMATION_TYPE_HEADS_UP_DISAPPEAR) clearInvocations(view) stackStateAnimator.startAnimationForEvents(arrayListOf(event), 0) verify(view) .performRemoveAnimation( /* duration= */ eq(disappearDuration), /* delay= */ eq(0L), /* translationDirection= */ eq(0f), /* isHeadsUpAnimation= */ eq(true), /* isHeadsUpCycling= */ eq(false), /* onStartedRunnable= */ any(), /* onFinishedRunnable= */ runnableCaptor.capture(), /* animationListener= */ any(), /* clipSide= */ eq(ExpandableView.ClipSide.BOTTOM), ) animatorTestRule.advanceTimeBy(disappearDuration) // move to the end of SSA animations runnableCaptor.value.run() // execute the end runnable verify(view, description("should be translated to the heads up appear start")) .translationY = -stackStateAnimator.mHeadsUpAppearStartAboveScreen verify(view, description("should be called at the end of the disappear animation")) .removeFromTransientContainer() } @Test @EnableFlags(NotificationsHunSharedAnimationValues.FLAG_NAME) @DisableFlags(Flags.FLAG_PHYSICAL_NOTIFICATION_MOVEMENT) fun startAnimationForEvents_startsHeadsUpDisappearAnim_flagOn() { fun startAnimationForEvents_startsHeadsUpDisappearAnim() { val disappearDuration = ANIMATION_DURATION_HEADS_UP_DISAPPEAR.toLong() val event = AnimationEvent(view, AnimationEvent.ANIMATION_TYPE_HEADS_UP_DISAPPEAR) clearInvocations(view) Loading packages/SystemUI/src/com/android/systemui/statusbar/notification/headsup/HeadsUpAnimator.kt +0 −6 Original line number Diff line number Diff line Loading @@ -29,10 +29,6 @@ import com.android.systemui.statusbar.ui.SystemBarUtilsProxy * null in production code and non-null in tests. */ class HeadsUpAnimator(context: Context, private val systemBarUtilsProxy: SystemBarUtilsProxy?) { init { NotificationsHunSharedAnimationValues.unsafeAssertInNewMode() } var headsUpAppearHeightBottom: Int = 0 var stackTopMargin: Int = 0 Loading @@ -47,8 +43,6 @@ class HeadsUpAnimator(context: Context, private val systemBarUtilsProxy: SystemB * of the animation. */ fun getHeadsUpYTranslation(isHeadsUpFromBottom: Boolean, hasStatusBarChip: Boolean): Int { if (NotificationsHunSharedAnimationValues.isUnexpectedlyInLegacyMode()) return 0 if (isHeadsUpFromBottom) { // start from or end at the bottom of the screen return headsUpAppearHeightBottom + headsUpAppearStartAboveScreen Loading Loading
packages/SystemUI/aconfig/systemui.aconfig +0 −10 Original line number Diff line number Diff line Loading @@ -170,16 +170,6 @@ flag { } } flag { name: "notifications_hun_shared_animation_values" namespace: "systemui" description: "Adds a shared class for fetching HUN animation values." bug: "393369891" metadata { purpose: PURPOSE_BUGFIX } } flag { name: "notification_avalanche_throttle_hun" namespace: "systemui" Loading
packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/headsup/HeadsUpAnimatorTest.kt +0 −1 Original line number Diff line number Diff line Loading @@ -30,7 +30,6 @@ import org.junit.runner.RunWith @SmallTest @RunWith(AndroidJUnit4::class) @EnableFlags(NotificationsHunSharedAnimationValues.FLAG_NAME) class HeadsUpAnimatorTest : SysuiTestCase() { private val kosmos = testKosmos() Loading
packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/stack/StackScrollAlgorithmTest.kt +12 −32 Original line number Diff line number Diff line Loading @@ -31,7 +31,6 @@ import com.android.systemui.statusbar.notification.footer.ui.view.FooterView import com.android.systemui.statusbar.notification.footer.ui.view.FooterView.FooterViewState import com.android.systemui.statusbar.notification.headsup.AvalancheController import com.android.systemui.statusbar.notification.headsup.HeadsUpAnimator import com.android.systemui.statusbar.notification.headsup.NotificationsHunSharedAnimationValues import com.android.systemui.statusbar.notification.promoted.PromotedNotificationUi import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow import com.android.systemui.statusbar.notification.row.ExpandableView Loading Loading @@ -118,10 +117,7 @@ class StackScrollAlgorithmTest(flags: FlagsParameterization) : SysuiTestCase() { @JvmStatic @Parameters(name = "{0}") fun getParams(): List<FlagsParameterization> { return FlagsParameterization.allCombinationsOf( NotificationsHunSharedAnimationValues.FLAG_NAME ) .andSceneContainer() return FlagsParameterization.allCombinationsOf().andSceneContainer() } } Loading @@ -144,15 +140,9 @@ class StackScrollAlgorithmTest(flags: FlagsParameterization) : SysuiTestCase() { hostView.addView(notificationRow) if (NotificationsHunSharedAnimationValues.isEnabled) { headsUpAnimator = HeadsUpAnimator(context, kosmos.fakeSystemBarUtilsProxy) } stackScrollAlgorithm = StackScrollAlgorithm( context, hostView, if (::headsUpAnimator.isInitialized) headsUpAnimator else null, ) StackScrollAlgorithm(context, hostView, headsUpAnimator) } private fun isTv(): Boolean { Loading Loading @@ -754,11 +744,7 @@ class StackScrollAlgorithmTest(flags: FlagsParameterization) : SysuiTestCase() { ambientState.setLayoutMinHeight(2500) // Mock the height of shade ambientState.stackY = 2500f // Scroll over the max translation stackScrollAlgorithm.setIsExpanded(true) // Mark the shade open if (NotificationsHunSharedAnimationValues.isEnabled) { headsUpAnimator.headsUpAppearHeightBottom = bottomOfScreen.toInt() } else { stackScrollAlgorithm.setHeadsUpAppearHeightBottom(bottomOfScreen.toInt()) } whenever(notificationRow.mustStayOnScreen()).thenReturn(true) whenever(notificationRow.isHeadsUp).thenReturn(true) whenever(notificationRow.isAboveShelf).thenReturn(true) Loading @@ -774,9 +760,7 @@ class StackScrollAlgorithmTest(flags: FlagsParameterization) : SysuiTestCase() { val topMargin = 100f ambientState.maxHeadsUpTranslation = 2000f ambientState.stackTopMargin = topMargin.toInt() if (NotificationsHunSharedAnimationValues.isEnabled) { headsUpAnimator.stackTopMargin = topMargin.toInt() } whenever(notificationRow.intrinsicHeight).thenReturn(100) whenever(notificationRow.isHeadsUpAnimatingAway).thenReturn(true) Loading @@ -786,17 +770,17 @@ class StackScrollAlgorithmTest(flags: FlagsParameterization) : SysuiTestCase() { } @Test @EnableFlags(NotificationsHunSharedAnimationValues.FLAG_NAME, PromotedNotificationUi.FLAG_NAME) @EnableFlags(PromotedNotificationUi.FLAG_NAME) fun resetViewStates_hunAnimatingAway_noStatusBarChip_hunTranslatedToTopOfScreen() { val topMargin = 100f ambientState.maxHeadsUpTranslation = 2000f ambientState.stackTopMargin = topMargin.toInt() headsUpAnimator?.stackTopMargin = topMargin.toInt() headsUpAnimator.stackTopMargin = topMargin.toInt() whenever(notificationRow.intrinsicHeight).thenReturn(100) val statusBarHeight = 432 kosmos.fakeSystemBarUtilsProxy.fakeStatusBarHeight = statusBarHeight headsUpAnimator!!.updateResources(context) headsUpAnimator.updateResources(context) whenever(notificationRow.isHeadsUpAnimatingAway).thenReturn(true) whenever(notificationRow.hasStatusBarChipDuringHeadsUpAnimation()).thenReturn(false) Loading @@ -807,17 +791,17 @@ class StackScrollAlgorithmTest(flags: FlagsParameterization) : SysuiTestCase() { } @Test @EnableFlags(NotificationsHunSharedAnimationValues.FLAG_NAME, PromotedNotificationUi.FLAG_NAME) @EnableFlags(PromotedNotificationUi.FLAG_NAME) fun resetViewStates_hunAnimatingAway_withStatusBarChip_hunTranslatedToBottomOfStatusBar() { val topMargin = 100f ambientState.maxHeadsUpTranslation = 2000f ambientState.stackTopMargin = topMargin.toInt() headsUpAnimator?.stackTopMargin = topMargin.toInt() headsUpAnimator.stackTopMargin = topMargin.toInt() whenever(notificationRow.intrinsicHeight).thenReturn(100) val statusBarHeight = 432 kosmos.fakeSystemBarUtilsProxy.fakeStatusBarHeight = statusBarHeight headsUpAnimator!!.updateResources(context) headsUpAnimator.updateResources(context) whenever(notificationRow.isHeadsUpAnimatingAway).thenReturn(true) whenever(notificationRow.hasStatusBarChipDuringHeadsUpAnimation()).thenReturn(true) Loading Loading @@ -1904,11 +1888,7 @@ class StackScrollAlgorithmTest(flags: FlagsParameterization) : SysuiTestCase() { fullStackHeight: Float = 3000f, ) { ambientState.headsUpTop = headsUpTop if (NotificationsHunSharedAnimationValues.isEnabled) { headsUpAnimator.headsUpAppearHeightBottom = headsUpBottom.roundToInt() } else { ambientState.headsUpBottom = headsUpBottom } ambientState.stackTop = stackTop ambientState.drawBounds = RectF(0f, stackTop, 400f, stackBottom) Loading
packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/stack/StackStateAnimatorTest.kt +6 −89 Original line number Diff line number Diff line Loading @@ -27,7 +27,6 @@ import com.android.systemui.SysuiTestCase import com.android.systemui.animation.AnimatorTestRule import com.android.systemui.res.R import com.android.systemui.statusbar.notification.headsup.HeadsUpAnimator import com.android.systemui.statusbar.notification.headsup.NotificationsHunSharedAnimationValues import com.android.systemui.statusbar.notification.promoted.PromotedNotificationUi import com.android.systemui.statusbar.notification.row.ExpandableView import com.android.systemui.statusbar.notification.stack.NotificationStackScrollLayout.AnimationEvent Loading Loading @@ -83,9 +82,7 @@ class StackStateAnimatorTest : SysuiTestCase() { whenever(stackScroller.context).thenReturn(context) whenever(view.viewState).thenReturn(viewState) if (NotificationsHunSharedAnimationValues.isEnabled) { headsUpAnimator = HeadsUpAnimator(context, kosmos.fakeSystemBarUtilsProxy) } stackStateAnimator = StackStateAnimator( mContext, Loading @@ -95,30 +92,7 @@ class StackStateAnimatorTest : SysuiTestCase() { } @Test @DisableFlags(NotificationsHunSharedAnimationValues.FLAG_NAME) fun startAnimationForEvents_headsUpFromTop_startsHeadsUpAppearAnim_flagOff() { val topMargin = 50f val expectedStartY = -topMargin - stackStateAnimator.mHeadsUpAppearStartAboveScreen val event = AnimationEvent(view, AnimationEvent.ANIMATION_TYPE_HEADS_UP_APPEAR) stackStateAnimator.setStackTopMargin(topMargin.toInt()) stackStateAnimator.startAnimationForEvents(arrayListOf(event), 0) verify(view).setFinalActualHeight(VIEW_HEIGHT) verify(view, description("should animate from the top")).translationY = expectedStartY verify(view) .performAddAnimation( /* delay= */ 0L, /* duration= */ ANIMATION_DURATION_HEADS_UP_APPEAR.toLong(), /* isHeadsUpAppear= */ true, /* isHeadsUpCycling= */ false, /* onEndRunnable= */ null, ) } @Test @EnableFlags(NotificationsHunSharedAnimationValues.FLAG_NAME) fun startAnimationForEvents_headsUpFromTop_startsHeadsUpAppearAnim_flagOn() { fun startAnimationForEvents_headsUpFromTop_startsHeadsUpAppearAnim() { val topMargin = 50f val expectedStartY = -topMargin - HEADS_UP_ABOVE_SCREEN val event = AnimationEvent(view, AnimationEvent.ANIMATION_TYPE_HEADS_UP_APPEAR) Loading @@ -139,7 +113,7 @@ class StackStateAnimatorTest : SysuiTestCase() { } @Test @EnableFlags(NotificationsHunSharedAnimationValues.FLAG_NAME, PromotedNotificationUi.FLAG_NAME) @EnableFlags(PromotedNotificationUi.FLAG_NAME) fun startAnimationForEvents_headsUpFromTop_andHasStatusBarChipFalse() { val statusBarHeight = 156 val topMargin = 50f Loading Loading @@ -167,7 +141,7 @@ class StackStateAnimatorTest : SysuiTestCase() { } @Test @EnableFlags(NotificationsHunSharedAnimationValues.FLAG_NAME, PromotedNotificationUi.FLAG_NAME) @EnableFlags(PromotedNotificationUi.FLAG_NAME) fun startAnimationForEvents_headsUpFromTop_andHasStatusBarChipTrue() { val statusBarHeight = 156 val topMargin = 50f Loading Loading @@ -195,33 +169,7 @@ class StackStateAnimatorTest : SysuiTestCase() { } @Test @DisableFlags(NotificationsHunSharedAnimationValues.FLAG_NAME) fun startAnimationForEvents_headsUpFromBottom_startsHeadsUpAppearAnim_flagOff() { val screenHeight = 2000f val expectedStartY = screenHeight + stackStateAnimator.mHeadsUpAppearStartAboveScreen val event = AnimationEvent(view, AnimationEvent.ANIMATION_TYPE_HEADS_UP_APPEAR).apply { headsUpFromBottom = true } stackStateAnimator.setHeadsUpAppearHeightBottom(screenHeight.toInt()) stackStateAnimator.startAnimationForEvents(arrayListOf(event), 0) verify(view).setFinalActualHeight(VIEW_HEIGHT) verify(view, description("should animate from the bottom")).translationY = expectedStartY verify(view) .performAddAnimation( /* delay= */ 0L, /* duration= */ ANIMATION_DURATION_HEADS_UP_APPEAR.toLong(), /* isHeadsUpAppear= */ true, /* isHeadsUpCycling= */ false, /* onEndRunnable= */ null, ) } @Test @EnableFlags(NotificationsHunSharedAnimationValues.FLAG_NAME) fun startAnimationForEvents_headsUpFromBottom_startsHeadsUpAppearAnim_flagOn() { fun startAnimationForEvents_headsUpFromBottom_startsHeadsUpAppearAnim() { val screenHeight = 2000f val expectedStartY = screenHeight + HEADS_UP_ABOVE_SCREEN val event = Loading @@ -245,39 +193,8 @@ class StackStateAnimatorTest : SysuiTestCase() { } @Test @DisableFlags(NotificationsHunSharedAnimationValues.FLAG_NAME, Flags.FLAG_PHYSICAL_NOTIFICATION_MOVEMENT) fun startAnimationForEvents_startsHeadsUpDisappearAnim_flagOff() { val disappearDuration = ANIMATION_DURATION_HEADS_UP_DISAPPEAR.toLong() val event = AnimationEvent(view, AnimationEvent.ANIMATION_TYPE_HEADS_UP_DISAPPEAR) clearInvocations(view) stackStateAnimator.startAnimationForEvents(arrayListOf(event), 0) verify(view) .performRemoveAnimation( /* duration= */ eq(disappearDuration), /* delay= */ eq(0L), /* translationDirection= */ eq(0f), /* isHeadsUpAnimation= */ eq(true), /* isHeadsUpCycling= */ eq(false), /* onStartedRunnable= */ any(), /* onFinishedRunnable= */ runnableCaptor.capture(), /* animationListener= */ any(), /* clipSide= */ eq(ExpandableView.ClipSide.BOTTOM), ) animatorTestRule.advanceTimeBy(disappearDuration) // move to the end of SSA animations runnableCaptor.value.run() // execute the end runnable verify(view, description("should be translated to the heads up appear start")) .translationY = -stackStateAnimator.mHeadsUpAppearStartAboveScreen verify(view, description("should be called at the end of the disappear animation")) .removeFromTransientContainer() } @Test @EnableFlags(NotificationsHunSharedAnimationValues.FLAG_NAME) @DisableFlags(Flags.FLAG_PHYSICAL_NOTIFICATION_MOVEMENT) fun startAnimationForEvents_startsHeadsUpDisappearAnim_flagOn() { fun startAnimationForEvents_startsHeadsUpDisappearAnim() { val disappearDuration = ANIMATION_DURATION_HEADS_UP_DISAPPEAR.toLong() val event = AnimationEvent(view, AnimationEvent.ANIMATION_TYPE_HEADS_UP_DISAPPEAR) clearInvocations(view) Loading
packages/SystemUI/src/com/android/systemui/statusbar/notification/headsup/HeadsUpAnimator.kt +0 −6 Original line number Diff line number Diff line Loading @@ -29,10 +29,6 @@ import com.android.systemui.statusbar.ui.SystemBarUtilsProxy * null in production code and non-null in tests. */ class HeadsUpAnimator(context: Context, private val systemBarUtilsProxy: SystemBarUtilsProxy?) { init { NotificationsHunSharedAnimationValues.unsafeAssertInNewMode() } var headsUpAppearHeightBottom: Int = 0 var stackTopMargin: Int = 0 Loading @@ -47,8 +43,6 @@ class HeadsUpAnimator(context: Context, private val systemBarUtilsProxy: SystemB * of the animation. */ fun getHeadsUpYTranslation(isHeadsUpFromBottom: Boolean, hasStatusBarChip: Boolean): Int { if (NotificationsHunSharedAnimationValues.isUnexpectedlyInLegacyMode()) return 0 if (isHeadsUpFromBottom) { // start from or end at the bottom of the screen return headsUpAppearHeightBottom + headsUpAppearStartAboveScreen Loading