Fixed
Status Update
Comments
du...@google.com <du...@google.com> #2
- want to stop filtering empty pages so that presenter can rely on event stream to re-send hints
- separator needs to filter empty pages to support dropping
- plan is to change drops so that they get the first / last sourcePageOffset, then drop all pages that depend on that offset.
- to support this we change sourcePageOffset to a list of ints (separator page would depend on page before and after) and keep track of min / max instead.
ap...@google.com <ap...@google.com> #3
Project: platform/frameworks/support
Branch: androidx-master-dev
commit ab8f79f76bed6e9ea85cae9ff3096f3c70e3673b
Author: Dustin Lam <dustinlam@google.com>
Date: Mon Aug 03 16:08:09 2020
Stop filtering empty pages on insertSeparators
Turns originalPageOffset in TransformablePage into a set of dependent
indices rather than a single Int, and turns originalIndices to be
relative to the min pageOffset in originalPageOffsets as a convention.
In case of drops, PREPEND / APPEND is converted to either the min or max
originalPageOffset, and all dependent pages on that offset is dropped on
the presenter side (while the fetcher side pre-transform, simply drops
that page). With the current set of operations, these are always
guaranteed to be contiguous from list of presented pages and therefore
does not require DiffUtil for drops.
Primary motiviation for this change is to allow presenter to rely
directly on the pageEvent stream to resend hints, and in the same
process simplifies the separator logic as it no longer requires
remapping the entire event stream to offset for added separators.
Relnote: "insertSeparators no longer filters out empty pages allowing
prefetch distance to be respected by the presenter even in cases where
many empty pages are inserted."
Fixes: 162538908
Test: ./gradlew paging:paging-common:test
Change-Id: I9cff68ad1cc33076254681a3260be3f8ae32b598
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/CachedPageEventFlow.kt
M paging/common/src/main/kotlin/androidx/paging/PageEvent.kt
M paging/common/src/main/kotlin/androidx/paging/PageFetcherSnapshot.kt
M paging/common/src/main/kotlin/androidx/paging/PageFetcherSnapshotState.kt
M paging/common/src/main/kotlin/androidx/paging/PagePresenter.kt
M paging/common/src/main/kotlin/androidx/paging/PagingDataDiffer.kt
M paging/common/src/main/kotlin/androidx/paging/Separators.kt
M paging/common/src/main/kotlin/androidx/paging/TransformablePage.kt
M paging/common/src/test/kotlin/androidx/paging/CachingTest.kt
M paging/common/src/test/kotlin/androidx/paging/FlattenedPageEventStorageTest.kt
M paging/common/src/test/kotlin/androidx/paging/HeaderFooterTest.kt
M paging/common/src/test/kotlin/androidx/paging/PageEventTest.kt
M paging/common/src/test/kotlin/androidx/paging/PageFetcherSnapshotStateTest.kt
M paging/common/src/test/kotlin/androidx/paging/PageFetcherSnapshotTest.kt
M paging/common/src/test/kotlin/androidx/paging/PagePresenterTest.kt
M paging/common/src/test/kotlin/androidx/paging/PagingDataDifferTest.kt
M paging/common/src/test/kotlin/androidx/paging/SeparatorsTest.kt
M paging/common/src/test/kotlin/androidx/paging/SeparatorsWithRemoteMediatorTest.kt
M paging/common/src/test/kotlin/androidx/paging/TestPagingSourceExt.kt
https://android-review.googlesource.com/1386773
Branch: androidx-master-dev
commit ab8f79f76bed6e9ea85cae9ff3096f3c70e3673b
Author: Dustin Lam <dustinlam@google.com>
Date: Mon Aug 03 16:08:09 2020
Stop filtering empty pages on insertSeparators
Turns originalPageOffset in TransformablePage into a set of dependent
indices rather than a single Int, and turns originalIndices to be
relative to the min pageOffset in originalPageOffsets as a convention.
In case of drops, PREPEND / APPEND is converted to either the min or max
originalPageOffset, and all dependent pages on that offset is dropped on
the presenter side (while the fetcher side pre-transform, simply drops
that page). With the current set of operations, these are always
guaranteed to be contiguous from list of presented pages and therefore
does not require DiffUtil for drops.
Primary motiviation for this change is to allow presenter to rely
directly on the pageEvent stream to resend hints, and in the same
process simplifies the separator logic as it no longer requires
remapping the entire event stream to offset for added separators.
Relnote: "insertSeparators no longer filters out empty pages allowing
prefetch distance to be respected by the presenter even in cases where
many empty pages are inserted."
Fixes: 162538908
Test: ./gradlew paging:paging-common:test
Change-Id: I9cff68ad1cc33076254681a3260be3f8ae32b598
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/CachedPageEventFlow.kt
M paging/common/src/main/kotlin/androidx/paging/PageEvent.kt
M paging/common/src/main/kotlin/androidx/paging/PageFetcherSnapshot.kt
M paging/common/src/main/kotlin/androidx/paging/PageFetcherSnapshotState.kt
M paging/common/src/main/kotlin/androidx/paging/PagePresenter.kt
M paging/common/src/main/kotlin/androidx/paging/PagingDataDiffer.kt
M paging/common/src/main/kotlin/androidx/paging/Separators.kt
M paging/common/src/main/kotlin/androidx/paging/TransformablePage.kt
M paging/common/src/test/kotlin/androidx/paging/CachingTest.kt
M paging/common/src/test/kotlin/androidx/paging/FlattenedPageEventStorageTest.kt
M paging/common/src/test/kotlin/androidx/paging/HeaderFooterTest.kt
M paging/common/src/test/kotlin/androidx/paging/PageEventTest.kt
M paging/common/src/test/kotlin/androidx/paging/PageFetcherSnapshotStateTest.kt
M paging/common/src/test/kotlin/androidx/paging/PageFetcherSnapshotTest.kt
M paging/common/src/test/kotlin/androidx/paging/PagePresenterTest.kt
M paging/common/src/test/kotlin/androidx/paging/PagingDataDifferTest.kt
M paging/common/src/test/kotlin/androidx/paging/SeparatorsTest.kt
M paging/common/src/test/kotlin/androidx/paging/SeparatorsWithRemoteMediatorTest.kt
M paging/common/src/test/kotlin/androidx/paging/TestPagingSourceExt.kt
Description
We'd like to avoid insertSeparators reliance on filtering empty pages to simplify rest of pageIndex handling internally.
One idea for this is to have a separate internal Page type for separators that includes which source page indices it's dependent on, and if any of those are removed we can also remove the separator page.
Another implication of this is that originalPageOffsetFirst / Last in ViewportHint is incorrect when the last / first page is empty due and gets filtered out by insertSeparators.