Fixed
Status Update
Comments
mg...@google.com <mg...@google.com>
mg...@google.com <mg...@google.com>
ap...@google.com <ap...@google.com> #2
Project: platform/frameworks/support
Branch: androidx-main
Author: Marcello Galhardo <
Link:
Suppress deprecate warning in AbstractSavedStateViewModelFactory tests
Expand for full commit details
Suppress deprecate warning in AbstractSavedStateViewModelFactory tests
Test: N/A
Bug: 388590327
Change-Id: Ibe2f04f4cb46f7d19d7fcab22ba2cecb4c82c68c
Files:
- M
lifecycle/lifecycle-viewmodel-savedstate/src/androidInstrumentedTest/kotlin/androidx/lifecycle/viewmodel/savedstate/SavedStateFactoryTest.kt
- M
lifecycle/lifecycle-viewmodel-savedstate/src/androidInstrumentedTest/kotlin/androidx/lifecycle/viewmodel/savedstate/ViewModelsWithStateTest.kt
Hash: c944a864317d80aeae8c5ee5812eb20eb1e3d0a8
Date: Mon Jan 13 17:39:17 2025
ap...@google.com <ap...@google.com> #3
Project: platform/frameworks/support
Branch: androidx-main
Author: Marcello Galhardo <
Link:
Deprecate AbstractSavedStateViewModelFactory in favor of CreationExtras API
Expand for full commit details
Deprecate AbstractSavedStateViewModelFactory in favor of CreationExtras API
`AbstractSavedStateViewModelFactory` is deprecated as it creates a `SavedStateHandle` for every `ViewModel`, causing unnecessary overhead. Use `ViewModelProvider.Factory` with `CreationExtras.createSavedStateHandle` instead for more efficient `ViewModel` creation.
- Updated KDoc with deprecation details and alternatives.
- Added `@Deprecated` annotation.
RelNote: "`AbstractSavedStateViewModelFactory` is deprecated as it creates a `SavedStateHandle` for every `ViewModel`, causing unnecessary overhead. Use `ViewModelProvider.Factory` with `CreationExtras.createSavedStateHandle` instead for more efficient `ViewModel` creation."
Test: N/A
Bug: 388590327
Change-Id: Ia920b66ccabde85a105cf4e6f80aa980270098ee
Files:
- M
lifecycle/lifecycle-viewmodel-savedstate/api/current.txt
- M
lifecycle/lifecycle-viewmodel-savedstate/api/restricted_current.txt
- M
lifecycle/lifecycle-viewmodel-savedstate/src/androidMain/kotlin/androidx/lifecycle/AbstractSavedStateViewModelFactory.android.kt
Hash: a3dcd46d7c08fa2d407aa9f8f91fb181aa342cc8
Date: Mon Jan 13 14:45:34 2025
na...@google.com <na...@google.com> #4
The following release(s) address this bug.It is possible this bug has only been partially addressed:
androidx.lifecycle:lifecycle-viewmodel-savedstate:2.9.0-alpha09
androidx.lifecycle:lifecycle-viewmodel-savedstate-android:2.9.0-alpha09
androidx.lifecycle:lifecycle-viewmodel-savedstate-desktop:2.9.0-alpha09
androidx.lifecycle:lifecycle-viewmodel-savedstate-iosarm64:2.9.0-alpha09
androidx.lifecycle:lifecycle-viewmodel-savedstate-iossimulatorarm64:2.9.0-alpha09
androidx.lifecycle:lifecycle-viewmodel-savedstate-iosx64:2.9.0-alpha09
androidx.lifecycle:lifecycle-viewmodel-savedstate-linuxarm64:2.9.0-alpha09
androidx.lifecycle:lifecycle-viewmodel-savedstate-linuxx64:2.9.0-alpha09
androidx.lifecycle:lifecycle-viewmodel-savedstate-macosarm64:2.9.0-alpha09
androidx.lifecycle:lifecycle-viewmodel-savedstate-macosx64:2.9.0-alpha09
Description
Component used: Lifecycle ViewModel SavedState
Version used: 2.9.0-alpha08
With the introduction of
CreationExtras
andviewModelFactory
,AbstractSavedStateViewModelFactory
is no longer needed and should be deprecated or at least marked as discouraged since it forces the creation of aSavedStateHandle
for every ViewModel even if the ViewModel does not require one, causing pressure on the saved instance state size and additional book keeping.