Status Update
Comments
mg...@google.com <mg...@google.com>
ap...@google.com <ap...@google.com> #2
Project: platform/frameworks/support
Branch: androidx-main
Author: Kuan-Ying Chou <
Link:
Remove ToT dependencies in wear:compose:compose-navigation
Expand for full commit details
Remove ToT dependencies in wear:compose:compose-navigation
Bug: 374102924
Test: n/a
Change-Id: Id057c7254a0282eab77a2facb4d278e3b5ccf784
Files:
- M
wear/compose/compose-navigation/samples/build.gradle
Hash: 285f596b323a37b82e07621acb990847b8cf4328
Date: Thu Oct 31 13:36:53 2024
ap...@google.com <ap...@google.com> #3
Project: platform/frameworks/support
Branch: androidx-main
Author: Kuan-Ying Chou <
Link:
Update Kotlin targets to 1.9
Expand for full commit details
Update Kotlin targets to 1.9
Update Kotlin target of savedstate and projects that depend on it to 1.9.
Bug: 374102924
Test: existing tests still pass
Change-Id: I442310ec57f7db381c16f95985a952deb9af57b2
Files:
- M
lifecycle/lifecycle-viewmodel-compose/build.gradle
- M
lifecycle/lifecycle-viewmodel-compose/samples/build.gradle
- M
lifecycle/lifecycle-viewmodel-savedstate/build.gradle
- M
lifecycle/lifecycle-viewmodel-testing/build.gradle
- M
savedstate/savedstate-ktx/build.gradle
- M
savedstate/savedstate/build.gradle
- M
savedstate/savedstate/src/nativeMain/kotlin/androidx/savedstate/internal/SynchronizedObject.native.kt
Hash: 73305d3cf9d9bfff42b1836ac0127032b7721496
Date: Tue Oct 29 17:27:51 2024
ap...@google.com <ap...@google.com> #4
Project: platform/frameworks/support
Branch: androidx-main
Author: Kuan-Ying Chou <
Link:
Add functions to encode serializable objects to and decode serializable objects from SavedState
.
Expand for full commit details
Add functions to encode serializable objects to and decode serializable objects from `SavedState`.
We do this by implementing an `Encoder` and a `Decoder` that writes and reads a `SavedState` output format for Kotlin Serialization (https://github.com/Kotlin/kotlinx.serialization). The format represents a Kotlin Serialization "primitive" as their corresponding `SavedState` supported type, and represents a "composite" in a `SavedState` with its property names as keys. Nested composites are represented by nested `SavedState`s.
Here are some other design choices we made:
1. We don't record size for collections and rely on the size of the `SavedState` in decoding so that collections and non-collections are treated the same.
2. To save space, we don't encode default values by default (it can be tweaked with `@EncodeDefault` with plugin-generated serializers).
3. To support nullable parameters with default arguments (e.g. `val a: String? = "foo"`) and for `SavedState` size to be correct for collections, we encode `null`s.
4. To keep things simple we don't support specifying custom `SerializersModule`s for now.
Please note that when using Kotlin Serialization and these functions as a `Parcelable` alternative on Android there's a performance overhead because of the extra serialization needed.
Also note that on Android we don't have built-in support for Android or Java specific types supported by `Bundle` or `Parcel` yet (e.g. `Exception`, `java.io.Serializable`, or `IBinder`). We may consider adding these types in the future.
Relnote: Add encodeToSavedState() and decodeFromSavedState() functions
Test: SavedStateCodecTest.kt
Bug: 374102924
Change-Id: I6f59faffaa3777bf56132a67f41b867d7a9663e5
Files:
- M
development/build_log_simplifier/messages.ignore
- M
docs-tip-of-tree/build.gradle
- A
savedstate/savedstate-samples/build.gradle
- A
savedstate/savedstate-samples/src/main/java/androidx/savedstate/SavedStateCodecSamples.kt
- M
savedstate/savedstate/api/current.txt
- M
savedstate/savedstate/api/restricted_current.txt
- M
savedstate/savedstate/bcv/native/current.txt
- M
savedstate/savedstate/build.gradle
- A
savedstate/savedstate/src/androidUnitTest/kotlin/androidx/savedstate/SavedStateCodecAndroidTest.android.kt
- A
savedstate/savedstate/src/commonMain/kotlin/androidx/savedstate/serialization/SavedStateDecoder.kt
- A
savedstate/savedstate/src/commonMain/kotlin/androidx/savedstate/serialization/SavedStateEncoder.kt
- A
savedstate/savedstate/src/commonTest/kotlin/androidx/savedstate/SavedStateCodecTest.kt
- A
savedstate/savedstate/src/commonTest/kotlin/androidx/savedstate/SavedStateCodecTestUtils.kt
- M
settings.gradle
Hash: 57162ea74b646ef7ae43397251fd4cd32e2d80c3
Date: Thu Oct 17 19:10:05 2024
Description
The goal here is to:
- Introduce a `Encoder` and `Decoder` that converts a `@Serializable` annotated class into a `SavedState`.
- Introduce new top-level functions that takes in a `@Serializable` and a `KSerializer` for saving state. For example, `savedStateHandle.saveable(key, serializer) { serializable }` (the code is not final, and may change).
- Best effort supporting all types that `@Serializable` supports.
- Consider to add default `Serializer` for Android specific types (e.g., `Size`).