Fixed
Status Update
Comments
ap...@google.com <ap...@google.com> #2
Project: platform/frameworks/support
Branch: androidx-main
commit 0e8a872f86335da978d3f21a536cb82340578f4d
Author: Daniel Santiago Rivera <danysantiago@google.com>
Date: Tue Oct 11 12:44:58 2022
Provide an API for creating a Flow that emits invalidation tracker changes.
This API servers as a bridge between Room's InvalidationTracker Observer APIs and coroutines Flow.
Bug: 252899305
Test: InvalidationTrackerFlowTest
Relnote: Add an API for creating a Flow that emits invalidation tracker changes. The API is useful for creating streams that need to react to database changes.
Change-Id: I8c7904f0d630bfc48574af96e288e8c7b5bf777a
M room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/dao/BooksDao.kt
A room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/test/InvalidationTrackerFlowTest.kt
M room/room-ktx/api/current.txt
M room/room-ktx/api/public_plus_experimental_current.txt
M room/room-ktx/api/restricted_current.txt
M room/room-ktx/src/main/java/androidx/room/RoomDatabaseExt.kt
https://android-review.googlesource.com/2249913
Branch: androidx-main
commit 0e8a872f86335da978d3f21a536cb82340578f4d
Author: Daniel Santiago Rivera <danysantiago@google.com>
Date: Tue Oct 11 12:44:58 2022
Provide an API for creating a Flow that emits invalidation tracker changes.
This API servers as a bridge between Room's InvalidationTracker Observer APIs and coroutines Flow.
Bug: 252899305
Test: InvalidationTrackerFlowTest
Relnote: Add an API for creating a Flow that emits invalidation tracker changes. The API is useful for creating streams that need to react to database changes.
Change-Id: I8c7904f0d630bfc48574af96e288e8c7b5bf777a
M room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/dao/BooksDao.kt
A room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/test/InvalidationTrackerFlowTest.kt
M room/room-ktx/api/current.txt
M room/room-ktx/api/public_plus_experimental_current.txt
M room/room-ktx/api/restricted_current.txt
M room/room-ktx/src/main/java/androidx/room/RoomDatabaseExt.kt
Description
The use-case is to 'drive' a Flow stream off invalidations from Room.
For example, say you have
TableOne
andTableTwo
and you want to combine data from both, querying in a transaction and avoiding intermediate emissions since an operation write both tables in a transaction. Then one could use such API to drive the stream, like this: