[flexiglass] Fixes clock and smartspace jitter in AOD
The problem in the old logic was that viewModel.updateBurnInParams was called on every recomposition of the burnInAware @Composable function. In turn, that caused the ViewModel to emit a brand new value onto its movement flow which then would cause another recomposition of burnInAware, repeating the cycle. That explains why the jitter happens repeatedly but it doesn't explain why the jitter (a rapid repositioning of the elements on the Y axis in two location). I'm not sure why the jitter happens but I must assume that it's some translation animation that's handled in the Views as we enter and exit AOD. The cycle described above simply retriggers it on every frame. The cycle is broken by only calling viewModel.updateBurnInParams once each time the burnInAware composable enters the composition using a LaunchedEffect(Unit). Upon closer inspection, one can see that the updateBurnInParams call doesn't really need to instantiate a new params object every time that translationYState changed as it just provides a copied params object that has a translationY getter function and that function is bound to returning the value of translationYState - so it only needs to happen once. Fix: 371211911 Test: manually verified that entering and exiting AOD repeatedly doesn't cause the clock and smartspace to jitter. They just animate vertically very nicely as they should. Flag: com.android.systemui.scene_container Change-Id: I9e3de5f8d7f0dbe4e67ce5e70044fea77f58fff3
Loading
Please register or sign in to comment