min
11/07/2025, 8:14 AMsetOwners method on ComponentActivity for? The method calls
• .setViewTreeLifecycleOwner(this)
• .setViewTreeViewModelStoreOwner(this)
• .setViewTreeSavedStateRegistryOwner(this)
on the window.decorView of this, but its only usage (in the setContent method) is followed by a call to the setContentView on the same ComponentActivity receiver. setContentView calls initializeViewTreeOwners,
open fun initializeViewTreeOwners() {
window.decorView.setViewTreeLifecycleOwner(this)
window.decorView.setViewTreeViewModelStoreOwner(this)
window.decorView.setViewTreeSavedStateRegistryOwner(this)
window.decorView.setViewTreeOnBackPressedDispatcherOwner(this)
window.decorView.setViewTreeFullyDrawnReporterOwner(this)
}
which makes the same three calls as setOwners and then two moremin
11/07/2025, 2:02 PM