SavedState 5 min read

SavedState 1.6 and Lifecycle 2.12 Alphas: SavedStateContainer, SavedStateProvider and SavedStateRestorer

On November 18, 2026 Jetpack shipped androidx.savedstate 1.6.0-alpha06 and androidx.lifecycle 2.12.0-alpha06 together with a Lifecycle 2.11.1 bug fix. Read in isolation each release note is a line or two, but across the six alphas of each library a pattern shows up: the state-saving machinery is being rebuilt around a small set of shared interfaces. This post walks through those changes in order and says what is worth acting on now. Everything here is alpha, so treat it as a preview, not a migration target. For the Lifecycle 2.11 stable features see Lifecycle 2.11 scoped ViewModels.

1.6.0-alpha06
savedstate, Nov 18, 2026
2.12.0-alpha06
lifecycle, Nov 18, 2026
2.11.1
lifecycle stable bug fix

1. Provider and Restorer become top-level interfaces

SavedState 1.6.0-alpha02 (Aug 26, 2026) added a top-level SavedStateProvider interface and a top-level SavedStateRestorer interface with restoreState(savedState: SavedState?). SavedStateRegistry gained public constructors and now implements both. The same release deprecated AutoRecreated and runOnNextRecreation in favor of the provider and restorer pair, and Lifecycle 2.12.0-alpha02 carried the same deprecation notice.

The release notes also describe a SavedStateConsumer on SavedStateRegistry: registered providers receive restored state automatically, or immediately on registration if state was already restored. The notes list it in the same alpha02 entry that mentions removing an unreleased SavedStateRegistry.SavedStateConsumer, so check the API docs for where it finally lives before depending on it.

Alpha03 (Sep 9) then allowed a null initial state in the SavedStateRegistry constructor, which matters for tests and for registries you create yourself.

2. SavedStateContainer: one base for three types

SavedState 1.6.0-alpha05 (Oct 21, 2026) introduced SavedStateContainer as the common implementation base for SaveableStateRegistry, SavedStateHandle and SavedStateRegistry. Compose's rememberSaveable backing store, ViewModel's SavedStateHandle and the activity-level registry were three parallel implementations; the container is meant to unify them.

Child handles are the interesting part. A feature module can own a scoped slice of a screen's saved state without inventing key prefixes to avoid collisions.

Breaking behavior in alpha05: using getStateFlow and getLiveData on the same SavedStateHandle is no longer valid and throws an IllegalArgumentException. If a legacy screen exposes both for the same key, pick one before trying 2.12.

3. A sketch of the provider and restorer pair

The notes only give signatures for restoreState, so the code below is my own illustration of the pattern, using the long-standing SavedStateProvider.saveState() shape. I did not compile it against 1.6.0-alpha06; check the final API before copying.

class DraftStore :
    SavedStateRegistry.SavedStateProvider,
    SavedStateRestorer {

    var draft: String = ""

    override fun saveState(): SavedState = savedState { putString("draft", draft) }

    override fun restoreState(savedState: SavedState?) {
        draft = savedState?.read { getStringOrNull("draft") } ?: ""
    }
}

The practical gain of a separate restorer is that restoring is no longer tied to the provider being registered at exactly the right moment, which is where runOnNextRecreation users tended to get bitten.

4. Lifecycle 2.12 smaller changes

5. What to do now

Source: AndroidX release notes for SavedState and Lifecycle on developer.android.com, fetched Nov 26, 2026. The code sample is my own illustration and was not compiled.

Comments 0

No comments yet. Be the first to leave one!

Leave a comment