Architecture of camera samples
mainEach sample is a Gradle library module located under samples/{api}-{feature}/ (package com.android.{api}.{feature}). Samples follow a layered, unidirectional pattern:
{Feature}UiState: Asealed interfacerepresenting states likeInitial, specific feature states, orError.{Feature}ViewModel: A@HiltViewModelthat exposes a singleStateFlow<UiState>. It contains no Android or lifecycle references.{Feature}Controller: A@Stablestate-holder that manages the camera SDK lifecycle. It is instantiated usingremember{Feature}Controller(...).{Feature}Screen: A Composable that collects state usingcollectAsStateWithLifecycle, wraps the content in the shared scaffold, and renders the UI based on the current state using awhen(state)block.