Fixed
Status Update
Comments
ap...@google.com <ap...@google.com> #2
Project: platform/frameworks/support
Branch: androidx-main
commit f351c443272110d307fb0c7ed6c1be54f3d656d7
Author: Daniel Santiago Rivera <danysantiago@google.com>
Date: Thu Aug 22 09:59:15 2024
Commonize InvalidationTracker Flow API
This changes bring the extension function invalidationTrackerFlow() to the InvalidationTracker as createFlow() and evolves it to be the first-party API for tracking database invalidation in Kotlin Multiplatform.
The code gen utility function FlowBuilder.createFlow() and the extension function invalidationTrackerFlow() are migrated to use the new API.
All InvalidationTracker.Observer APIs that where commonized are moved to the Android source set, to continue keeping backwards compatibility in Android and no longer provide the callback-based APIs for KMP.
LimitOffsetPagingSource was updated to use the Flow API since Observers are no longer available in common code. The internal API to check for invalidation synchronously was updated to return a boolean if interested tables where invalidated, this is needed to better guaranteed invalidation of page source. Tests are also updated to filter out a named Coroutine, a strategy that is less brittle than filtering runnable based on function names.
The implementation uses a MutableStateFlow of an array of ever incrementing table versions. The actual version value are not persisted and don't even correspond to individual table modification. They can be considered as a counter of times the table has been invalidated since the instantiation of the InvalidationTracker. Observing flows keep a reference to the latest versions and as they receive new versions they check if any of the interested tables have change in count, an indicator that the flow must emit.
Bug: 261205680
Bug: 287085166
Bug: 287366097
Bug: 287477564
Bug: 287517337
Bug: 312434479
Bug: 329291639
Bug: 329315924
Test: Existing
Relnote: "Commonize invalidationTrackerFlow() as a first-party API in InvalidationTracker and make it available for non-Android source sets in KMP projects."
Change-Id: I8fb29221e382b7a78259c47d9d93add4c59584ce
M room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/test/FlowQueryTest.kt
M room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/test/InvalidationTrackerFlowTest.kt
M room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/test/MultiTypedPagingSourceTest.kt
M room/integration-tests/multiplatformtestapp/src/commonTest/kotlin/androidx/room/integration/multiplatformtestapp/test/BaseInvalidationTest.kt
M room/room-paging/src/androidInstrumentedTest/kotlin/androidx/room/paging/LimitOffsetPagingSourceTest.kt
M room/room-paging/src/commonMain/kotlin/androidx/room/paging/LimitOffsetPagingSource.kt
M room/room-runtime/api/current.txt
M room/room-runtime/api/restricted_current.txt
M room/room-runtime/bcv/native/current.txt
M room/room-runtime/src/androidMain/kotlin/androidx/room/InvalidationTracker.android.kt
M room/room-runtime/src/androidMain/kotlin/androidx/room/RoomDatabase.android.kt
M room/room-runtime/src/androidMain/kotlin/androidx/room/RoomTrackingLiveData.android.kt
M room/room-runtime/src/androidUnitTest/kotlin/androidx/room/InvalidationTrackerTest.kt
M room/room-runtime/src/commonMain/kotlin/androidx/room/InvalidationTracker.kt
M room/room-runtime/src/commonMain/kotlin/androidx/room/coroutines/FlowBuilder.kt
M room/room-runtime/src/jvmNativeMain/kotlin/androidx/room/InvalidationTracker.jvmNative.kt
A testutils/testutils-common/src/main/java/androidx/testutils/FilteringCoroutineContext.kt
M testutils/testutils-common/src/main/java/androidx/testutils/FilteringExecutor.kt
https://android-review.googlesource.com/3237977
Branch: androidx-main
commit f351c443272110d307fb0c7ed6c1be54f3d656d7
Author: Daniel Santiago Rivera <danysantiago@google.com>
Date: Thu Aug 22 09:59:15 2024
Commonize InvalidationTracker Flow API
This changes bring the extension function invalidationTrackerFlow() to the InvalidationTracker as createFlow() and evolves it to be the first-party API for tracking database invalidation in Kotlin Multiplatform.
The code gen utility function FlowBuilder.createFlow() and the extension function invalidationTrackerFlow() are migrated to use the new API.
All InvalidationTracker.Observer APIs that where commonized are moved to the Android source set, to continue keeping backwards compatibility in Android and no longer provide the callback-based APIs for KMP.
LimitOffsetPagingSource was updated to use the Flow API since Observers are no longer available in common code. The internal API to check for invalidation synchronously was updated to return a boolean if interested tables where invalidated, this is needed to better guaranteed invalidation of page source. Tests are also updated to filter out a named Coroutine, a strategy that is less brittle than filtering runnable based on function names.
The implementation uses a MutableStateFlow of an array of ever incrementing table versions. The actual version value are not persisted and don't even correspond to individual table modification. They can be considered as a counter of times the table has been invalidated since the instantiation of the InvalidationTracker. Observing flows keep a reference to the latest versions and as they receive new versions they check if any of the interested tables have change in count, an indicator that the flow must emit.
Bug: 261205680
Bug: 287085166
Bug: 287366097
Bug: 287477564
Bug: 287517337
Bug: 312434479
Bug: 329291639
Bug: 329315924
Test: Existing
Relnote: "Commonize invalidationTrackerFlow() as a first-party API in InvalidationTracker and make it available for non-Android source sets in KMP projects."
Change-Id: I8fb29221e382b7a78259c47d9d93add4c59584ce
M room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/test/FlowQueryTest.kt
M room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/test/InvalidationTrackerFlowTest.kt
M room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/test/MultiTypedPagingSourceTest.kt
M room/integration-tests/multiplatformtestapp/src/commonTest/kotlin/androidx/room/integration/multiplatformtestapp/test/BaseInvalidationTest.kt
M room/room-paging/src/androidInstrumentedTest/kotlin/androidx/room/paging/LimitOffsetPagingSourceTest.kt
M room/room-paging/src/commonMain/kotlin/androidx/room/paging/LimitOffsetPagingSource.kt
M room/room-runtime/api/current.txt
M room/room-runtime/api/restricted_current.txt
M room/room-runtime/bcv/native/current.txt
M room/room-runtime/src/androidMain/kotlin/androidx/room/InvalidationTracker.android.kt
M room/room-runtime/src/androidMain/kotlin/androidx/room/RoomDatabase.android.kt
M room/room-runtime/src/androidMain/kotlin/androidx/room/RoomTrackingLiveData.android.kt
M room/room-runtime/src/androidUnitTest/kotlin/androidx/room/InvalidationTrackerTest.kt
M room/room-runtime/src/commonMain/kotlin/androidx/room/InvalidationTracker.kt
M room/room-runtime/src/commonMain/kotlin/androidx/room/coroutines/FlowBuilder.kt
M room/room-runtime/src/jvmNativeMain/kotlin/androidx/room/InvalidationTracker.jvmNative.kt
A testutils/testutils-common/src/main/java/androidx/testutils/FilteringCoroutineContext.kt
M testutils/testutils-common/src/main/java/androidx/testutils/FilteringExecutor.kt
da...@google.com <da...@google.com>
ap...@google.com <ap...@google.com> #3
Project: platform/frameworks/support
Branch: androidx-main
commit bc9a113eee26d1a599153e15ebec5c233f609261
Author: Daniel Santiago Rivera <danysantiago@google.com>
Date: Wed Sep 11 09:52:35 2024
Commonize InvalidationTracker Flow API
This changes bring the extension function invalidationTrackerFlow() to the InvalidationTracker as createFlow() and evolves it to be the first-party API for tracking database invalidation in Kotlin Multiplatform.
The code gen utility function FlowBuilder.createFlow() and the extension function invalidationTrackerFlow() are migrated to use the new API.
All InvalidationTracker.Observer APIs that where commonized are moved to the Android source set, to continue keeping backwards compatibility in Android and no longer provide the callback-based APIs for KMP.
LimitOffsetPagingSource was updated to use the Flow API since Observers are no longer available in common code. The internal API to check for invalidation synchronously was updated to return a boolean if interested tables where invalidated, this is needed to better guaranteed invalidation of page source. Tests are also updated to filter out a named Coroutine, a strategy that is less brittle than filtering runnable based on function names.
The implementation uses a MutableStateFlow of an array of ever incrementing table versions. The actual version value are not persisted and don't even correspond to individual table modification. They can be considered as a counter of times the table has been invalidated since the instantiation of the InvalidationTracker. Observing flows keep a reference to the latest versions and as they receive new versions they check if any of the interested tables have change in count, an indicator that the flow must emit.
This reverts commit d439acd98c40eb883195431d0320bead0780dc46.
Bug: 261205680
Bug: 287085166
Bug: 287366097
Bug: 287477564
Bug: 287517337
Bug: 312434479
Bug: 329291639
Bug: 329315924
Test: Existing
Relnote: "Commonize invalidationTrackerFlow() as a first-party API in InvalidationTracker and make it available for non-Android source sets in KMP projects."
Change-Id: I1fbfa9a45041f774eb08ee9d6457a2cde6a236a1
M room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/test/FlowQueryTest.kt
M room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/test/InvalidationTrackerFlowTest.kt
M room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/test/MultiTypedPagingSourceTest.kt
M room/integration-tests/multiplatformtestapp/src/commonTest/kotlin/androidx/room/integration/multiplatformtestapp/test/BaseInvalidationTest.kt
M room/room-paging/src/androidInstrumentedTest/kotlin/androidx/room/paging/LimitOffsetPagingSourceTest.kt
M room/room-paging/src/commonMain/kotlin/androidx/room/paging/LimitOffsetPagingSource.kt
M room/room-runtime/api/current.txt
M room/room-runtime/api/restricted_current.txt
M room/room-runtime/bcv/native/current.txt
M room/room-runtime/src/androidMain/kotlin/androidx/room/InvalidationTracker.android.kt
M room/room-runtime/src/androidMain/kotlin/androidx/room/RoomDatabase.android.kt
M room/room-runtime/src/androidMain/kotlin/androidx/room/RoomTrackingLiveData.android.kt
M room/room-runtime/src/androidUnitTest/kotlin/androidx/room/InvalidationTrackerTest.kt
M room/room-runtime/src/commonMain/kotlin/androidx/room/InvalidationTracker.kt
M room/room-runtime/src/commonMain/kotlin/androidx/room/coroutines/FlowBuilder.kt
M room/room-runtime/src/jvmNativeMain/kotlin/androidx/room/InvalidationTracker.jvmNative.kt
A testutils/testutils-common/src/main/java/androidx/testutils/FilteringCoroutineContext.kt
M testutils/testutils-common/src/main/java/androidx/testutils/FilteringExecutor.kt
https://android-review.googlesource.com/3264071
Branch: androidx-main
commit bc9a113eee26d1a599153e15ebec5c233f609261
Author: Daniel Santiago Rivera <danysantiago@google.com>
Date: Wed Sep 11 09:52:35 2024
Commonize InvalidationTracker Flow API
This changes bring the extension function invalidationTrackerFlow() to the InvalidationTracker as createFlow() and evolves it to be the first-party API for tracking database invalidation in Kotlin Multiplatform.
The code gen utility function FlowBuilder.createFlow() and the extension function invalidationTrackerFlow() are migrated to use the new API.
All InvalidationTracker.Observer APIs that where commonized are moved to the Android source set, to continue keeping backwards compatibility in Android and no longer provide the callback-based APIs for KMP.
LimitOffsetPagingSource was updated to use the Flow API since Observers are no longer available in common code. The internal API to check for invalidation synchronously was updated to return a boolean if interested tables where invalidated, this is needed to better guaranteed invalidation of page source. Tests are also updated to filter out a named Coroutine, a strategy that is less brittle than filtering runnable based on function names.
The implementation uses a MutableStateFlow of an array of ever incrementing table versions. The actual version value are not persisted and don't even correspond to individual table modification. They can be considered as a counter of times the table has been invalidated since the instantiation of the InvalidationTracker. Observing flows keep a reference to the latest versions and as they receive new versions they check if any of the interested tables have change in count, an indicator that the flow must emit.
This reverts commit d439acd98c40eb883195431d0320bead0780dc46.
Bug: 261205680
Bug: 287085166
Bug: 287366097
Bug: 287477564
Bug: 287517337
Bug: 312434479
Bug: 329291639
Bug: 329315924
Test: Existing
Relnote: "Commonize invalidationTrackerFlow() as a first-party API in InvalidationTracker and make it available for non-Android source sets in KMP projects."
Change-Id: I1fbfa9a45041f774eb08ee9d6457a2cde6a236a1
M room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/test/FlowQueryTest.kt
M room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/test/InvalidationTrackerFlowTest.kt
M room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/test/MultiTypedPagingSourceTest.kt
M room/integration-tests/multiplatformtestapp/src/commonTest/kotlin/androidx/room/integration/multiplatformtestapp/test/BaseInvalidationTest.kt
M room/room-paging/src/androidInstrumentedTest/kotlin/androidx/room/paging/LimitOffsetPagingSourceTest.kt
M room/room-paging/src/commonMain/kotlin/androidx/room/paging/LimitOffsetPagingSource.kt
M room/room-runtime/api/current.txt
M room/room-runtime/api/restricted_current.txt
M room/room-runtime/bcv/native/current.txt
M room/room-runtime/src/androidMain/kotlin/androidx/room/InvalidationTracker.android.kt
M room/room-runtime/src/androidMain/kotlin/androidx/room/RoomDatabase.android.kt
M room/room-runtime/src/androidMain/kotlin/androidx/room/RoomTrackingLiveData.android.kt
M room/room-runtime/src/androidUnitTest/kotlin/androidx/room/InvalidationTrackerTest.kt
M room/room-runtime/src/commonMain/kotlin/androidx/room/InvalidationTracker.kt
M room/room-runtime/src/commonMain/kotlin/androidx/room/coroutines/FlowBuilder.kt
M room/room-runtime/src/jvmNativeMain/kotlin/androidx/room/InvalidationTracker.jvmNative.kt
A testutils/testutils-common/src/main/java/androidx/testutils/FilteringCoroutineContext.kt
M testutils/testutils-common/src/main/java/androidx/testutils/FilteringExecutor.kt
Description
Move the extension function
invalidationTrackerFlow()
to common code