Skip to content

Reject water-induced touches by contact size, add crown sync - #13

Open
johnhringiv wants to merge 2 commits into
mainfrom
wet-touch-rejection
Open

johnhringiv wants to merge 2 commits into
mainfrom
wet-touch-rejection

Conversation

@johnhringiv

@johnhringiv johnhringiv commented Aug 6, 2026 •

Copy link
Copy Markdown
Owner

Water on the glass could silently move your start.

A droplet running across the screen registers as a tap. The top half of a live countdown is SYNC, which rounds to the nearest minute, so one stray contact shifts the gun by up to 30 seconds with nothing on screen to show it happened. Reproduced on-device as a 91-second error from four stray contacts 15 seconds apart, each rounding the countdown back up so it never advanced.

What changed

  • Spray is filtered out by contact size. Water reads smaller than skin on the digitiser, so sync, mode toggle and reset ignore contacts below a calibrated floor. Rejections are silent — no haptic — because a buzz would say something happened when nothing did.
  • The crown now syncs. About a quarter-turn during a countdown syncs to the nearest minute. Water cannot turn a crown, so this path stays available when the glass is wet, and it is the only one left once Wear OS auto-engages Water Lock and disables touch. Crown sync skips the contact guard entirely.
  • Reset is guarded too. Water held on the glass long enough to trip the long-press wiped a live countdown during testing.
  • Long races no longer break the display. Count-up rolls into H:MM:SS past an hour instead of growing the minute field without bound. A timer left running after a race reached 1022:47, too wide for the watch — it wrapped onto a second line and pushed the RACE label off the screen. Under an hour the format is unchanged, so the digits do not change shape at the gun.
  • Debug builds install alongside the Play copy as com.johnhringiv.regattatimer.debug, labelled RT DEBUG. The launcher entry, tile and complication all rename together, so a dev build can no longer be mistaken for the real one on the water.

Calibration

Measured on a Pixel Watch 3. MotionEvent.getTouchMajor() reports on the same 0–255 scale as the raw ABS_MT_TOUCH_MAJOR axis, so kernel and framework captures are directly comparable.

contact measured range
water 2.99 – 9.98, plus 13.97 for a heavy direct drip
real tap 8.98 – 18.95

Taps are judged on the touch-down value, reset on the gesture peak. A press lands soft and spreads — measured as 6.98 growing to 10.97 over a 706 ms hold — so judging a long-press by its down value refuses genuine presses and breaks reset outright. That was found on-watch, not in the tests.

Pressure was evaluated first and discarded: ABS_MT_PRESSURE on this device is binary, 0 or 1000, and carries no information despite advertising a 0–1000 range.

The trade being made

The two populations overlap, so no threshold accepts every real tap and rejects every droplet. The floor is set to win the droplet side: 2 of 8 deliberately-light taps were refused in testing. A refused tap is visible and repeatable; an accepted droplet silently moves the gun. The tests assert this cost explicitly so it cannot later be mistaken for a bug.

The guard fails open where a device does not report contact size, so watches other than the calibrated one behave exactly as they did before.

Known limits

  • A heavy direct drip reads 13.97 — indistinguishable from a fingertip. No contact-size floor can reject it. The crown is the guaranteed path.
  • The floors have had one real outing, in very light wind, which is a weak test of spray rejection. They are verified dry in detail; their behaviour under a proper drenching is still unproven. The measurement that would have quantified it was lost to a logcat buffer that silently reverted to its 64 KiB default mid-session.
  • 36 unit tests cover the guard, the sync arithmetic, countdown rendering and count-up formatting.

Note for review

The per-touch calibration logging in MainActivity.dispatchTouchEvent, TimerViewModel.acceptTouch and the rotary handler is still present, deliberately — it is the only instrument for the outstanding wet-weather test. There is no -assumenosideeffects rule in proguard-rules.pro, so R8 keeps these calls in release. Strip them before this reaches Play if that test is not going to happen first.

🤖 Generated with Claude Code

A droplet running across the glass registers as a tap. The top half of a
live countdown is SYNC, which rounds to the nearest minute, so one stray
contact silently moves the gun by up to 30s. Reproduced on-device as a
91s error from four stray taps 15s apart, each rounding the countdown
back up so it never advanced.

Guard sync, mode toggle and reset on MotionEvent touch-major, captured in
dispatchTouchEvent before Compose routes the event (PointerInputChange
does not carry it). Water reads SMALLER than skin, so the guard is a
floor, calibrated on a Pixel Watch 3:

  water      2.99 .. 9.98    then 13.97 for a heavy direct drip
  real tap   8.98 .. 18.95

Taps are judged on the touch-down value, reset on the gesture peak: a
press lands soft and spreads, measured as 6.98 growing to 10.97 over a
706ms hold, so judging a long-press by its down value refuses genuine
presses and breaks reset entirely.

The two populations overlap, so the floor also refuses the lightest real
taps: 2 of 8 deliberately-light taps in testing. That trade is deliberate
and documented in the tests. A refused tap is visible and repeatable; an
accepted droplet silently moves the gun, which is the harm being fixed.

Crown rotation syncs as a parallel, water-immune path and bypasses the
guard. The guard also fails open where a device reports no contact size,
so unmeasured watches behave exactly as before.

Debug builds take applicationId .debug and the name "RT DEBUG" so a dev
build installs alongside the Play Store copy instead of colliding with
its signature.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@johnhringiv johnhringiv closed this Aug 6, 2026
@johnhringiv johnhringiv reopened this Aug 6, 2026
Nothing ends a race, so count-up runs until it is reset. Left overnight it
reached "1022:47", which is too wide for the watch: the digits wrapped onto
a second line and shoved the RACE label off the screen entirely. Caught by
screenshotting a watch that had been counting since the previous evening.

Roll into H:MM:SS past an hour instead of letting the minute field grow
without bound. Format alone is not enough — "1:00:00" is seven characters,
the same width class that was already wrapping — so the type also steps
down for the longer strings: 68sp to 5 chars, 44sp for 6-7, 34sp beyond.
maxLines/softWrap ensure anything unforeseen clips rather than wrapping.

Under an hour the output is identical to the countdown's M:SS, so the
digits do not change shape at the gun. The countdown is capped at its
armed duration and keeps the original path untouched.

Verified by rendering each band at 408x408 density 320 — the Pixel Watch 3
geometry, reproduced on an emulator, which otherwise defaults to 454 and
would have flattered the result.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@johnhringiv
johnhringiv marked this pull request as ready for review August 9, 2026 01:12

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant