Initialize StatusBar unfold animation with 1f progress

Initializes move from center animator for the statusbar
views with 1f progress, so when the device is booted
in unfolded state and rotated it the translation
wil be applied with 1f progress.

When booted in folded mode the progress will start
from 0f so it doesn't affect the animation.

Bug: 229738545
Test: kill sysui in unfolded state, rotate the device,
  rotate during fold/unfold animation
Test: atest com.android.systemui.statusbar.phone.StatusBarMoveFromCenterAnimationControllerTest
Change-Id: Ia0d4a44ddc444420d3695cab328558bf2fbe589d
This commit is contained in:
Nick Chameyev
2022-04-21 11:52:43 +01:00
parent bfab17072d
commit 86054beef0
2 changed files with 10 additions and 1 deletions

View File

@@ -52,7 +52,7 @@ class UnfoldMoveFromCenterAnimator @JvmOverloads constructor(
private val animatedViews: MutableList<AnimatedView> = arrayListOf()
private var lastAnimationProgress: Float = 0f
private var lastAnimationProgress: Float = 1f
/**
* Updates display properties in order to calculate the initial position for the views

View File

@@ -60,6 +60,15 @@ class StatusBarMoveFromCenterAnimationControllerTest : SysuiTestCase() {
assertThat(view.translationX).isZero()
}
@Test
fun onStatusBarWidthChangedWithNoTransitionBefore_noTranslation() {
controller.onViewsReady(arrayOf(view))
controller.onStatusBarWidthChanged()
assertThat(view.translationX).isZero()
}
@Test
fun onTransitionProgress_updatesTranslations() {
controller.onViewsReady(arrayOf(view))