T. Rodgers
T. Rodgers

Reputation: 13

InfiniteTransitions causing a ton of allocations in Android Studio Profiler

I have a kiosk app with a continuous infiniteTransition. The app sits on the same screen sometimes hours on end, does this eventually cause strain on memory or does Jetpack Compose handle this? I'm seeing Signal 9 getting called but no OOM crashes

Current Implementation

@Composable
fun Text() {

    val infiniteTransition = rememberInfiniteTransition(label = "Engagement Text Infinite Transition")

    val translateY by infiniteTransition.animateFloat(
        initialValue = -20f,
        targetValue = 20f,
        animationSpec = infiniteRepeatable(
            animation = tween(durationMillis = 1000),
            repeatMode = RepeatMode.Reverse
        ), label = "Engagement Text Animation"
    )
    Column(
        modifier = Modifier.offset { IntOffset(0, translateY.toInt()) },
        horizontalAlignment = Alignment.CenterHorizontally,
        verticalArrangement = Arrangement.Center
    ) {
        Text(
            text = stringResource(R.string.welcome_text),
            color = Color.Black,
        )
        Image(
            painter = painterResource(id = R.drawable.arrow),
            contentDescription = null,
        )
    }
}

Using the profiler I'm seeing a ton of allocations, and with the layout editor no unnecessary recompositions, is it just not a good use-case for Kiosk apps?

Any new info would be greatly appreciated!!

Upvotes: 0

Views: 24

Answers (0)

Related Questions