android / android/android-test
Swipe actions use toolType MotionEvent.TOOL_TYPE_UNKNOWN instead of FINGER or allow specifying
- Dominant language
- Java
- Stars
- 1.2k
- Forks
- 342
- Avg merge
- 11h 29m
- Merged PRs (30d)
- 2
Description
### Description
The various [`Swipe` actions](https://github.com/android/android-test/blob/461ca02299807020c0b317b1805eb709d3c25147/espresso/core/java/androidx/test/espresso/action/Swipe.java) don't allow specifying the `toolType`. They use the simple [`MotionEvents.obtain`](https://developer.android.com/reference/android/view/MotionEvent#obtain(long,%20long,%20int,%20float,%20float,%20int)) method instead of [the full one](https://developer.android.com/reference/android/view/MotionEvent#obtain(long,%20long,%20int,%20int,%20android.view.MotionEvent.PointerProperties[],%20android.view.MotionEvent.PointerCoords[],%20int,%20int,%20float,%20float,%20int,%20int,%20int,%20int)), which sets the toolType to `MotionEvent.TOOL_TYPE_UNKNOWN`.
Since API level 14, real MotionEvents have had the toolType set to `MotionEvent.TOOL_TYPE_FINGER` or `STYLUS` or `MOUSE`.
The Swipe API should default to `TOOL_TYPE_FINGER` and optionally allow specifying a toolType.
Contributor guide
Research direction
Start with espresso/core/java/androidx/test/espresso/action/Swipe.java and inspect how its actions call MotionEvents.obtain. The work is done when Swipe defaults to MotionEvent.TOOL_TYPE_FINGER and provides an option to specify another tool type, while preserving the existing swipe behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- mobile-dev
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100