Fixed
Status Update
Comments
py...@gmail.com <py...@gmail.com> #2
ch...@google.com <ch...@google.com> #3
Project: platform/frameworks/support
Branch: androidx-main
commit 8aea0fa4e7bed4d9dee1f03482328014e4dd86c2
Author: John Nichol <jnichol@google.com>
Date: Fri Oct 21 17:21:35 2022
Correct ScalingLazyListState.centerItemIndex calculation
Change the calculation of centerItemIndex/centerItemOffset to ensure that the closest item to the center of the viewport is returned.
The previous (incorrect) behaviour found the first items that had its itemEnd below the center line.
As a result it was possible in some edge conditions for an items which sat just above the center line to be ignored and the first items below the center line to be selected - even it was further away from the center line.
Bug: 254257769
Test: ./gradlew :wear:compose:compose-material:connectedCheck --info --daemon
Relnote: "We have corrected the calculation of `ScalingLazyListState.centerItemIndex/centerItemOffset` so that if two items sit either side of the viewport center line the one that is closest will be considered as the centerItem."
Change-Id: I307091167e04914d1ae29d5324f84ec18ed7b8a8
M wear/compose/compose-material/src/androidAndroidTest/kotlin/androidx/wear/compose/material/ScalingLazyListLayoutInfoTest.kt
M wear/compose/compose-material/src/commonMain/kotlin/androidx/wear/compose/material/ScalingLazyListItemInfo.kt
M wear/compose/compose-material/src/commonMain/kotlin/androidx/wear/compose/material/ScalingLazyListState.kt
M wear/compose/integration-tests/demos/src/main/java/androidx/wear/compose/integration/demos/ScalingLazyColumnDemo.kt
https://android-review.googlesource.com/2263181
Branch: androidx-main
commit 8aea0fa4e7bed4d9dee1f03482328014e4dd86c2
Author: John Nichol <jnichol@google.com>
Date: Fri Oct 21 17:21:35 2022
Correct ScalingLazyListState.centerItemIndex calculation
Change the calculation of centerItemIndex/centerItemOffset to ensure that the closest item to the center of the viewport is returned.
The previous (incorrect) behaviour found the first items that had its itemEnd below the center line.
As a result it was possible in some edge conditions for an items which sat just above the center line to be ignored and the first items below the center line to be selected - even it was further away from the center line.
Bug: 254257769
Test: ./gradlew :wear:compose:compose-material:connectedCheck --info --daemon
Relnote: "We have corrected the calculation of `ScalingLazyListState.centerItemIndex/centerItemOffset` so that if two items sit either side of the viewport center line the one that is closest will be considered as the centerItem."
Change-Id: I307091167e04914d1ae29d5324f84ec18ed7b8a8
M wear/compose/compose-material/src/androidAndroidTest/kotlin/androidx/wear/compose/material/ScalingLazyListLayoutInfoTest.kt
M wear/compose/compose-material/src/commonMain/kotlin/androidx/wear/compose/material/ScalingLazyListItemInfo.kt
M wear/compose/compose-material/src/commonMain/kotlin/androidx/wear/compose/material/ScalingLazyListState.kt
M wear/compose/integration-tests/demos/src/main/java/androidx/wear/compose/integration/demos/ScalingLazyColumnDemo.kt
Description
androidx.metrics
module used: metrics-performanceandroidx.metrics
version used: 1.0.0-alpha01I was reading the sources for
androidx.metrics.performance.DelegatingOnPreDrawListener#onPreDraw
and noticed what seems like a potential bug pre API 24 (or at list a limitation):androidx.metrics.performance.DelegatingOnPreDrawListener#onPreDraw
posts an async message (great) but not at the front.Pre API 24, the “end” time of a frame is approximated by posting an async message from onPreDraw.
This means there can be messages that were already posted and will execute before it runs. MessageQueue only looks for async messages when there’s a sync barrier, otherwise, they keep their posted order. So if there’s no sync barrier then any already enqueued message will execute right after the frame but before the message posted from onPreDraw runs, which means the frame end time will be off. If there is a sync barrier, this still applies if there are other async messages already posted.