Fixed
Status Update
Comments
ap...@google.com <ap...@google.com> #2
Project: platform/frameworks/support
Branch: androidx-main
commit 7e357184de59db6318f3da00dc8942e48e0474d9
Author: Matvei Malkov <malkov@google.com>
Date: Wed Mar 17 18:30:14 2021
Migrate detectTapGesutres to the single awaitPointerEventScope call.
Migrated detectTapGestures to the channel producer/consumer behaviour so there are no missed events anymore.
For general clickable without longpress or doubleclick I've made a separate implementation that has a shortcut and doesn't involve the channels or any other overhead.
Bug: 182397793
Bug: 179988949
Fixes: 179239764
Test: existing passes + added new ones for the shortcut logic
Change-Id: Ic59034552b5ef1bc972da8e3124ee5da0e8bc04e
M compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/ClickableTest.kt
M compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/Clickable.kt
M compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/gestures/TapGestureDetector.kt
M compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/selection/Toggleable.kt
M compose/foundation/foundation/src/test/kotlin/androidx/compose/foundation/gestures/TapGestureDetectorTest.kt
M development/build_log_simplifier/messages.ignore
https://android-review.googlesource.com/1643124
Branch: androidx-main
commit 7e357184de59db6318f3da00dc8942e48e0474d9
Author: Matvei Malkov <malkov@google.com>
Date: Wed Mar 17 18:30:14 2021
Migrate detectTapGesutres to the single awaitPointerEventScope call.
Migrated detectTapGestures to the channel producer/consumer behaviour so there are no missed events anymore.
For general clickable without longpress or doubleclick I've made a separate implementation that has a shortcut and doesn't involve the channels or any other overhead.
Bug: 182397793
Bug: 179988949
Fixes: 179239764
Test: existing passes + added new ones for the shortcut logic
Change-Id: Ic59034552b5ef1bc972da8e3124ee5da0e8bc04e
M compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/ClickableTest.kt
M compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/Clickable.kt
M compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/gestures/TapGestureDetector.kt
M compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/selection/Toggleable.kt
M compose/foundation/foundation/src/test/kotlin/androidx/compose/foundation/gestures/TapGestureDetectorTest.kt
M development/build_log_simplifier/messages.ignore
ap...@google.com <ap...@google.com> #3
Project: platform/frameworks/support
Branch: androidx-main
commit 0261205e8e5e63ca0a84fd2e9be43fe79e85591e
Author: George Mount <mount@google.com>
Date: Wed Aug 11 17:00:49 2021
Add withTimeout() and withTimeoutOrNull() to AwaitPointerEventScope
Bug: 179239764
Bug: 182397793
withTimeout() and withTimeoutOrNull() are useful functions
when working with gesture detectors that have time involved
like long press and double click. Since those two methods
are not available within AwaitPointerEventScope, the
gesture detectors exit the pointer event loop after the
withTimeout() block. This means that many gesture detectors
were having trouble with losing pointer events.
A previous change fixed this by using two independent
jobs, one that manages the pointer event loop and sends
the events through a channel, and the other reads the
channel and can use withTimeout().
This change adds withTimeout() and withTimeoutOrNull()
to AwaitPointerEventScope so that gesture detectors
can manage pointer events with timed events without
leaving the event loop.
detectTapGestures() was modified to use the new
mechanism.
Relnote: "AwaitPointerEventScope now has withTimeout()
and withTimeoutOrNull()"
Test: new tests for withTimeout() and withTimeoutOrNull()
Test: ran existing tests for detectTapGestures()
Change-Id: I507f0e696311ac0504126681c376f73beaa021fb
M compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/gestures/TapGestureDetector.kt
M compose/foundation/foundation/src/test/kotlin/androidx/compose/foundation/gestures/TapGestureDetectorTest.kt
M compose/ui/ui/api/current.txt
M compose/ui/ui/api/public_plus_experimental_current.txt
M compose/ui/ui/api/restricted_current.txt
M compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/input/pointer/SuspendingPointerInputFilterTest.kt
M compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/input/pointer/SuspendingPointerInputFilter.kt
https://android-review.googlesource.com/1794927
Branch: androidx-main
commit 0261205e8e5e63ca0a84fd2e9be43fe79e85591e
Author: George Mount <mount@google.com>
Date: Wed Aug 11 17:00:49 2021
Add withTimeout() and withTimeoutOrNull() to AwaitPointerEventScope
Bug: 179239764
Bug: 182397793
withTimeout() and withTimeoutOrNull() are useful functions
when working with gesture detectors that have time involved
like long press and double click. Since those two methods
are not available within AwaitPointerEventScope, the
gesture detectors exit the pointer event loop after the
withTimeout() block. This means that many gesture detectors
were having trouble with losing pointer events.
A previous change fixed this by using two independent
jobs, one that manages the pointer event loop and sends
the events through a channel, and the other reads the
channel and can use withTimeout().
This change adds withTimeout() and withTimeoutOrNull()
to AwaitPointerEventScope so that gesture detectors
can manage pointer events with timed events without
leaving the event loop.
detectTapGestures() was modified to use the new
mechanism.
Relnote: "AwaitPointerEventScope now has withTimeout()
and withTimeoutOrNull()"
Test: new tests for withTimeout() and withTimeoutOrNull()
Test: ran existing tests for detectTapGestures()
Change-Id: I507f0e696311ac0504126681c376f73beaa021fb
M compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/gestures/TapGestureDetector.kt
M compose/foundation/foundation/src/test/kotlin/androidx/compose/foundation/gestures/TapGestureDetectorTest.kt
M compose/ui/ui/api/current.txt
M compose/ui/ui/api/public_plus_experimental_current.txt
M compose/ui/ui/api/restricted_current.txt
M compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/input/pointer/SuspendingPointerInputFilterTest.kt
M compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/input/pointer/SuspendingPointerInputFilter.kt
Description
What title says, we had to revert clickable to tapGestureFilters and other filters instead of using
detectTapGestures
because click wasn't fired sometimes under certain circumstances. More context:After we migrated clickable to detectTapGestures, we were missing clicks on the buttons.
Symptoms: tap with regular speed, after click is up (lifted) sometimes ripple animates to pressed state and stays there and onClick is not fired. Reproducible not on every click and not for everyone.
Notable discoveries throughout exploration/revert:
tapGestureFilter
fully solves the issue.Seems like a timing/race issue when delay between down and up is very low, or smth along this lines.
It's an important issue to allow us to continue to migrate production code to suspend pointer to solve, hence p1.