ui-trace: add holddrag, a press-hold-then-drag gesture

Neither existing action can produce "hold stationary for LONG_PRESS,
then move without lifting, then release": tap has no hold at all, and
swipe X1 Y1 X2 Y2 MS interpolates motion across its whole duration
starting at t=0, so a long swipe with a short first segment is still
continuous motion throughout, never a hold followed by a drag.

holddrag X1 Y1 X2 Y2 HOLD_MS MOVE_MS extends the same
MotionEvent/injectInputEvent mechanism swipe already uses: DOWN, sleep
HOLD_MS, then MOVE at the same fixed 10ms cadence swipe uses over
MOVE_MS, then UP -- one continuous touch. Additive; existing commands
unchanged.

Verified against a real device (this repo has no unit test harness, so
verification is driving a device, matching its existing posture):
`ui-trace record --do "holddrag 300 1850 300 2050 600 300"` against
ai-app-2's iris transcript screen produced a real long-press-then-drag
selection (confirmed by the app's own logcat and a screenshot showing
the resulting highlighted selection) that neither tap nor swipe could
reach. javac --release 17 -Xlint:all -Werror clean.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
irisandClaude Fable 5.1 committed 2026-09-05 15:01:01 -04:00
1 parent 0cae9dc1d9
commit 86cf4e8088
2 files changed
+37 -1

No files matched your search

+2 -1
View File
@@ -367,7 +367,8 @@ def main():
rec.add_argument("-i", "--interval", type=int, default=16,
help="ms between samples (0 = as fast as possible)")
rec.add_argument("--do", action="append", default=[], metavar="ACTION",
help="'wait MS' | 'tap X Y' | 'swipe X1 Y1 X2 Y2 [MS]', repeatable")
help="'wait MS' | 'tap X Y' | 'swipe X1 Y1 X2 Y2 [MS]' | "
"'holddrag X1 Y1 X2 Y2 HOLD_MS MOVE_MS', repeatable")
rec.add_argument("-o", "--out", help="where to save the trace")
rec.add_argument("-m", "--match", help="show a timeline for these afterwards")
rec.add_argument("--field", default="top",