diff options
Diffstat (limited to '.agent/code-map.md')
| -rw-r--r-- | .agent/code-map.md | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/.agent/code-map.md b/.agent/code-map.md index eb2f564..1a36542 100644 --- a/.agent/code-map.md +++ b/.agent/code-map.md @@ -359,8 +359,11 @@ CI (`android.yml`) triggers only on pushes to `main`. Firebase App Distribution ## 8. Context Tips & Gotchas ### Navigation / GPS -- `DeviceGpsProvider` uses `FusedLocationProviderClient`. External GPS comes via NMEA TCP/UDP through `NmeaStreamManager` → `NmeaParser` → `GpsProvider` interface. -- GPS fix is stale after 10 s — `MainViewModel` shows red "No GPS" banner. +- `LocationService` (foreground service) uses `FusedLocationProviderClient` for Android GPS. External GPS comes via NMEA TCP/UDP through `NmeaStreamManager` → `NmeaParser`, emitted on `LocationService.nmeaGpsPositionFlow`. +- `LocationService.recomputeBestPosition()` fuses NMEA + Android GPS: prefers NMEA if < 5 s old, falls back to Android. Result is `bestPosition: StateFlow<GpsPosition?>`. +- `locationFlow: SharedFlow<GpsPosition>(replay=1)` carries raw Android fixes. **`replay=1` means new subscribers immediately receive the last cached position regardless of age — there is no staleness expiry.** Consumers must check `gpsData.timestampMs` if they care about age. +- `DeviceGpsProvider` implements `GpsProvider` and has a `fixLostRunnable` (10 s timeout), but is **dead code** — it is never instantiated. `LocationService` does not use the `GpsProvider` interface. There is no "No GPS" banner. +- Background location: `throttleLocationIfIdle()` (called on `onPause`) sends `ACTION_STOP_UPDATES` to stop `fusedLocationClient` when neither recording nor anchor-watch is active. `restoreLocationMode()` (called on `onResume`) restarts appropriate mode. ### NMEA - `NmeaStreamManager` handles connection lifecycle (reconnect on failure). Don't manage socket lifecycle elsewhere. |
