Commit Graph
5 Commits
Author SHA1 Message Date
Gideon Zenz 4d8ef91b13 Health Connect: Gate DistanceSyncer with supportsActivityDistance flag
Add supportsActivityDistance coordinator capability flag following the
supportsActiveCalories pattern. When true, DistanceSyncer syncs all
per-minute distance and RecordedWorkoutSyncer skips DistanceRecords.

Enabled for Garmin (watch + bike), Xiaomi, and Huawei. Other devices
with distance fields (CMF, Colmi, H+, etc.) left at default false
until per-minute data quality is verified.
2026-04-07 10:30:40 +02:00
Gideon Zenz da3f21aafb Health Connect: Add DistanceSyncer for daily activity distance
Syncs device-reported distance (distanceCm) from ActivitySamples to
Health Connect DistanceRecord. Only writes actual device measurements,
skips NOT_MEASURED or zero values.
2026-04-07 10:29:13 +02:00
Gideon Zenz 26dc2879d9 Health Connect: Fix partial sleep sessions not being replaced by full data
Sleep sessions that grow over time (partial data synced mid-sleep, full
data available after waking) were permanently stuck as partial records
in Health Connect. The sync cursor advanced past the session's start
after the first sync, so the full session was never re-processed.

Fix with two mechanisms:
- Set clientRecordId per sleep session (deterministic from device +
  start hour) with clientRecordVersion = stage count, enabling HC's
  native upsert: re-inserting the same session replaces partial data
  with the full record.
- Hold the sync cursor behind sessions that ended less than 6 hours
  ago (likely still in-progress), so they get re-processed on the
  next sync with more complete data.
2026-04-07 00:35:58 +02:00
Gideon Zenz 68475a07fd Health Connect: Use separate start/end offsets for workout records
Resolve ZoneOffset independently for workout start and end instants,
so workouts spanning a DST transition get correct offset metadata on
both ends.
2026-04-05 23:40:57 +02:00
Gideon Zenz 746bc16bfa Health Connect: Use per-timestamp timezone offset for DST correctness
Replace single sync-time ZoneOffset with ZoneId, resolving the correct
offset per record timestamp via ZoneId.rules.getOffset(instant). Fixes
wrong offset metadata on records crossing DST boundaries (e.g. sleep
sessions starting in CET and ending in CEST).

Also fixes leading space in device model name after manufacturer prefix
strip.
2026-04-05 23:40:57 +02:00