package com.example.jankstats.compose

import androidx.compose.runtime.Composable
import androidx.compose.runtime.remember
import androidx.compose.ui.platform.LocalView
import androidx.metrics.performance.PerformanceMetricsState

// [START rememberMetricsStateHolder]
/**
 * Retrieve MetricsStateHolder from compose and remember until the current view changes.
 */
@Composable
fun rememberMetricsStateHolder(): PerformanceMetricsState.MetricsStateHolder {
    val view = LocalView.current
    return remember(view) { PerformanceMetricsState.getForHierarchy(view) }
}
// [END rememberMetricsStateHolder]
package com.example.jankstats.compose

import androidx.compose.runtime.Composable
import androidx.compose.runtime.remember
import androidx.compose.ui.platform.LocalView
import androidx.metrics.performance.PerformanceMetricsState

// [START metrics_state_holder]
/**
 * Retrieve MetricsStateHolder from compose and remember until the current view changes.
 */
@Composable
fun rememberMetricsStateHolder(): PerformanceMetricsState.MetricsStateHolder {
    val view = LocalView.current
    return remember(view) { PerformanceMetricsState.getForHierarchy(view) }
}
// [END metrics_state_holder]
Rename DAC tag for state holder
Rename DAC tag for state holder

android/performance-samples,android/performance-samples,android/performance-samples