Status Update
Comments
du...@google.com <du...@google.com> #2
Fixed with the following CL (missed tagging this bug):
There will be additional follow up work (handling new mainline versions that fix the issue), but we'll file separate bugs to improve that.
du...@google.com <du...@google.com> #3
How To Get Method Tracing Working in Microbench
Options:
1) Flash API 23 through 25
2) Flash API 31 through 33, and disable wifi/network on the device
Not connecting to the network prevents mainline updates. You can validate that your device hasn't taken a problematic mainline version with the following shell command:
adb shell cmd package list packages --show-versioncode --apex-only art
You should see e.g.:
package:com.google.android.art versionCode:320000000
If the first two digits of the version code are less than 34, you're good, method tracing will work and be on by default in microbench.
3) Force Mainline Update with Fix (will be documented later)
ti...@chainels.com <ti...@chainels.com> #4
Thanks! I assume it will be released in the next alpha?
du...@google.com <du...@google.com> #5
This fix is slated to be released with alpha07, which should be the next one.
du...@google.com <du...@google.com> #6
Spoke too soon, I had thought it had already merged, but looks like this will instead end up landing in alpha08
ap...@google.com <ap...@google.com> #7
Branch: androidx-master-dev
commit 0680b894e3f13d0a93415a3cc0d9543135e179c5
Author: Dustin Lam <dustinlam@google.com>
Date: Thu Sep 03 20:19:24 2020
Ensure kotlin invalidate callbacks are called by WrapperDataSources
Relnote: "The Kotlin / Java variants of DataSource.InvalidatedCallback
have been combined by enabling SAM-conversions in Kotlin via functional
interface (available in Kotlin 1.4). This also fixes a bug where the
kotlin variant of invalidate callbacks were not called after transformed
by .map or .mapByPage."
Fixes: 165313046
Test: ./gradlew paging:paging-common:test
Change-Id: I1f244498bd9f78bfed2744d9e6c9d5c1c1448971
M paging/common/api/current.txt
M paging/common/api/public_plus_experimental_current.txt
M paging/common/api/restricted_current.txt
M paging/common/src/main/kotlin/androidx/paging/DataSource.kt
M paging/common/src/main/kotlin/androidx/paging/WrapperPageKeyedDataSource.kt
M paging/common/src/main/kotlin/androidx/paging/WrapperPositionalDataSource.kt
M paging/common/src/test/kotlin/androidx/paging/LegacyPagingSourceTest.kt
M paging/common/src/test/kotlin/androidx/paging/PagedListTest.kt
A paging/common/src/test/kotlin/androidx/paging/WrappedItemKeyedDataSourceTest.kt
A paging/common/src/test/kotlin/androidx/paging/WrappedPageKeyedDataSourceTest.kt
A paging/common/src/test/kotlin/androidx/paging/WrappedPositionalDataSourceTest.kt
M paging/runtime/src/androidTest/java/androidx/paging/AsyncPagedListDifferTest.kt
M paging/rxjava2/src/test/java/androidx/paging/RxPagedListBuilderTest.kt
A testutils/testutils-paging/src/main/java/androidx/paging/TestItemKeyedDataSource.kt
A testutils/testutils-paging/src/main/java/androidx/paging/TestPageKeyedDataSource.kt
M testutils/testutils-paging/src/main/java/androidx/paging/TestPositionalDataSource.kt
Description
Component used: Paging
Version used: 3.0 alpha-04
Devices/Android versions reproduced on: n/a
Today (after many hours of debugging) I seem to have found a bug in latest alpha version of the Paging library. In my app I still have various lists that are not yet migrated to the new v3 API's, but since the documentation states it's backward compatible I figured that was okay.
Those lists use the database + remote pattern. One such list displayed strange behavior, it seemed to call all the boundary callbacks correctly, do the API call, and insert the new items in the database, however the items in the RecyclerView did not change.
The only difference that I could find between that list and other lists that were functioning correctly, is that it used a
map
function on theDatasource.Factory
returned by RoomI think I found the underlying issue. The data source does not seem to be invalidated when using a map function.
DataSource
has two variants ofaddOnValidationCallback
. An open functionThe Kotlin version is actually called in
LegacyPagingSource
However when using a map/mapByPage function on the factory returned by room, the source is wrapped and in that class ( , but also
WrappedDataSource
WrapperPositionalDataSource
for example) only the non Kotlin version ofaddOnValidationCallback
is overridden, and thus if called with the Kotlin version,addOnValidationCallback
is never called on the source of the wrapper.I could see when debugging that indeed
onInvalidatedCallbacks
is empty.Hopefully this is actually the cause of the behavior I'm seeing. The Paging code is quite complex so I could be missing something else.