Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 97fca284 authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "[flexiglass] Fixes clock and smartspace jitter in AOD" into main

parents 29d55d76 b7e31cfb
Loading
Loading
Loading
Loading
+7 −4
Original line number Diff line number Diff line
@@ -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) }