In Why Your Android App Drops Frames: The Jetpack Compose Architecture Guide That Fixes Recomposition Forever, S M Tahosin discusses the state and lifecycle decisions behind a Compose screen. Two of his examples address what happens when a user leaves a screen and later returns. One concerns when collected data updates the UI. The other concerns what the screen can reconstruct if Android has recreated the app process.
Check who is collecting the updates
Tahosin uses a Flow to illustrate a screen that receives updates over time. On Android, Compose's collectAsStateWithLifecycle() collects a Flow as Compose state while the lifecycle meets the configured minimum state. The Android documentation lists STARTED as the default. A screen can use the resulting state to render its current data and restart collection when its lifecycle becomes active again.
When tracing work that appears to continue in the background, identify who owns each coroutine. The lifecycle API controls the UI's collection. A repository that runs work independently of that collector can have its own lifetime. That distinction gives a useful test: watch both the UI subscription and the producer while opening the screen, backgrounding the app, and returning to the screen. Android Compose state documentation
Save enough to reconstruct the screen
The checkout example stores an order identifier in a ViewModel's SavedStateHandle. Configuration changes can preserve the ViewModel in memory. If the system kills the app process and later restores the task, a new ViewModel can use the restored identifier to find the order again. Larger or durable records belong in persistent storage.
For a checkout flow, a restoration test can check the selected order on return and what the screen shows if that order is no longer available. Android ties saved state to the task stack, so dismissing the task and restoring it after a system-initiated process death exercise different paths. Android saved state documentation