Fixed
Status Update
Comments
il...@google.com <il...@google.com> #2
While callbackFlow
is now stable, it appears that awaitClose
@ExperimentalCoroutinesApi
. Seems like a weird mismatch that makes it hard to use callbackFlow
as intended using only stable coroutine APIs...
[Deleted User] <[Deleted User]> #3
Note WorkManager just ran into similar behavioral problems with their hand-rolled LiveData to flow code; it did not propagate cancellation.
il...@google.com <il...@google.com>
il...@google.com <il...@google.com> #4
It appears awaitClose
has been promoted to a stable API in
ap...@google.com <ap...@google.com> #5
Project: platform/frameworks/support
Branch: androidx-main
commit 233a17211ea82c6b35b6ff3156b502aa7b10bd21
Author: Sanura N'Jaka <sanura@google.com>
Date: Thu Aug 25 19:13:06 2022
Have FlowLiveData.asFlow use callbackFlow
Now that awaitClose() is no longer experimental,
we should have FlowLiveData use callbackFlow, rather
than just flow to utilize its safety metrics.
The reordering in LiveDataAsFlowTest.reusingFlow was
done to match the order in which things are done in
the other tests (launching testScope before mainScope).
The original order of this test was not allowing scopes.triggerAllActions() to catch the closing of
both coroutines that were launched, so we separated them.
RelNote: "`FlowLiveData.asFlow()` now creates a `callbackFlow`
rather than using its own `Channel` implementation to ensure
thread-safety and context preservation."
Test: ensure all tests in LiveDataAsFlowTest pass
Bug: 200596935
Change-Id: I4a8b270a92ac3779cbb3d56dae585bf6876396d2
M lifecycle/lifecycle-livedata-ktx/src/main/java/androidx/lifecycle/FlowLiveData.kt
M lifecycle/lifecycle-livedata-ktx/src/test/java/androidx/lifecycle/LiveDataAsFlowTest.kt
https://android-review.googlesource.com/2197675
Branch: androidx-main
commit 233a17211ea82c6b35b6ff3156b502aa7b10bd21
Author: Sanura N'Jaka <sanura@google.com>
Date: Thu Aug 25 19:13:06 2022
Have FlowLiveData.asFlow use callbackFlow
Now that awaitClose() is no longer experimental,
we should have FlowLiveData use callbackFlow, rather
than just flow to utilize its safety metrics.
The reordering in LiveDataAsFlowTest.reusingFlow was
done to match the order in which things are done in
the other tests (launching testScope before mainScope).
The original order of this test was not allowing scopes.triggerAllActions() to catch the closing of
both coroutines that were launched, so we separated them.
RelNote: "`FlowLiveData.asFlow()` now creates a `callbackFlow`
rather than using its own `Channel` implementation to ensure
thread-safety and context preservation."
Test: ensure all tests in LiveDataAsFlowTest pass
Bug: 200596935
Change-Id: I4a8b270a92ac3779cbb3d56dae585bf6876396d2
M lifecycle/lifecycle-livedata-ktx/src/main/java/androidx/lifecycle/FlowLiveData.kt
M lifecycle/lifecycle-livedata-ktx/src/test/java/androidx/lifecycle/LiveDataAsFlowTest.kt
il...@google.com <il...@google.com> #6
This has been fixed and will be available in Lifecycle 2.6.0-alpha02.
na...@google.com <na...@google.com> #7
This bug was linked in a change in the following release(s):
androidx.lifecycle:lifecycle-livedata-ktx:2.6.0-alpha02
Description
Version used: 2.2.0
Devices/Android versions reproduced on: n/a