Status Update
Comments
ma...@google.com <ma...@google.com> #3
Branch: androidx-main
commit ceee966d2a220e9f6d62b7063edd8ffba3bbf315
Author: Jelle Fresen <jellefresen@google.com>
Date: Thu Jul 01 18:17:32 2021
Fill in more data for injected touch events
This adds the tool type, device source and precision to injected
MotionEvents. Just in case someone uses them in code under test.
Check the values in tests as well, which will especially become
important when testing other modalities as well.
Bug: 190493367
Test: ./gradlew compose:ui:ui-test:cC
Change-Id: Ia3b653e4c44d2b242771a4c619490a1848515803
M compose/ui/ui-test/src/androidAndroidTest/kotlin/androidx/compose/ui/test/inputdispatcher/SendCancelTest.kt
M compose/ui/ui-test/src/androidAndroidTest/kotlin/androidx/compose/ui/test/inputdispatcher/SendClickTest.kt
M compose/ui/ui-test/src/androidAndroidTest/kotlin/androidx/compose/ui/test/inputdispatcher/SendDownTest.kt
M compose/ui/ui-test/src/androidAndroidTest/kotlin/androidx/compose/ui/test/inputdispatcher/SendMoveTest.kt
M compose/ui/ui-test/src/androidAndroidTest/kotlin/androidx/compose/ui/test/inputdispatcher/SendSwipeLineTest.kt
M compose/ui/ui-test/src/androidAndroidTest/kotlin/androidx/compose/ui/test/inputdispatcher/SendSwipeWithDurationTest.kt
M compose/ui/ui-test/src/androidAndroidTest/kotlin/androidx/compose/ui/test/inputdispatcher/SendSwipeWithKeyTimesAndEventPeriodTest.kt
M compose/ui/ui-test/src/androidAndroidTest/kotlin/androidx/compose/ui/test/inputdispatcher/SendSwipeWithKeyTimesTest.kt
M compose/ui/ui-test/src/androidAndroidTest/kotlin/androidx/compose/ui/test/inputdispatcher/SendUpTest.kt
M compose/ui/ui-test/src/androidAndroidTest/kotlin/androidx/compose/ui/test/util/MotionEvents.kt
M compose/ui/ui-test/src/androidMain/kotlin/androidx/compose/ui/test/AndroidInputDispatcher.android.kt
g0...@gmail.com <g0...@gmail.com> #4
Branch: androidx-main
commit 1d2579b2c59578f2c7bb6cb5fa0f668e4732c441
Author: Jelle Fresen <jellefresen@google.com>
Date: Fri Aug 06 10:15:47 2021
Rename InputDispatcher methods to include "Touch"
In preparation to multi-modal input injection, to differentiate
ambiguous methods between modalities, like "down" could be both for
mouse and for touch.
Bug: 190493367
Test: ./gradlew compose:ui:ui-test:cC
Change-Id: I1a410bc05f3728db9ef0625063cf2ce22076c668
M compose/ui/ui-test/src/androidAndroidTest/kotlin/androidx/compose/ui/test/inputdispatcher/BatchingTest.kt
M compose/ui/ui-test/src/androidAndroidTest/kotlin/androidx/compose/ui/test/inputdispatcher/InputDispatcherTest.kt
M compose/ui/ui-test/src/androidAndroidTest/kotlin/androidx/compose/ui/test/inputdispatcher/IsGestureInProgressTest.kt
M compose/ui/ui-test/src/androidAndroidTest/kotlin/androidx/compose/ui/test/inputdispatcher/SendCancelTest.kt
M compose/ui/ui-test/src/androidAndroidTest/kotlin/androidx/compose/ui/test/inputdispatcher/SendDownTest.kt
M compose/ui/ui-test/src/androidAndroidTest/kotlin/androidx/compose/ui/test/inputdispatcher/SendMoveTest.kt
M compose/ui/ui-test/src/androidAndroidTest/kotlin/androidx/compose/ui/test/inputdispatcher/SendUpTest.kt
M compose/ui/ui-test/src/androidAndroidTest/kotlin/androidx/compose/ui/test/partialgesturescope/SendCancelTest.kt
M compose/ui/ui-test/src/androidAndroidTest/kotlin/androidx/compose/ui/test/partialgesturescope/SendUpTest.kt
M compose/ui/ui-test/src/androidMain/kotlin/androidx/compose/ui/test/AndroidInputDispatcher.android.kt
M compose/ui/ui-test/src/commonMain/kotlin/androidx/compose/ui/test/Actions.kt
M compose/ui/ui-test/src/commonMain/kotlin/androidx/compose/ui/test/GestureScope.kt
M compose/ui/ui-test/src/commonMain/kotlin/androidx/compose/ui/test/InputDispatcher.kt
lp...@google.com <lp...@google.com> #5
Branch: androidx-main
commit cfa75245b72f6aaece0252ba082df02099bb6d02
Author: Jelle Fresen <jellefresen@google.com>
Date: Thu Jul 15 17:14:10 2021
Rewrite touch input injection to facilitate other modalities
`performGesture` will be deprecated, in favor of `performTouchInput`.
Next to that, `performMultiModalInput` has been added to facilitate
multi-modal input. Each modality that will be added in the future will
get its own `performXyz` method with an accompanying receiver scope with
methods that only relate to that modality, and an extra property in
`MultiModalInjectionScope` to access the modality's scope from
`performMultiModalInput`.
The first modality to be added after this CL is mouse input:
`performMouseInput`, `MouseInjectionScope` and
`MultiModalInjectionScope.Mouse`.
There is still only one InputDispatcher, which will offer methods for
all elementary events for each input modality, such as
`enqueueTouchMove` or `enqueueMouseScroll`. If this proves to be
unmaintainable, we can revisit in the future as this is internal API.
`GestureScope` is replaced by `TouchInjectionScope : InjectionScope`.
`InjectionScope` exposes all general properties, such as positional
information of the node. `TouchInjectionScope` contains elementary touch
input methods such as `down`, `move` and `up`. Finally,
`MultiModalInjectionScope` contains a property with the receiver scope for
each modality, such as `val Touch: TouchInjectionScope`, which enables you
to send input from all supported modalities.
Aggregated gestures, such as `click` and `swipe`, have been removed from
the InputDispatcher and are now extension methods on the corresponding
injection scope (e.g. `TouchInjectionScope.click`).
Tests have been moved accordingly. Tests for `GestureScope` have been
kept to ensure backwards compatibility.
Bug: 190493367
Test: ./gradlew compose:ui:ui-test:cC
Relnote: "Introduced `performTouchInput` and `TouchInjectionScope` as a
replacement for `performTouchInput` and `TouchInjectionScope`, paving
the way for other modalities (like mouse).
`TouchInjectionScope` has the same methods as `GestureScope`, with the
exception of `movePointerTo` and `movePointerBy`, which have been
renamed to `updatePointerTo` and `updatePointerBy`. All other methods
are the same.
The behavior of `TouchInjectionScope` is almost identical to
`GestureScope`, with two small details:
1. When sending a down event while pointers had been moved without
sending a move event (in other words, `updatePointerTo()` has been
used, but not `move()`, and then `down()` is called), the previous
implementation would advance the event time and send a move event
before sending the down event. The new implementation still sends the
move event, but doesn't advance the event time in this specific
scenario.
2. When sending an up event while pointers had been moved without
sending a move event (similar as above), the previous implementation
would advance the event time and send a move event before sending the
up event. The new implementation does neither: the new positions of
the pointers will only be reflected through the up event.
Finally, `TouchInjectionScope` introduces a new method
`currentPosition(pointerId: Int)` to get the current position of the
given pointer."
Change-Id: If11912d1d85da53b0f675f874be29ecde1b8c7cd
M compose/ui/ui-test/api/current.txt
M compose/ui/ui-test/api/public_plus_experimental_current.txt
M compose/ui/ui-test/api/restricted_current.txt
A compose/ui/ui-test/src/androidAndroidTest/kotlin/androidx/compose/ui/test/injectionscope/touch/CancelTest.kt
A compose/ui/ui-test/src/androidAndroidTest/kotlin/androidx/compose/ui/test/injectionscope/touch/ClickTest.kt
A compose/ui/ui-test/src/androidAndroidTest/kotlin/androidx/compose/ui/test/injectionscope/touch/Common.kt
A compose/ui/ui-test/src/androidAndroidTest/kotlin/androidx/compose/ui/test/injectionscope/touch/CurrentPositionTest.kt
A compose/ui/ui-test/src/androidAndroidTest/kotlin/androidx/compose/ui/test/injectionscope/touch/DoubleClickTest.kt
A compose/ui/ui-test/src/androidAndroidTest/kotlin/androidx/compose/ui/test/injectionscope/touch/DownTest.kt
A compose/ui/ui-test/src/androidAndroidTest/kotlin/androidx/compose/ui/test/injectionscope/touch/LongClickTest.kt
A compose/ui/ui-test/src/androidAndroidTest/kotlin/androidx/compose/ui/test/injectionscope/touch/MoveByTest.kt
A compose/ui/ui-test/src/androidAndroidTest/kotlin/androidx/compose/ui/test/injectionscope/touch/MoveTest.kt
A compose/ui/ui-test/src/androidAndroidTest/kotlin/androidx/compose/ui/test/injectionscope/touch/MoveToTest.kt
A compose/ui/ui-test/src/androidAndroidTest/kotlin/androidx/compose/ui/test/injectionscope/touch/PinchTest.kt
A compose/ui/ui-test/src/androidAndroidTest/kotlin/androidx/compose/ui/test/injectionscope/touch/SwipeCurveTest.kt
A compose/ui/ui-test/src/androidAndroidTest/kotlin/androidx/compose/ui/test/injectionscope/touch/SwipeCurveWithKeyTimesTest.kt
A compose/ui/ui-test/src/androidAndroidTest/kotlin/androidx/compose/ui/test/injectionscope/touch/SwipeDirectionTest.kt
A compose/ui/ui-test/src/androidAndroidTest/kotlin/androidx/compose/ui/test/injectionscope/touch/SwipeStartEndTest.kt
A compose/ui/ui-test/src/androidAndroidTest/kotlin/androidx/compose/ui/test/injectionscope/touch/SwipeWithTouchSlopTest.kt
A compose/ui/ui-test/src/androidAndroidTest/kotlin/androidx/compose/ui/test/injectionscope/touch/SwipeWithVelocityTest.kt
A compose/ui/ui-test/src/androidAndroidTest/kotlin/androidx/compose/ui/test/injectionscope/touch/SynchronizedWithMainClockTest.kt
A compose/ui/ui-test/src/androidAndroidTest/kotlin/androidx/compose/ui/test/injectionscope/touch/UpTest.kt
A compose/ui/ui-test/src/androidAndroidTest/kotlin/androidx/compose/ui/test/inputdispatcher/AdvanceEventTimeTest.kt
D compose/ui/ui-test/src/androidAndroidTest/kotlin/androidx/compose/ui/test/inputdispatcher/DelayTest.kt
M compose/ui/ui-test/src/androidAndroidTest/kotlin/androidx/compose/ui/test/inputdispatcher/InputDispatcherTest.kt
D compose/ui/ui-test/src/androidAndroidTest/kotlin/androidx/compose/ui/test/inputdispatcher/SendClickTest.kt
D compose/ui/ui-test/src/androidAndroidTest/kotlin/androidx/compose/ui/test/inputdispatcher/SendSwipeLineTest.kt
D compose/ui/ui-test/src/androidAndroidTest/kotlin/androidx/compose/ui/test/inputdispatcher/SendSwipeWithDurationTest.kt
D compose/ui/ui-test/src/androidAndroidTest/kotlin/androidx/compose/ui/test/inputdispatcher/SendSwipeWithKeyTimesAndEventPeriodTest.kt
D compose/ui/ui-test/src/androidAndroidTest/kotlin/androidx/compose/ui/test/inputdispatcher/SendSwipeWithKeyTimesTest.kt
M compose/ui/ui-test/src/androidAndroidTest/kotlin/androidx/compose/ui/test/inputdispatcher/TouchCancelTest.kt
M compose/ui/ui-test/src/androidAndroidTest/kotlin/androidx/compose/ui/test/inputdispatcher/TouchDownTest.kt
M compose/ui/ui-test/src/androidAndroidTest/kotlin/androidx/compose/ui/test/inputdispatcher/TouchMoveTest.kt
M compose/ui/ui-test/src/androidAndroidTest/kotlin/androidx/compose/ui/test/inputdispatcher/TouchUpTest.kt
M compose/ui/ui-test/src/androidAndroidTest/kotlin/androidx/compose/ui/test/util/PointerInputs.kt
M compose/ui/ui-test/src/androidMain/kotlin/androidx/compose/ui/test/AndroidInputDispatcher.android.kt
M compose/ui/ui-test/src/commonMain/kotlin/androidx/compose/ui/test/Actions.kt
M compose/ui/ui-test/src/commonMain/kotlin/androidx/compose/ui/test/GestureScope.kt
A compose/ui/ui-test/src/commonMain/kotlin/androidx/compose/ui/test/InjectionScope.kt
M compose/ui/ui-test/src/commonMain/kotlin/androidx/compose/ui/test/InputDispatcher.kt
A compose/ui/ui-test/src/commonMain/kotlin/androidx/compose/ui/test/MultiModalInjectionScope.kt
A compose/ui/ui-test/src/commonMain/kotlin/androidx/compose/ui/test/TouchInjectionScope.kt
ap...@google.com <ap...@google.com> #6
Branch: androidx-main
commit 780ade5319db8b7304397e85358038fdf0f523f0
Author: Jelle Fresen <jellefresen@google.com>
Date: Mon Aug 09 18:36:43 2021
Deprecate GestureScope
Replaced by TouchInjectionScope. Or rather, `performGesture` has been
replaced by `performTouchInput`.
Bug: 190493367
Test: ./gradlew compose:ui:ui-test:cC
Relnote: "Deprecated `performGesture` and `GestureScope`, which have
been replaced by `performTouchInput` and `TouchInjectionScope`."
Change-Id: Ia5f3f740c51a1add60fa82189d583d8a5192dd31
M compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/ClickableTest.kt
M compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/DraggableTest.kt
M compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/IndicationTest.kt
M compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/ScrollTest.kt
M compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/ScrollableTest.kt
M compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/SelectableTest.kt
M compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/ToggleableTest.kt
M compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/TransformableTest.kt
M compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/gesture/OverScrollScreenshotTest.kt
M compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/gesture/OverScrollTest.kt
M compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/gesture/StretchOverscrollTest.kt
M compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/lazy/LazyColumnTest.kt
M compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/lazy/LazyListTest.kt
M compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/lazy/LazyNestedScrollingTest.kt
M compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text/CoreTextFieldSelectionOnBackTest.kt
M compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text/TextFieldInteractionsTest.kt
M compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text/selection/SelectionContainerFocusTest.kt
M compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text/selection/SelectionContainerTest.kt
M compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text/selection/TextSelectionColorsScreenshotTest.kt
M compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/textfield/TextFieldOnValueChangeTextFieldValueTest.kt
M compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/textfield/TextFieldScrollTest.kt
M compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/textfield/TextFieldTest.kt
M compose/foundation/foundation/src/desktopTest/kotlin/androidx/compose/foundation/ScrollbarTest.kt
M compose/integration-tests/docs-snippets/src/main/java/androidx/compose/integration/docs/testing/CheatSheet.kt
M compose/integration-tests/docs-snippets/src/main/java/androidx/compose/integration/docs/testing/Testing.kt
M compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/BackdropScaffoldTest.kt
M compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/BottomSheetScaffoldTest.kt
M compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/ButtonScreenshotTest.kt
M compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/ButtonTest.kt
M compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/CardTest.kt
M compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/CheckboxScreenshotTest.kt
M compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/CheckboxUiTest.kt
M compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/DrawerTest.kt
M compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/FloatingActionButtonScreenshotTest.kt
M compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/IconButtonTest.kt
M compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/MaterialTextSelectionColorsScreenshotTest.kt
M compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/ModalBottomSheetTest.kt
M compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/RadioButtonScreenshotTest.kt
M compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/ScaffoldTest.kt
M compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/SliderTest.kt
M compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/SurfaceTest.kt
M compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/SwipeToDismissTest.kt
M compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/SwipeableTest.kt
M compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/SwitchScreenshotTest.kt
M compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/SwitchTest.kt
M compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/textfield/OutlinedTextFieldScreenshotTest.kt
M compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/textfield/OutlinedTextFieldTest.kt
M compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/textfield/TextFieldScreenshotTest.kt
M compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/textfield/TextFieldTest.kt
M compose/ui/ui-test-junit4/src/androidAndroidTest/kotlin/androidx/compose/ui/test/junit4/MultipleActivitiesClickTest.kt
M compose/ui/ui-test-junit4/src/test/kotlin/androidx/compose/ui/test/junit4/RobolectricComposeTest.kt
M compose/ui/ui-test/api/current.txt
M compose/ui/ui-test/api/public_plus_experimental_current.txt
M compose/ui/ui-test/api/restricted_current.txt
M compose/ui/ui-test/src/androidAndroidTest/kotlin/androidx/compose/ui/test/ErrorMessagesTest.kt
M compose/ui/ui-test/src/androidAndroidTest/kotlin/androidx/compose/ui/test/gesturescope/LocalToRootTest.kt
M compose/ui/ui-test/src/androidAndroidTest/kotlin/androidx/compose/ui/test/gesturescope/PositionsTest.kt
M compose/ui/ui-test/src/androidAndroidTest/kotlin/androidx/compose/ui/test/gesturescope/SendClickTest.kt
M compose/ui/ui-test/src/androidAndroidTest/kotlin/androidx/compose/ui/test/gesturescope/SendDoubleClickTest.kt
M compose/ui/ui-test/src/androidAndroidTest/kotlin/androidx/compose/ui/test/gesturescope/SendLongClickTest.kt
M compose/ui/ui-test/src/androidAndroidTest/kotlin/androidx/compose/ui/test/gesturescope/SendPinchTest.kt
M compose/ui/ui-test/src/androidAndroidTest/kotlin/androidx/compose/ui/test/gesturescope/SendSwipeTest.kt
M compose/ui/ui-test/src/androidAndroidTest/kotlin/androidx/compose/ui/test/gesturescope/SendSwipeVelocityTest.kt
M compose/ui/ui-test/src/androidAndroidTest/kotlin/androidx/compose/ui/test/injectionscope/touch/ClickTest.kt
M compose/ui/ui-test/src/androidAndroidTest/kotlin/androidx/compose/ui/test/partialgesturescope/Common.kt
M compose/ui/ui-test/src/androidAndroidTest/kotlin/androidx/compose/ui/test/partialgesturescope/SendCancelTest.kt
M compose/ui/ui-test/src/androidAndroidTest/kotlin/androidx/compose/ui/test/partialgesturescope/SendDownTest.kt
M compose/ui/ui-test/src/androidAndroidTest/kotlin/androidx/compose/ui/test/partialgesturescope/SendMoveByTest.kt
M compose/ui/ui-test/src/androidAndroidTest/kotlin/androidx/compose/ui/test/partialgesturescope/SendMoveTest.kt
M compose/ui/ui-test/src/androidAndroidTest/kotlin/androidx/compose/ui/test/partialgesturescope/SendMoveToTest.kt
M compose/ui/ui-test/src/androidAndroidTest/kotlin/androidx/compose/ui/test/partialgesturescope/SendMultipleGesturesTest.kt
M compose/ui/ui-test/src/androidAndroidTest/kotlin/androidx/compose/ui/test/partialgesturescope/SendUpTest.kt
A compose/ui/ui-test/src/androidMain/kotlin/androidx/compose/ui/test/Actions.android.kt
M compose/ui/ui-test/src/commonMain/kotlin/androidx/compose/ui/test/Actions.kt
M compose/ui/ui-test/src/commonMain/kotlin/androidx/compose/ui/test/GestureScope.kt
A compose/ui/ui-test/src/desktopMain/kotlin/androidx/compose/ui/test/Actions.desktop.kt
M compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/draw/GraphicsLayerTest.kt
M compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/input/pointer/LayerTouchTransformTest.kt
M compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/input/pointer/RestrictedSizeTest.kt
M compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/window/PositionInWindowTest.kt
M wear/compose/compose-material/src/androidAndroidTest/kotlin/androidx/wear/compose/material/SwipeToDismissBoxTest.kt
ap...@google.com <ap...@google.com> #7
For reference: mouse events received on a physical Pixel C running Android 8.1.0 with a bluetooth mouse attached to it. Events are recorded using a RecyclerView with overrides for onTouchEvent
, onGenericMotionEvent
, onKeyDown
, onKeyUp
and onKeyLongPress
.
- down = downTime of the event
- t = eventTime of the event
- ACTION_* = actionMasked of the event
- codePath = method through which the event was received
- buttons = button state of the event
- n = number of pointers in the event
- x = x coordinate of a pointer
- y = y coordinate of a pointer
- tlType = toolType of a pointer
ap...@google.com <ap...@google.com> #8
Branch: androidx-main
commit 8f6eb4adcf88d08c0da3c3f65b099ace54808865
Author: Jelle Fresen <jellefresen@google.com>
Date: Mon Aug 09 18:08:29 2021
Add support for injecting mouse gestures
Adds a MouseInjectionScope similar to the TouchInjectionScope, an
implementation of its elementary methods in MultiModalInjectionScope,
and support in InputDispatcher and AndroidInputDispatcher.
A few platform independent abstractions for mice have been introduced
because they didn't exist yet: MouseButton and ScrollWheel. These have
been made @ExperimentalTestApi since I expect to replace them with the
production variants when they become available. For this reason, and the
fact that the API and/or behavior might change in response to the final
implementation of mouse support in Compose, all mouse injection support
has been marked @ExperimentalTestApi for the time being.
Bug: 190493367
Test: Added MouseEventsTest.kt
Relnote: "Added experimental support for injecting mouse events. Use
`performMouseInput` to start sending mouse events, or send mouse events
through the `Mouse` property of `MultiModalInjectionScope` during a
multi modal input gesture with `performMultiModalInput`. See
`MouseInjectionScope` for documentation of the available API."
Change-Id: Iaa4a82131f35d2d6376d8edaa1fac4807b27045d
M compose/ui/ui-test/api/current.txt
M compose/ui/ui-test/api/public_plus_experimental_current.txt
M compose/ui/ui-test/api/restricted_current.txt
A compose/ui/ui-test/src/androidAndroidTest/kotlin/androidx/compose/ui/test/inputdispatcher/MouseEventsTest.kt
M compose/ui/ui-test/src/androidAndroidTest/kotlin/androidx/compose/ui/test/util/MotionEvents.kt
M compose/ui/ui-test/src/androidMain/kotlin/androidx/compose/ui/test/AndroidInputDispatcher.android.kt
A compose/ui/ui-test/src/androidMain/kotlin/androidx/compose/ui/test/Mouse.android.kt
M compose/ui/ui-test/src/commonMain/kotlin/androidx/compose/ui/test/Actions.kt
M compose/ui/ui-test/src/commonMain/kotlin/androidx/compose/ui/test/InputDispatcher.kt
A compose/ui/ui-test/src/commonMain/kotlin/androidx/compose/ui/test/Mouse.kt
A compose/ui/ui-test/src/commonMain/kotlin/androidx/compose/ui/test/MouseInjectionScope.kt
M compose/ui/ui-test/src/commonMain/kotlin/androidx/compose/ui/test/MultiModalInjectionScope.kt
M compose/ui/ui-test/src/desktopMain/kotlin/androidx/compose/ui/test/DesktopInputDispatcher.desktop.kt
A compose/ui/ui-test/src/desktopMain/kotlin/androidx/compose/ui/test/Mouse.desktop.kt
ap...@google.com <ap...@google.com> #9
Branch: androidx-main
commit d668ae478fe1a0e9f6fbbb42d069669f1dc3961d
Author: Jelle Fresen <jellefresen@google.com>
Date: Thu Sep 16 15:12:58 2021
Fix few errors in mouse input injection docs
* Removed documentation that refers to non-existing API
* Removed TODO out of documentation
* Documented Touch and Mouse properties
* Removed stray design considerations
Bug: 190493367
Test: N/A
Change-Id: I08a9b4c224956d6ae45981993e10d36558d3e299
M compose/ui/ui-test/src/commonMain/kotlin/androidx/compose/ui/test/MultiModalInjectionScope.kt
M compose/ui/ui-test/src/commonMain/kotlin/androidx/compose/ui/test/MouseInjectionScope.kt
ap...@google.com <ap...@google.com> #10
Branch: androidx-main
commit c6884d4c8e23a6914db4eb1afd077df119db45a6
Author: Jelle Fresen <jellefresen@google.com>
Date: Fri Sep 17 18:24:03 2021
Make MultiModalInjectionScope an interface
Which is implemented by MultiModalInjectionScopeImpl. The interface is
sealed to allow future addition of properties, and the only
implementation is internal so exhaustive when over the type of an
instance of that interface is forced to include an else block.
It will also improve layering of the API by preventing implementation
details to be leaked into the public API of MultiModalInjectionScope,
which would happen for example when it decides to implement Density by
delegation.
Bug: 190493367
Test: ./gradlew compose:ui:ui-test:cC && \
./gradlew compose:ui:ui-test:test
Relnote: N/A
Change-Id: Ib76c2ccbfe6393dc3397dfc7c3a0ec08ff4cd842
M compose/ui/ui-test/api/current.txt
M compose/ui/ui-test/api/public_plus_experimental_current.txt
M compose/ui/ui-test/src/commonMain/kotlin/androidx/compose/ui/test/GestureScope.kt
M compose/ui/ui-test/src/androidAndroidTest/kotlin/androidx/compose/ui/test/inputdispatcher/TouchUpTest.kt
M compose/ui/ui-test/src/commonMain/kotlin/androidx/compose/ui/test/MultiModalInjectionScope.kt
M compose/ui/ui-test/src/androidAndroidTest/kotlin/androidx/compose/ui/test/partialgesturescope/SendCancelTest.kt
M compose/ui/ui-test/api/restricted_current.txt
M compose/ui/ui-test/src/commonMain/kotlin/androidx/compose/ui/test/Actions.kt
M compose/ui/ui-test/src/androidAndroidTest/kotlin/androidx/compose/ui/test/inputdispatcher/InputDispatcherTest.kt
M compose/ui/ui-test/src/androidAndroidTest/kotlin/androidx/compose/ui/test/injectionscope/touch/UpTest.kt
M compose/ui/ui-test/src/androidAndroidTest/kotlin/androidx/compose/ui/test/inputdispatcher/TouchCancelTest.kt
M compose/ui/ui-test/src/androidAndroidTest/kotlin/androidx/compose/ui/test/injectionscope/touch/CancelTest.kt
M compose/ui/ui-test/src/androidAndroidTest/kotlin/androidx/compose/ui/test/partialgesturescope/SendUpTest.kt
ap...@google.com <ap...@google.com> #11
Branch: androidx-main
commit d3d5b9fc5b602ab9edc83c921e861e6dd9deacde
Author: Jelle Fresen <jellefresen@google.com>
Date: Wed Sep 08 17:53:29 2021
Move InputDispatcher tests to host side tests
Because some code is used from both host side tests and instrumented
tests, a shared folder has been added that is included in both the host
side test variant and the instrumented test variant.
Bug: 190493367
Test: ./gradlew compose:ui:ui-test:test
Change-Id: I114d9f0b6462caf3c3267b6d81d2fe3c90a44024
M compose/ui/ui-test/src/test/kotlin/androidx/compose/ui/test/inputdispatcher/MouseEventsTest.kt
D compose/ui/ui-test/src/androidAndroidTest/kotlin/androidx/compose/ui/test/inputdispatcher/TouchUpTest.kt
A compose/ui/ui-test/src/test/kotlin/androidx/compose/ui/test/Constants.kt
A compose/ui/ui-test/src/test/resources/mockito-extensions/org.mockito.plugins.MockMaker
M compose/ui/ui-test/src/test/kotlin/androidx/compose/ui/test/inputdispatcher/BatchingTest.kt
M compose/ui/ui-test/src/test/kotlin/androidx/compose/ui/test/inputdispatcher/IsGestureInProgressTest.kt
M compose/ui/ui-test/build.gradle
M compose/ui/ui-test/src/test/kotlin/androidx/compose/ui/test/util/SplitsDurationEquallyIntoTest.kt
D compose/ui/ui-test/src/androidAndroidTest/kotlin/androidx/compose/ui/test/util/Truth.kt
M compose/ui/ui-test/src/androidAndroidTest/kotlin/androidx/compose/ui/test/injectionscope/touch/UpTest.kt
M compose/ui/ui-test/src/androidAndroidTest/kotlin/androidx/compose/ui/test/injectionscope/touch/CancelTest.kt
M compose/ui/ui-test/src/test/kotlin/androidx/compose/ui/test/util/IsMonotonicBetweenTest.kt
A compose/ui/ui-test/src/test/kotlin/androidx/compose/ui/test/inputdispatcher/TouchEventsTest.kt
A compose/ui/ui-test/src/androidCommonTest/kotlin/androidx/compose/ui/test/util/MotionEventRecorder.kt
D compose/ui/ui-test/src/androidAndroidTest/kotlin/androidx/compose/ui/test/inputdispatcher/TouchDownTest.kt
M compose/ui/ui-test/src/androidCommonTest/kotlin/androidx/compose/ui/test/util/InputDispatcherTestRule.kt
M compose/ui/ui-test/src/test/kotlin/androidx/compose/ui/test/inputdispatcher/InputDispatcherTest.kt
M compose/ui/ui-test/src/androidAndroidTest/kotlin/androidx/compose/ui/test/partialgesturescope/SendCancelTest.kt
M compose/ui/ui-test/src/test/kotlin/androidx/compose/ui/test/inputdispatcher/AdvanceEventTimeTest.kt
M compose/ui/ui-test/src/androidCommonTest/kotlin/androidx/compose/ui/test/util/Verifications.kt
D compose/ui/ui-test/src/androidAndroidTest/kotlin/androidx/compose/ui/test/inputdispatcher/TouchCancelTest.kt
A compose/ui/ui-test/src/androidCommonTest/README.md
M compose/ui/ui-test/src/androidAndroidTest/kotlin/androidx/compose/ui/test/partialgesturescope/SendUpTest.kt
D compose/ui/ui-test/src/androidAndroidTest/kotlin/androidx/compose/ui/test/inputdispatcher/TouchMoveTest.kt
ap...@google.com <ap...@google.com> #12
Branch: androidx-main
commit be6e11888b09d95b6064935562aeb51d05f01cf2
Author: Jelle Fresen <jellefresen@google.com>
Date: Wed Sep 08 18:44:15 2021
Consider root bounds when injecting mouse events
When going out of bounds, send an exit event and stop sending more
events. Only allow cancel events and events that are part of an ongoing
gesture.
Bug: 190493367
Test: ./gradlew compose:ui:ui-test:test
Change-Id: I5372348a9731ee339ca194c728a0ba80c60ab784
M compose/ui/ui-test/src/commonMain/kotlin/androidx/compose/ui/test/InputDispatcher.kt
M compose/ui/ui-test/src/test/kotlin/androidx/compose/ui/test/inputdispatcher/MouseEventsTest.kt
M compose/ui/ui-test/src/androidMain/kotlin/androidx/compose/ui/test/AndroidInputDispatcher.android.kt
M compose/ui/ui-test/src/test/kotlin/androidx/compose/ui/test/inputdispatcher/InputDispatcherTest.kt
ap...@google.com <ap...@google.com> #13
Branch: androidx-main
commit fa5e67454053827a65bde026b4d85133d7467a71
Author: Jelle Fresen <jellefresen@google.com>
Date: Wed Apr 10 15:45:18 2024
Revisit mouse click injection API
Added a button parameter to all click methods in MouseInjectionScope
(click(), doubleClick(), tripleClick() and longClick()), and deprecated
the incorrectly named rightClick() method.
Bug: 190493367
Bug: 261439695
Test: Added tests for each method
Relnote: "`MouseInjectionScope.click()`,
`MouseInjectionScope.doubleClick()`,
`MouseInjectionScope.tripleClick()`, `MouseInjectionScope.longClick()`
now accept a `button: MouseButton` parameter to make them more
universally applicable. The default value is `MouseButton.Primary` for
all methods."
Change-Id: I31a23e6819a82b5513db3731dce3bf8cd7587d69
M compose/ui/ui-test/api/current.txt
M compose/ui/ui-test/api/restricted_current.txt
M compose/ui/ui-test/samples/src/main/java/androidx/compose/ui/test/samples/MouseInjectionScopeSamples.kt
M compose/ui/ui-test/src/androidCommonTest/kotlin/androidx/compose/ui/test/util/Verifications.kt
M compose/ui/ui-test/src/androidInstrumentedTest/kotlin/androidx/compose/ui/test/injectionscope/mouse/ClickTest.kt
M compose/ui/ui-test/src/androidInstrumentedTest/kotlin/androidx/compose/ui/test/injectionscope/mouse/Common.kt
M compose/ui/ui-test/src/androidInstrumentedTest/kotlin/androidx/compose/ui/test/util/PointerInputs.kt
M compose/ui/ui-test/src/commonMain/kotlin/androidx/compose/ui/test/MouseInjectionScope.kt
lp...@google.com <lp...@google.com> #14
Branch: androidx-main
commit 277edf07f9f40b6d551e29409fe61fde3d2c785f
Author: Jelle Fresen <jellefresen@google.com>
Date: Tue Mar 19 16:55:19 2024
Graduate mouse injection API to stable
Removed methods that were deprecated hidden and experimental
Bug: 190493367
Fix: 261439695
Test: bOS
Relnote: "All mouse injection API for tests are now stable"
Change-Id: I974c9e6c9114c0babf6cfeae278930c537c02847
M compose/foundation/foundation/integration-tests/lazy-tests/src/androidTest/kotlin/androidx/compose/foundation/lazy/list/LazyNestedScrollingTest.kt
M compose/foundation/foundation/src/androidInstrumentedTest/kotlin/androidx/compose/foundation/BasicMarqueeTest.kt
M compose/foundation/foundation/src/androidInstrumentedTest/kotlin/androidx/compose/foundation/BasicTooltipTest.kt
M compose/foundation/foundation/src/androidInstrumentedTest/kotlin/androidx/compose/foundation/ClickableTest.kt
M compose/foundation/foundation/src/androidInstrumentedTest/kotlin/androidx/compose/foundation/CombinedClickableTest.kt
M compose/foundation/foundation/src/androidInstrumentedTest/kotlin/androidx/compose/foundation/Draggable2DTest.kt
M compose/foundation/foundation/src/androidInstrumentedTest/kotlin/androidx/compose/foundation/DraggableTest.kt
M compose/foundation/foundation/src/androidInstrumentedTest/kotlin/androidx/compose/foundation/HoverableTest.kt
M compose/foundation/foundation/src/androidInstrumentedTest/kotlin/androidx/compose/foundation/OverscrollTest.kt
M compose/foundation/foundation/src/androidInstrumentedTest/kotlin/androidx/compose/foundation/ScrollableTest.kt
M compose/foundation/foundation/src/androidInstrumentedTest/kotlin/androidx/compose/foundation/contextmenu/ContextMenuAreaTest.kt
M compose/foundation/foundation/src/androidInstrumentedTest/kotlin/androidx/compose/foundation/contextmenu/ContextMenuGestureTest.kt
M compose/foundation/foundation/src/androidInstrumentedTest/kotlin/androidx/compose/foundation/selection/SelectableTest.kt
M compose/foundation/foundation/src/androidInstrumentedTest/kotlin/androidx/compose/foundation/selection/ToggleableTest.kt
M compose/foundation/foundation/src/androidInstrumentedTest/kotlin/androidx/compose/foundation/text/BasicTextHoverTest.kt
M compose/foundation/foundation/src/androidInstrumentedTest/kotlin/androidx/compose/foundation/text/BasicTextLinkTest.kt
M compose/foundation/foundation/src/androidInstrumentedTest/kotlin/androidx/compose/foundation/text/ClickableTextTest.kt
M compose/foundation/foundation/src/androidInstrumentedTest/kotlin/androidx/compose/foundation/text/CoreTextFieldHoverTest.kt
M compose/foundation/foundation/src/androidInstrumentedTest/kotlin/androidx/compose/foundation/text/input/internal/BasicTextFieldHoverTest.kt
M compose/foundation/foundation/src/androidInstrumentedTest/kotlin/androidx/compose/foundation/text/input/internal/selection/TextFieldTextToolbarTest.kt
M compose/foundation/foundation/src/androidInstrumentedTest/kotlin/androidx/compose/foundation/text/selection/gestures/AbstractSelectionGesturesTest.kt
M compose/foundation/foundation/src/androidInstrumentedTest/kotlin/androidx/compose/foundation/text/selection/gestures/MultiTextSelectionGesturesRtlTest.kt
M compose/foundation/foundation/src/androidInstrumentedTest/kotlin/androidx/compose/foundation/text/selection/gestures/MultiTextSelectionGesturesTest.kt
M compose/foundation/foundation/src/androidInstrumentedTest/kotlin/androidx/compose/foundation/text/selection/gestures/MultiTextWithSpaceSelectionGesturesRegressionTest.kt
M compose/foundation/foundation/src/androidInstrumentedTest/kotlin/androidx/compose/foundation/text/selection/gestures/TextFieldSelectionGesturesTest.kt
M compose/foundation/foundation/src/androidInstrumentedTest/kotlin/androidx/compose/foundation/text/selection/gestures/TextSelectionGesturesBidiTest.kt
M compose/foundation/foundation/src/androidInstrumentedTest/kotlin/androidx/compose/foundation/text/selection/gestures/TextSelectionGesturesTest.kt
M compose/material/material/src/androidInstrumentedTest/kotlin/androidx/compose/material/ButtonScreenshotTest.kt
M compose/material/material/src/androidInstrumentedTest/kotlin/androidx/compose/material/CheckboxScreenshotTest.kt
M compose/material/material/src/androidInstrumentedTest/kotlin/androidx/compose/material/FloatingActionButtonScreenshotTest.kt
M compose/material/material/src/androidInstrumentedTest/kotlin/androidx/compose/material/RadioButtonScreenshotTest.kt
M compose/material/material/src/androidInstrumentedTest/kotlin/androidx/compose/material/SwitchScreenshotTest.kt
M compose/material3/material3/src/androidInstrumentedTest/kotlin/androidx/compose/material3/CardScreenshotTest.kt
M compose/material3/material3/src/androidInstrumentedTest/kotlin/androidx/compose/material3/CheckboxScreenshotTest.kt
M compose/material3/material3/src/androidInstrumentedTest/kotlin/androidx/compose/material3/FloatingActionButtonScreenshotTest.kt
M compose/material3/material3/src/androidInstrumentedTest/kotlin/androidx/compose/material3/IconButtonScreenshotTest.kt
M compose/material3/material3/src/androidInstrumentedTest/kotlin/androidx/compose/material3/RadioButtonScreenshotTest.kt
M compose/material3/material3/src/androidInstrumentedTest/kotlin/androidx/compose/material3/SwitchScreenshotTest.kt
M compose/ui/ui-test/api/current.txt
M compose/ui/ui-test/api/restricted_current.txt
M compose/ui/ui-test/samples/src/main/java/androidx/compose/ui/test/samples/MouseInjectionScopeSamples.kt
M compose/ui/ui-test/samples/src/main/java/androidx/compose/ui/test/samples/MultiModalInjectionScopeSamples.kt
M compose/ui/ui-test/src/androidInstrumentedTest/kotlin/androidx/compose/ui/test/injectionscope/mouse/CancelTest.kt
M compose/ui/ui-test/src/androidInstrumentedTest/kotlin/androidx/compose/ui/test/injectionscope/mouse/ClickTest.kt
M compose/ui/ui-test/src/androidInstrumentedTest/kotlin/androidx/compose/ui/test/injectionscope/mouse/MoveTest.kt
M compose/ui/ui-test/src/androidMain/kotlin/androidx/compose/ui/test/AndroidInputDispatcher.android.kt
M compose/ui/ui-test/src/androidMain/kotlin/androidx/compose/ui/test/Mouse.android.kt
M compose/ui/ui-test/src/androidUnitTest/kotlin/androidx/compose/ui/test/inputdispatcher/KeyAndMouseEventsTest.kt
M compose/ui/ui-test/src/androidUnitTest/kotlin/androidx/compose/ui/test/inputdispatcher/MouseEventsTest.kt
M compose/ui/ui-test/src/commonMain/kotlin/androidx/compose/ui/test/Actions.kt
M compose/ui/ui-test/src/commonMain/kotlin/androidx/compose/ui/test/InputDispatcher.kt
M compose/ui/ui-test/src/commonMain/kotlin/androidx/compose/ui/test/Mouse.kt
M compose/ui/ui-test/src/commonMain/kotlin/androidx/compose/ui/test/MouseInjectionScope.kt
M compose/ui/ui-test/src/commonMain/kotlin/androidx/compose/ui/test/MultiModalInjectionScope.kt
M compose/ui/ui-test/src/desktopMain/kotlin/androidx/compose/ui/test/DesktopInputDispatcher.desktop.kt
M compose/ui/ui-test/src/desktopMain/kotlin/androidx/compose/ui/test/Mouse.desktop.kt
M compose/ui/ui/src/androidInstrumentedTest/kotlin/androidx/compose/ui/input/nestedscroll/NestedScrollModifierTest.kt
M compose/ui/ui/src/androidInstrumentedTest/kotlin/androidx/compose/ui/input/pointer/MouseEventTest.kt
M compose/ui/ui/src/androidInstrumentedTest/kotlin/androidx/compose/ui/input/pointer/PointerIconTest.kt
M compose/ui/ui/src/androidInstrumentedTest/kotlin/androidx/compose/ui/platform/AndroidViewCompatTest.kt
M tv/tv-material/src/androidTest/java/androidx/tv/material3/IconButtonScreenshotTest.kt
M tv/tv-material/src/androidTest/java/androidx/tv/material3/RadioButtonScreenshotTest.kt
M tv/tv-material/src/androidTest/java/androidx/tv/material3/SwitchScreenshotTest.kt
ap...@google.com <ap...@google.com> #15
Branch: androidx-main
commit 645e8b61ea35e1da54d7bbce606a8b573531318c
Author: Louis Pullen-Freilich <lpf@google.com>
Date: Wed Dec 20 17:29:33 2023
Removes lazilyCreateIndication parameter
This parameter conflates behavior changes for different use cases, and is a bit misleading. Indication will continue to be created lazily if a null interaction source is provided, and the indication is of type IndicationNodeFactory. Explicitly hoisting an interaction source will disable the lazily creation. Opting into lazy creation for cases where you are hoisting the interaction source but only reading from it will be considered separately in the future.
Bug:
Test: tests
Relnote: N/A
Change-Id: I795afdf1c49402def71c87c9de57232444ea57c1
M compose/foundation/foundation/api/current.txt
M compose/foundation/foundation/api/restricted_current.txt
M compose/foundation/foundation/src/androidInstrumentedTest/kotlin/androidx/compose/foundation/ClickableTest.kt
M compose/foundation/foundation/src/androidInstrumentedTest/kotlin/androidx/compose/foundation/CombinedClickableTest.kt
M compose/foundation/foundation/src/androidInstrumentedTest/kotlin/androidx/compose/foundation/selection/SelectableTest.kt
M compose/foundation/foundation/src/androidInstrumentedTest/kotlin/androidx/compose/foundation/selection/ToggleableTest.kt
M compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/Clickable.kt
M compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/selection/Selectable.kt
M compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/selection/Toggleable.kt
M compose/ui/ui/benchmark/src/androidTest/java/androidx/compose/ui/benchmark/ModifiersBenchmark.kt
ap...@google.com <ap...@google.com> #16
Branch: androidx-main
commit ef8e9f60d94a9604380d3a00a18425f999fabcda
Author: Louis Pullen-Freilich <lpf@google.com>
Date: Thu Dec 21 15:34:05 2023
Updates Material and Foundation components to expose a nullable MutableInteractionSource
Components that previously exposed an API such as:
interactionSource: MutableInteractionSource = remember { MutableInteractionSource() }
Have been updated to instead expose a nullable MutableInteractionSource that defaults to null. This allows for some components to never create and remember a MutableInteractionSource, and allows for some other components to lazily create one only when needed. Some components always need a MutableInteractionSource currently, so if null they will just create a new one internally - so for those cases there are no changes, but it allows for future optimizations.
Also deletes long deprecated experimental Card and Surface overloads.
Test: updateApi, existing tests
Bug:
Relnote: "Material and Foundation components exposing a MutableInteractionSource in their API have been updated to now expose a nullable MutableInteractionSource that defaults to null. There are no semantic changes here: passing null means that you do not wish to hoist the MutableInteractionSource, and it will be created inside the component if needed. Changing to null allows for some components to never allocate a MutableInteractionSource, and allows for other components to only lazily create an instance when they need to, which improves performance across these components. If you are not using the MutableInteractionSource you pass to these components, it is recommended that you pass null instead. It is also recommended that you make similar changes in your own components."
Change-Id: I41c73c7809bc704da4ab6b4c2c74016d1380f001
M camera/integration-tests/avsynctestapp/src/main/java/androidx/camera/integration/avsync/ui/widget/Button.kt
M compose/foundation/foundation/api/current.txt
M compose/foundation/foundation/api/restricted_current.txt
M compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text/BasicTextField.kt
M compose/foundation/foundation/src/desktopMain/kotlin/androidx/compose/foundation/Scrollbar.desktop.kt
M compose/material/material/api/current.txt
M compose/material/material/api/restricted_current.txt
M compose/material/material/src/androidMain/kotlin/androidx/compose/material/AndroidMenu.android.kt
M compose/material/material/src/commonMain/kotlin/androidx/compose/material/BottomNavigation.kt
M compose/material/material/src/commonMain/kotlin/androidx/compose/material/Button.kt
M compose/material/material/src/commonMain/kotlin/androidx/compose/material/Card.kt
M compose/material/material/src/commonMain/kotlin/androidx/compose/material/Checkbox.kt
M compose/material/material/src/commonMain/kotlin/androidx/compose/material/Chip.kt
M compose/material/material/src/commonMain/kotlin/androidx/compose/material/FloatingActionButton.kt
M compose/material/material/src/commonMain/kotlin/androidx/compose/material/IconButton.kt
M compose/material/material/src/commonMain/kotlin/androidx/compose/material/Menu.kt
M compose/material/material/src/commonMain/kotlin/androidx/compose/material/NavigationRail.kt
M compose/material/material/src/commonMain/kotlin/androidx/compose/material/OutlinedTextField.kt
M compose/material/material/src/commonMain/kotlin/androidx/compose/material/RadioButton.kt
M compose/material/material/src/commonMain/kotlin/androidx/compose/material/Slider.kt
M compose/material/material/src/commonMain/kotlin/androidx/compose/material/Surface.kt
M compose/material/material/src/commonMain/kotlin/androidx/compose/material/Switch.kt
M compose/material/material/src/commonMain/kotlin/androidx/compose/material/Tab.kt
M compose/material/material/src/commonMain/kotlin/androidx/compose/material/TextField.kt
M compose/material/material/src/desktopMain/kotlin/androidx/compose/material/DesktopMenu.desktop.kt
ap...@google.com <ap...@google.com> #17
Branch: androidx-main
commit 3f8a328a3d4a7b420d9696126e893b106a4b9cd6
Author: Louis Pullen-Freilich <lpf@google.com>
Date: Wed Dec 27 20:43:56 2023
Updates tv-material components to expose a nullable MutableInteractionSource
Components that previously exposed an API such as:
interactionSource: MutableInteractionSource = remember { MutableInteractionSource() }
Have been updated to instead expose a nullable MutableInteractionSource that defaults to null. This allows for some components to never create and remember a MutableInteractionSource, and allows for some other components to lazily create one only when needed. Some components always need a MutableInteractionSource currently, so if null they will just create a new one internally - so for those cases there are no changes, but it allows for future optimizations.
Test: updateApi, existing tests
Bug:
Relnote: "tv-material components exposing a MutableInteractionSource in their API have been updated to now expose a nullable MutableInteractionSource that defaults to null. There are no semantic changes here: passing null means that you do not wish to hoist the MutableInteractionSource, and it will be created inside the component if needed. Changing to null allows for some components to never allocate a MutableInteractionSource, and allows for other components to only lazily create an instance when they need to, which improves performance across these components. If you are not using the MutableInteractionSource you pass to these components, it is recommended that you pass null instead. It is also recommended that you make similar changes in your own components."
Change-Id: I309b436d212ef53897979df40da9b1768377893f
M tv/tv-material/api/current.txt
M tv/tv-material/api/restricted_current.txt
M tv/tv-material/src/main/java/androidx/tv/material3/Button.kt
M tv/tv-material/src/main/java/androidx/tv/material3/Card.kt
M tv/tv-material/src/main/java/androidx/tv/material3/CardLayout.kt
M tv/tv-material/src/main/java/androidx/tv/material3/Checkbox.kt
M tv/tv-material/src/main/java/androidx/tv/material3/Chip.kt
M tv/tv-material/src/main/java/androidx/tv/material3/IconButton.kt
M tv/tv-material/src/main/java/androidx/tv/material3/ListItem.kt
M tv/tv-material/src/main/java/androidx/tv/material3/NavigationDrawerItem.kt
M tv/tv-material/src/main/java/androidx/tv/material3/RadioButton.kt
M tv/tv-material/src/main/java/androidx/tv/material3/Surface.kt
M tv/tv-material/src/main/java/androidx/tv/material3/Switch.kt
M tv/tv-material/src/main/java/androidx/tv/material3/Tab.kt
M tv/tv-material/src/main/java/androidx/tv/material3/WideButton.kt
ap...@google.com <ap...@google.com> #18
Branch: androidx-main
commit f8fa920a5a088277028bfa4c186aedb235d253c0
Author: Louis Pullen-Freilich <lpf@google.com>
Date: Wed Dec 27 20:42:07 2023
Updates wear material and wear material3 components to expose a nullable MutableInteractionSource
Components that previously exposed an API such as:
interactionSource: MutableInteractionSource = remember { MutableInteractionSource() }
Have been updated to instead expose a nullable MutableInteractionSource that defaults to null. This allows for some components to never create and remember a MutableInteractionSource, and allows for some other components to lazily create one only when needed. Some components always need a MutableInteractionSource currently, so if null they will just create a new one internally - so for those cases there are no changes, but it allows for future optimizations.
Test: updateApi, existing tests
Bug:
Relnote: "Wear material and wear material3 components exposing a MutableInteractionSource in their API have been updated to now expose a nullable MutableInteractionSource that defaults to null. There are no semantic changes here: passing null means that you do not wish to hoist the MutableInteractionSource, and it will be created inside the component if needed. Changing to null allows for some components to never allocate a MutableInteractionSource, and allows for other components to only lazily create an instance when they need to, which improves performance across these components. If you are not using the MutableInteractionSource you pass to these components, it is recommended that you pass null instead. It is also recommended that you make similar changes in your own components."
Change-Id: Ib90fc2736d2311e467d7c2a3fef4df757afaf525
M wear/compose/compose-material-core/src/androidTest/kotlin/androidx/wear/compose/materialcore/ButtonTest.kt
M wear/compose/compose-material-core/src/androidTest/kotlin/androidx/wear/compose/materialcore/SelectionControlsTest.kt
M wear/compose/compose-material-core/src/androidTest/kotlin/androidx/wear/compose/materialcore/ToggleButtonTest.kt
M wear/compose/compose-material-core/src/main/java/androidx/wear/compose/materialcore/Button.kt
M wear/compose/compose-material-core/src/main/java/androidx/wear/compose/materialcore/Card.kt
M wear/compose/compose-material-core/src/main/java/androidx/wear/compose/materialcore/RepeatableClickable.kt
M wear/compose/compose-material-core/src/main/java/androidx/wear/compose/materialcore/SelectionControls.kt
M wear/compose/compose-material-core/src/main/java/androidx/wear/compose/materialcore/Slider.kt
M wear/compose/compose-material-core/src/main/java/androidx/wear/compose/materialcore/ToggleButton.kt
M wear/compose/compose-material/api/current.txt
M wear/compose/compose-material/api/restricted_current.txt
M wear/compose/compose-material/src/main/java/androidx/wear/compose/material/Button.kt
M wear/compose/compose-material/src/main/java/androidx/wear/compose/material/Card.kt
M wear/compose/compose-material/src/main/java/androidx/wear/compose/material/Chip.kt
M wear/compose/compose-material/src/main/java/androidx/wear/compose/material/SwipeToReveal.kt
M wear/compose/compose-material/src/main/java/androidx/wear/compose/material/ToggleButton.kt
M wear/compose/compose-material/src/main/java/androidx/wear/compose/material/ToggleChip.kt
M wear/compose/compose-material/src/main/java/androidx/wear/compose/material/ToggleControl.kt
M wear/compose/compose-material3/api/current.txt
M wear/compose/compose-material3/api/restricted_current.txt
M wear/compose/compose-material3/src/main/java/androidx/wear/compose/material3/Button.kt
M wear/compose/compose-material3/src/main/java/androidx/wear/compose/material3/Card.kt
M wear/compose/compose-material3/src/main/java/androidx/wear/compose/material3/IconButton.kt
M wear/compose/compose-material3/src/main/java/androidx/wear/compose/material3/RadioButton.kt
M wear/compose/compose-material3/src/main/java/androidx/wear/compose/material3/TextButton.kt
M wear/compose/compose-material3/src/main/java/androidx/wear/compose/material3/ToggleButton.kt
lp...@google.com <lp...@google.com> #19
ap...@google.com <ap...@google.com> #20
Branch: androidx-main
commit 2e1799e019e275415a95804a8beb5a5a0bf3f86f
Author: Louis Pullen-Freilich <lpf@google.com>
Date: Wed Jan 10 02:53:19 2024
Removes AbstractClickablePointerInputNode, flattens pointer input logic
Pointer input handling is now handled inline: click and hover handling as well as their corresponding interactions are all handled in one place, removing the need for a separate pointer input node for clicks, and removing the HoverableNode delegation.
Bug:
Test: existing tests
Change-Id: I755c468d84f538aef3354a385c81e8c38fa69738
M compose/foundation/foundation/src/androidInstrumentedTest/kotlin/androidx/compose/foundation/selection/SelectableTest.kt
M compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/Clickable.kt
M compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/Hoverable.kt
M compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/selection/Selectable.kt
M compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/selection/Toggleable.kt
ap...@google.com <ap...@google.com> #21
Branch: androidx-main
commit b657f2f2082e2a1d17c2c259792ac9f3a57d2e0a
Author: Louis Pullen-Freilich <lpf@google.com>
Date: Fri Nov 24 13:28:02 2023
Adds ripple API to material3 library
The new ripple API replaces the deprecated rememberRipple API - it creates a ripple instance that will use the default theme values. ripple does not need to be remembered, similar to modifiers - if the parameters compare equally, then the same node can be reused internally. Also adds RippleDefaults that contain the default values used by material3.
This CL also migrates all material3 components to use the new ripple. There is a temporary CompositionLocal, LocalUseFallbackRippleImplementation, which can be set to true to fallback to using the old RippleTheme / rememberRipple implementation, but this is strongly discouraged as it is much less performant than the new implementation. This fallback will be removed in the next stable release, and exists here to aid migration.
Bug:
Bug:
Test: RippleTest
Relnote: "Adds new ripple API in material3 which replaces the deprecated rememberRipple. Also adds a temporary CompositionLocal, LocalUseFallbackRippleImplementation, to revert material3 components to using the deprecated rememberRipple / RippleTheme APIs. This will be removed in the next stable release, and is only intended to be a temporary migration aid for cases where you are providing a custom RippleTheme. See
Change-Id: I34cbc2834133de4f3e8dde389ed4dab8c54b0c95
M compose/material3/material3/api/current.txt
M compose/material3/material3/api/restricted_current.txt
M compose/material3/material3/src/androidInstrumentedTest/kotlin/androidx/compose/material3/RippleTest.kt
M compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/Checkbox.kt
M compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/IconButton.kt
M compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/MaterialTheme.kt
M compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/Menu.kt
M compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/NavigationBar.kt
M compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/NavigationRail.kt
M compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/RadioButton.kt
A compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/Ripple.kt
M compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/Slider.kt
M compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/Surface.kt
M compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/Switch.kt
M compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/Tab.kt
ap...@google.com <ap...@google.com> #22
Branch: androidx-main
commit c1dfd3a4e8af6f3b9182211f39883962ee81385b
Author: Louis Pullen-Freilich <lpf@google.com>
Date: Fri Nov 24 13:30:18 2023
Adds RippleConfiguration APIs to material3
RippleConfiguration and LocalRippleConfiguration allow for per-component / sub-tree customization of ripples using fixed values. For example, to change the color of a component you don't control, or to disable a ripple for a component. In most cases the default values should be used: these APIs are an escape hatch for customization of individual components / limited sub-trees. For wider changes and custom design systems, you should instead build your own ripple using createRippleModifierNode.
Bug:
Test: RippleTest
Relnote: "Adds RippleConfiguration and LocalRippleConfiguration to allow for per-component / sub-tree customization of ripples using fixed values. For example, to change the color of a component you don't control, or to disable a ripple for a component. In most cases the default values should be used: these APIs are an escape hatch for customization of individual components / limited sub-trees. For wider changes and custom design systems, you should instead build your own ripple using createRippleModifierNode. For more information, see
Change-Id: I7b5d62fd50ee78bb3559f83886aa1e7d9f964fb1
M compose/material3/material3/api/current.txt
M compose/material3/material3/api/restricted_current.txt
M compose/material3/material3/src/androidInstrumentedTest/kotlin/androidx/compose/material3/RippleTest.kt
M compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/Ripple.kt
ap...@google.com <ap...@google.com> #23
Branch: androidx-main
commit 6b42889368193eccb3bb2b1af1850f0a2a76feca
Author: Louis Pullen-Freilich <lpf@google.com>
Date: Thu Dec 28 04:08:41 2023
Updates material3 components to expose a nullable MutableInteractionSource
Components that previously exposed an API such as:
interactionSource: MutableInteractionSource = remember { MutableInteractionSource() }
Have been updated to instead expose a nullable MutableInteractionSource that defaults to null. This allows for some components to never create and remember a MutableInteractionSource, and allows for some other components to lazily create one only when needed. Some components always need a MutableInteractionSource currently, so if null they will just create a new one internally - so for those cases there are no changes, but it allows for future optimizations.
Test: updateApi, existing tests
Bug:
Relnote: "Material3 components exposing a MutableInteractionSource in their API have been updated to now expose a nullable MutableInteractionSource that defaults to null. There are no semantic changes here: passing null means that you do not wish to hoist the MutableInteractionSource, and it will be created inside the component if needed. Changing to null allows for some components to never allocate a MutableInteractionSource, and allows for other components to only lazily create an instance when they need to, which improves performance across these components. If you are not using the MutableInteractionSource you pass to these components, it is recommended that you pass null instead. It is also recommended that you make similar changes in your own components."
Change-Id: I41abb601499b4a735b6302b96cdc1f0d066dbbdc
M compose/material3/material3-adaptive-navigation-suite/api/current.txt
M compose/material3/material3-adaptive-navigation-suite/api/restricted_current.txt
M compose/material3/material3-adaptive-navigation-suite/src/commonMain/kotlin/androidx/compose/material3/adaptive/navigation-suite/NavigationSuiteScaffold.kt
M compose/material3/material3/api/current.txt
M compose/material3/material3/api/restricted_current.txt
M compose/material3/material3/src/androidMain/kotlin/androidx/compose/material3/AndroidMenu.android.kt
M compose/material3/material3/src/androidMain/kotlin/androidx/compose/material3/SearchBar.android.kt
M compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/Button.kt
M compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/Card.kt
M compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/Checkbox.kt
M compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/Chip.kt
M compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/FloatingActionButton.kt
M compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/IconButton.kt
M compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/Label.kt
M compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/Menu.kt
M compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/NavigationBar.kt
M compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/NavigationDrawer.kt
M compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/NavigationRail.kt
M compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/OutlinedTextField.kt
M compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/RadioButton.kt
M compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/SegmentedButton.kt
M compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/Surface.kt
M compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/Switch.kt
M compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/Tab.kt
M compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/TextField.kt
ap...@google.com <ap...@google.com> #24
Branch: androidx-main
commit 176632f8e826524658d782b03c9d27892d047819
Author: Louis Pullen-Freilich <lpf@google.com>
Date: Wed Jan 31 15:59:06 2024
Turns off auto invalidation in clickable / focusable
This causes a lot of extra work when input parameters are changed, such as invalidating focus nodes - even though most of these parameters do not affect the state of the node tree.
Bug:
Fixes:
Test: ClickableTest
Test: TabRowBenchmark
Change-Id: I2fcc8732784d27fde072ac739f917f6da5a432a6
M compose/foundation/foundation/src/androidInstrumentedTest/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/Focusable.kt
M compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/FocusedBounds.kt
M compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/relocation/BringIntoViewRequester.kt
M compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/relocation/BringIntoViewResponder.kt
lp...@google.com <lp...@google.com> #25
Summarizing a discussion we had today: One of the long term ideas / goals we had for clickable was to be able to fully remove focus* logic, when in touch mode. There are some problems with this approach:
a) When we are in touch mode, and we swap to non-touch mode with a key press, this will also request focus. This means that in order for us to handle this properly, we need to have a stable focus tree by this point in time: if we just observeReads and delegate() a focus node, this will happen after we apply changes, so the nodes won't be attached when we try and focus. Instead we would probably need to advance the snapshot, to force synchronous creation of the focus node tree, but focus invalidation currently happens after we apply changes, so if we immediately add the nodes the focus tree will be in a broken state, so this would require some unknown amount of rewriting to make sure we can initialize the tree inline, safely, to make this use case work.
b) behavior gets a bit dangerous / undefined if we do this, consider the following:
Button(Modifier.focusProperties { ... }...)
Depending on touch mode, this focus properties modifier would either apply to the focus target inside button, or the next focus target within - this is very misleading and can lead to subtle behavioral problems. It's also hard to define this 'correctly', if you only want to affect the button in non-touch mode: for the reasons listed in a) it would be difficult to synchronize the creation of this focus properties modifier, with the time we create the focus target, to make sure that everything is in sync at the same time.
We might want to revisit this in the future, but given the constraints / unknown work here, and the performance investigations we did, it looks like we can still get close to this performance baseline with some other optimizations, so focusing on making sure that when we aren't focusable, as little work is done as possible inside focus.
ap...@google.com <ap...@google.com> #26
Branch: androidx-main
commit a3b31c9837990f5d556aeda56c056d464848af3a
Author: Louis Pullen-Freilich <lpf@google.com>
Date: Tue Apr 09 01:59:53 2024
Adds APIs to FocusTargetModifierNode for observing focus changes, configuring focusability, and requesting focus
This allows delegating nodes to just delegate to one FocusTargetModifierNode, instead of needing to add separate requester / event / properties nodes to modify the delegated and owned target node.
Also migrates focusable / clickable to use this, which reduces the cost of focus invalidation as we can remove all the other node types.
FocusProperties APIs for configurating focus requesters will be added in the future to FocusTargetModifierNode.
Bug:
Test: FocusableTest
Test: ClickableTest
Test: FocusTargetModifierNodeTest
Relnote: "Added FocusTargetModifierNode#requestFocus(), FocusTargetModifierNode#focusability, and a new FocusTargetModifierNode() overload that exposes FocusTargetMode and a callback for when focus state changes. This makes it simpler to implement delegated modifiers that should be focusable, as you do not need to implement requester / event / properties nodes as well, in order to modify the target node."
Change-Id: I27f84d34307dc78bbd14ecda328ea9cdc5b63b8b
M compose/foundation/foundation/src/androidInstrumentedTest/kotlin/androidx/compose/foundation/FocusableTest.kt
M compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/Clickable.kt
M compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/Focusable.kt
M compose/ui/ui/api/current.ignore
M compose/ui/ui/api/current.txt
M compose/ui/ui/api/restricted_current.ignore
M compose/ui/ui/api/restricted_current.txt
A compose/ui/ui/src/androidInstrumentedTest/kotlin/androidx/compose/ui/focus/FocusTargetModifierNodeTest.kt
M compose/ui/ui/src/androidInstrumentedTest/kotlin/androidx/compose/ui/node/NodeUtils.kt
M compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/focus/FocusEventModifierNode.kt
M compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/focus/FocusInvalidationManager.kt
M compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/focus/FocusOwnerImpl.kt
M compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/focus/FocusTargetModifierNode.kt
M compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/focus/FocusTargetNode.kt
M compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/focus/FocusTransactions.kt
A compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/focus/Focusability.kt
lp...@google.com <lp...@google.com> #27
After the last CL, there are no more high priority areas of work related to / inside clickable itself that we are tracking for performance - clickable is roughly 4x in perf microbenchmarks since 1.5*. There is ongoing work into optimizing parts of the focus system, but that's at a lower level than clickable and won't affect clickable's implementation. Closing this bug accordingly
Description
multiple state objects, multiple GlobalPositionAwareNodes which invalidate layout every time this updates, and many allocations and initialization work.
We can expect there to be dozens of clickables on a relatively average screen, and much more in some situations, so it being cheap is incredibly important. Moreover, most of them will never get interacted with, and we ought to pay as little for those as possible during initialization.
In the CL linked below, I have laid out my ideas for how I think we should refactor Clickable. Broadly this amounts to:
1. refactor indication to not need composition
2. make clickable correspond to a single element / node, even including delegated nodes, until there is an interaction that warrants an "inflation" of the node to include the more expensive things like indication etc.
More context on this issue can be found in aosp/2729638