feat(train): recording a workout on Android (ADR 0030, D13, D16, D19, D21)

RecorderService, a foreground service of the types location and health
started from the open app, takes fixes from LocationManager's GPS and
steps from the step detector, pauses by itself (AutoPause, tested on the
JVM) and appends each sample to the person's recording file, flushed
every five seconds. MainActivity asks for location, notifications and,
for auto-pause on foot, physical activity, never background location
(D19), and bridges the service to the app.

The app follows the file's lines with RecordingBloc and shows the moving
time, the distance, the pace or speed and GPS's state; the notification
shows the time and the distance with Pause or Resume. Stop is held down;
a stopped recording is saved as a workout and its series, or discarded
after asking, and one cut off or left unsaved is offered as the app
opens. Home has the Record button where the device records.

Three choices of the implementation's are recorded under D21 for review:
rowing waits for 5f, auto-pause on foot without steps goes by GPS speed
(below 2 km/h, on above 3 km/h), and Stop's hint shows above the button.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Tizian 「ティツィアーン」 <raisondetredev@pm.me>
This commit is contained in:
Tizian 「ティツィアーン」 2026-10-28 13:24:56 +01:00
commit 7df1cb1740
Signed by: raisondetredev
GPG key ID: 07F6FCF405488B64

View file

@ -1,7 +1,7 @@
# ADR 0030: Halkyon Train, what it does and where its data comes from
- **Status:** decided 27–28 Oct 2026, by the developer (D1–D20 below). The shell (D12)
is built; recording (D13–D20) is being built.
- **Status:** decided 27–28 Oct 2026, by the developer (D1–D21 below). The shell (D12)
is built; recording (D13–D21) is being built.
- **Numbering:** 0025 is held by the federation draft (stashed), 0026–0029 by the .NET
rewrite on the local branch `rewrite-dotnet`, abandoned on 27 Oct; Train takes the next
free number so that neither is ever read as this one.
@ -314,6 +314,29 @@ Strava. What was found, 27 Oct:
default), adjustable once Train has settings. A better filter later (smoothing, a
Kalman filter) reads old workouts anew, as nothing was thrown away. An hour at a fix a
second is 3,600 fixes, tens of kilobytes delta-coded and gzipped.
- **D21 The recording screen** (proposed, the developer's): home's Record button opens a
sheet of the activities, the last one recorded chosen, with auto-pause's switch as D16
sets it; Start asks the permissions (D19). Until the first fix precise enough the
screen says it waits for GPS, showing the accuracy, while it records already, the time
from Start. Recording, it shows the moving time, the distance and the pace now (min/km
running, walking and hiking, km/h cycling; rowing time alone until 5f; heart rate once
a strap is there, 5e), an automatic pause told apart from one by hand, no map until 5c.
Stop is a long press, so that no pocket ends a run (over a tap and a confirmation,
quicker and easier to hit by mistake), then Save or Discard, Discard asked again. The
notification shows time and distance with Pause or Resume and opens the app; stopping
only in the app, so that no stray touch on the lock screen ends a workout. A recording
found cut off as Train opens (D18) is offered to be saved up to its last sample or
discarded.
Built on 28 Oct with three choices of the implementation's, for the developer to look
at: rowing indoors isn't offered yet, as a foreground service on Android 14 and later
needs a type its permissions allow and rowing without the rower has none (5f's
Bluetooth gives it `connectedDevice`); on foot without the step detector auto-pause
goes by GPS speed below 2 km/h for 5 s, going on above 3 km/h (D16 names only the
bike's thresholds); and Stop's hint shows above the button for three seconds rather
than in a snack bar, which would cover the button it speaks of. The service holds a
partial wake lock while it records (at most 12 hours), so that its clock and file run
with the screen off where no GPS fix wakes the processor.
## Consequences