summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Treehugger Robot <android-test-infra-autosubmit@system.gserviceaccount.com> 2024-10-16 19:39:50 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2024-10-16 19:39:50 +0000
commit97fca2849c70d19e349887db488886babaec5788 (patch)
tree1ff478fb8c5a10857d127db722e713d6287fc4dc
parent29d55d766a8955ad18637548b9a74da0fcab25d3 (diff)
parentb7e31cfbc15208952bc0d8a80bfedb0455272e9b (diff)
Merge "[flexiglass] Fixes clock and smartspace jitter in AOD" into main
-rw-r--r--packages/SystemUI/compose/features/src/com/android/systemui/keyguard/ui/composable/modifier/BurnInModifiers.kt11
1 files changed, 7 insertions, 4 deletions
diff --git a/packages/SystemUI/compose/features/src/com/android/systemui/keyguard/ui/composable/modifier/BurnInModifiers.kt b/packages/SystemUI/compose/features/src/com/android/systemui/keyguard/ui/composable/modifier/BurnInModifiers.kt
index 9444664885c8..71230f9cde12 100644
--- a/packages/SystemUI/compose/features/src/com/android/systemui/keyguard/ui/composable/modifier/BurnInModifiers.kt
+++ b/packages/SystemUI/compose/features/src/com/android/systemui/keyguard/ui/composable/modifier/BurnInModifiers.kt
@@ -17,8 +17,9 @@
package com.android.systemui.keyguard.ui.composable.modifier
import androidx.compose.runtime.Composable
+import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.getValue
-import androidx.compose.runtime.mutableStateOf
+import androidx.compose.runtime.mutableFloatStateOf
import androidx.compose.runtime.remember
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.graphicsLayer
@@ -41,15 +42,17 @@ fun Modifier.burnInAware(
params: BurnInParameters,
isClock: Boolean = false,
): Modifier {
- val translationYState = remember { mutableStateOf(0F) }
- viewModel.updateBurnInParams(params.copy(translationY = { translationYState.value }))
+ val cachedYTranslation = remember { mutableFloatStateOf(0f) }
+ LaunchedEffect(Unit) {
+ viewModel.updateBurnInParams(params.copy(translationY = { cachedYTranslation.floatValue }))
+ }
val burnIn = viewModel.movement
val translationX by
burnIn.map { it.translationX.toFloat() }.collectAsStateWithLifecycle(initialValue = 0f)
val translationY by
burnIn.map { it.translationY.toFloat() }.collectAsStateWithLifecycle(initialValue = 0f)
- translationYState.value = translationY
+ cachedYTranslation.floatValue = translationY
val scaleViewModel by
burnIn
.map { BurnInScaleViewModel(scale = it.scale, scaleClockOnly = it.scaleClockOnly) }