Fix ComposeInitializerImpl

Bug: 230740991
Test: Builds
Change-Id: Ifb5958a3cc1bb50a0fcb562ed4f8e8030a741cd2
This commit is contained in:
Jordan Demeulenaere
2023-03-02 14:59:49 +01:00
parent 0897de8085
commit 28a6ebbc12

View File

@@ -49,14 +49,12 @@ internal object ComposeInitializerImpl : ComposeInitializer {
// initializer are created once, when the process is started.
val savedStateRegistryOwner =
object : SavedStateRegistryOwner {
private val savedStateRegistry =
private val savedStateRegistryController =
SavedStateRegistryController.create(this).apply { performRestore(null) }
override fun getLifecycle(): Lifecycle = lifecycleOwner.lifecycle
override val savedStateRegistry = savedStateRegistryController.savedStateRegistry
override fun getSavedStateRegistry(): SavedStateRegistry {
return savedStateRegistry.savedStateRegistry
}
override fun getLifecycle(): Lifecycle = lifecycleOwner.lifecycle
}
// We must call [ViewLifecycleOwner.onCreate] after creating the [SavedStateRegistryOwner]