Fixed
Status Update
Comments
jd...@xooloo.com <jd...@xooloo.com> #2
Project: platform/frameworks/support
Branch: androidx-master-dev
commit b90079595f33f58fece04026a97faa0d243acdb1
Author: Yuichi Araki <yaraki@google.com>
Date: Wed Sep 18 16:55:49 2019
Change the way to detect mismatch between POJO and query
This fixes cursor mismatch warnings with expandProjection.
Bug: 140759491
Test: QueryMethodProcessorTest
Change-Id: I7659002e5e0d1ef60fc1af2a625c0c36da0664d8
M room/compiler/src/main/kotlin/androidx/room/processor/QueryMethodProcessor.kt
M room/compiler/src/main/kotlin/androidx/room/solver/TypeAdapterStore.kt
M room/compiler/src/main/kotlin/androidx/room/solver/query/result/PojoRowAdapter.kt
M room/compiler/src/test/kotlin/androidx/room/processor/QueryMethodProcessorTest.kt
M room/compiler/src/test/kotlin/androidx/room/testing/TestProcessor.kt
https://android-review.googlesource.com/1123258
https://goto.google.com/android-sha1/b90079595f33f58fece04026a97faa0d243acdb1
Branch: androidx-master-dev
commit b90079595f33f58fece04026a97faa0d243acdb1
Author: Yuichi Araki <yaraki@google.com>
Date: Wed Sep 18 16:55:49 2019
Change the way to detect mismatch between POJO and query
This fixes cursor mismatch warnings with expandProjection.
Bug: 140759491
Test: QueryMethodProcessorTest
Change-Id: I7659002e5e0d1ef60fc1af2a625c0c36da0664d8
M room/compiler/src/main/kotlin/androidx/room/processor/QueryMethodProcessor.kt
M room/compiler/src/main/kotlin/androidx/room/solver/TypeAdapterStore.kt
M room/compiler/src/main/kotlin/androidx/room/solver/query/result/PojoRowAdapter.kt
M room/compiler/src/test/kotlin/androidx/room/processor/QueryMethodProcessorTest.kt
M room/compiler/src/test/kotlin/androidx/room/testing/TestProcessor.kt
Description
I'm using a custom PagingSource backed by a SparseArray and a RemoteMediator to feed the SparseArray when more items are needed and invalidates the PagingSource.
With the alpha08 version of Paging, I was having the same bug as the one reported by 172000108, but the insertSeparators function was working fine (I'm just displaying a header before each item).
With the snapshot version, it is not crashing anymore, but the insertSeparators is not inserting a header before the first item in the list.
It seems to me that it is related to the new terminatesStart function in Separators.kt on CombinedLoadStates. When I use a PagingSource generated by Room, it returns true, and the headers are all displayed.
But with a remote mediator, it returns false, that's why the first header might not displayed.
My remote mediator is first called with loadType REFRESH then with PREPEND (i always return endOfPaginationReached = true for this case, as I only append items). So the mediator.prepend of CombinedLoadStates is eventually terminal (first NotLoading(endOfPaginationReached = false) then NotLoading(endOfPaginationReached = true).
But my PagingSource is never called with a params Prepend (I would return an empty list and both null for prev and next keys if it was called). So source.prepend is never terminal (always NotLoading(endOfPaginationReached = false).