Modern-Apps.git
Publicgit clone https://git.maproj.org/Modern-Apps.gitModern-Apps.git / auto / AGENTS.md
| 1 | # AGENTS.md — auto/ (':auto') |
| 2 | |
| 3 | > Scoped supplement. Global rules in root `AGENTS.md` apply. Stay inside `auto/` + allowed shared modules. Do not root-scan. |
| 4 | |
| 5 | _Install: ./install auto (dev by default)._ |
| 6 | <!-- last-reviewed: 2026-10-16 --> |
| 7 | - Gradle: :auto / dir: auto/ |
| 8 | - Package roots present: ui, platform, network, service, notifications, telephony |
| 9 | - Entry files: MainActivity.kt, Route.kt, Navigation.kt |
| 10 | - Deps: :auto:protocol (`:library:carhost` only if the build file says so — verify before adding) |
| 11 | - Metadata: metadata_data/auto.md (present) |
| 12 | - Rust: no / screenshotTest: yes (phone status/pairing/pinned-apps previews) |
| 13 | |
| 14 | ## Overview |
| 15 | **Purpose:** Car head-unit projection (Android Auto compatible) — NOT a phone app. Projects driving-safe nav/media/call UI to the car display over USB or wireless; test with `./dhu` (Desktop Head Unit loopback), not on a phone screen. |
| 16 | **Key features:** |
| 17 | - USB + wireless transports (`network/UsbConnector`/`WifiDirectConnector`, `HeadUnitServer`) speaking the GAL protocol in `:auto:protocol` (framing, TLS, video/input/sensor codecs) |
| 18 | - Car cards: nav guidance, media now-playing + capture, call cards, messaging with voice reply, TTS, sensor feed (speed/gear/night-mode) |
| 19 | - Role negotiation (MAOS host vs mirror), pairing flow, boot/startup services, `telephony/` in-call services for car calls |
| 20 | **Architecture / data-flow:** Transports → `:auto:protocol` codecs/sessions → `platform/` channels (video/audio/input/sensor/nav/media/messaging) → `CarAppHost` + card pushers → car display; `service/ProjectionService` owns the session, `platform/AutoViewModel` (+ `PairingViewModel`) drives `ui/` phone-side pairing/status. |
| 21 | **Entry points + reading order:** `Route` → `MainActivity.kt` → `platform/CarAppHost.kt` → `service/ProjectionService.kt` → `network/HeadUnitServer.kt` → `:auto:protocol` `GalConnection.kt`. |
| 22 | **Gotchas:** |
| 23 | - Never evaluate this module on a phone screen — `./dhu` is the loop; car-display geometry comes from the head unit |
| 24 | - Driver-distraction rules constrain the car UI (cards, not free navigation) — keep car surfaces templated |
| 25 | - Connection teardown/reconnect (USB unplug, wireless drop) is the main bug surface; `ReconnectBackoff` + reset receivers matter |
| 26 | |
| 27 | ## Key files |
| 28 | ### Root — entry + navigation |
| 29 | - com/vayunmathur/auto/MainActivity.kt |
| 30 | - com/vayunmathur/auto/Navigation.kt |
| 31 | - com/vayunmathur/auto/Route.kt |
| 32 | ### network/ — head-unit transports |
| 33 | - com/vayunmathur/auto/network/HeadUnitServer.kt |
| 34 | - com/vayunmathur/auto/network/TransportIntake.kt |
| 35 | - com/vayunmathur/auto/network/UsbConnector.kt |
| 36 | - com/vayunmathur/auto/network/WifiDirectConnector.kt |
| 37 | ### platform/ — host, cards, channels, pairing, receivers |
| 38 | - com/vayunmathur/auto/platform/CarAppHost.kt |
| 39 | - com/vayunmathur/auto/platform/AutoViewModel.kt |
| 40 | - com/vayunmathur/auto/platform/PairingViewModel.kt |
| 41 | - com/vayunmathur/auto/platform/AutoConnectionState.kt |
| 42 | - com/vayunmathur/auto/platform/AutoSessionState.kt |
| 43 | - com/vayunmathur/auto/platform/CarDisplay.kt |
| 44 | - com/vayunmathur/auto/platform/CarPresentation.kt |
| 45 | - com/vayunmathur/auto/platform/CarApps.kt |
| 46 | - com/vayunmathur/auto/platform/CarDrawerView.kt |
| 47 | - com/vayunmathur/auto/platform/CarRailView.kt |
| 48 | - com/vayunmathur/auto/platform/CarNavCard.kt |
| 49 | - com/vayunmathur/auto/platform/CarMediaCard.kt |
| 50 | - com/vayunmathur/auto/platform/CarCallCard.kt |
| 51 | - com/vayunmathur/auto/platform/CallCardPush.kt |
| 52 | - com/vayunmathur/auto/platform/CarUiKit.kt |
| 53 | - com/vayunmathur/auto/platform/CarTts.kt |
| 54 | - com/vayunmathur/auto/platform/VideoEncoder.kt |
| 55 | - com/vayunmathur/auto/platform/VideoSinkChannel.kt |
| 56 | - com/vayunmathur/auto/platform/AudioSinkChannel.kt |
| 57 | - com/vayunmathur/auto/platform/AudioEvent.kt |
| 58 | - com/vayunmathur/auto/platform/AudioState.kt |
| 59 | - com/vayunmathur/auto/platform/InputChannel.kt |
| 60 | - com/vayunmathur/auto/platform/InputEvent.kt |
| 61 | - com/vayunmathur/auto/platform/SensorChannel.kt |
| 62 | - com/vayunmathur/auto/platform/SensorEvent.kt |
| 63 | - com/vayunmathur/auto/platform/GuidanceChannel.kt |
| 64 | - com/vayunmathur/auto/platform/NavGuidanceMonitor.kt |
| 65 | - com/vayunmathur/auto/platform/NavStatusChannel.kt |
| 66 | - com/vayunmathur/auto/platform/MediaNowPlaying.kt |
| 67 | - com/vayunmathur/auto/platform/MediaPlaybackMonitor.kt |
| 68 | - com/vayunmathur/auto/platform/MusicCapture.kt |
| 69 | - com/vayunmathur/auto/platform/MusicCapturePrefs.kt |
| 70 | - com/vayunmathur/auto/platform/MusicCaptureSinkHolder.kt |
| 71 | - com/vayunmathur/auto/platform/Messaging.kt |
| 72 | - com/vayunmathur/auto/platform/MessagingAudio.kt |
| 73 | - com/vayunmathur/auto/platform/MessagingPrefs.kt |
| 74 | - com/vayunmathur/auto/platform/MicPermission.kt |
| 75 | - com/vayunmathur/auto/platform/MicSourceChannel.kt |
| 76 | - com/vayunmathur/auto/platform/PhoneStatusMonitor.kt |
| 77 | - com/vayunmathur/auto/platform/TransportState.kt |
| 78 | - com/vayunmathur/auto/platform/ActiveCallInfo.kt |
| 79 | - com/vayunmathur/auto/platform/MaosRoleStatus.kt |
| 80 | - com/vayunmathur/auto/platform/DeepLinkResolverActivity.kt |
| 81 | - com/vayunmathur/auto/platform/WirelessStartupActivity.kt |
| 82 | - com/vayunmathur/auto/platform/WirelessStartupReceiver.kt |
| 83 | - com/vayunmathur/auto/platform/WirelessSetupCarService.kt |
| 84 | - com/vayunmathur/auto/platform/WirelessSetupSharedService.kt |
| 85 | - com/vayunmathur/auto/platform/BootReceiver.kt |
| 86 | - com/vayunmathur/auto/platform/UsbReceiver.kt |
| 87 | - com/vayunmathur/auto/platform/UsbTPlusReceiver.kt |
| 88 | - com/vayunmathur/auto/platform/WifiBluetoothReceiver.kt |
| 89 | - com/vayunmathur/auto/platform/ConnectivityEventReceiver.kt |
| 90 | - com/vayunmathur/auto/platform/ConnectionResetReceiver.kt |
| 91 | - com/vayunmathur/auto/platform/CarStartupService.kt |
| 92 | - com/vayunmathur/auto/platform/CarSetupService.kt |
| 93 | - com/vayunmathur/auto/platform/CarChimeraService.kt |
| 94 | - com/vayunmathur/auto/platform/CarCompanionDeviceService.kt |
| 95 | - com/vayunmathur/auto/platform/CarSystemUiControllerService.kt |
| 96 | - com/vayunmathur/auto/platform/AppDecorService.kt |
| 97 | ### service/ — projection + messaging/music capture |
| 98 | - com/vayunmathur/auto/service/ProjectionService.kt |
| 99 | - com/vayunmathur/auto/service/CarAppHostSession.kt |
| 100 | - com/vayunmathur/auto/service/CarMessagingAudio.kt |
| 101 | - com/vayunmathur/auto/service/MessagingCarAppService.kt |
| 102 | - com/vayunmathur/auto/service/MusicCaptureService.kt |
| 103 | - com/vayunmathur/auto/service/UnownedServiceLog.kt |
| 104 | ### telephony/ — car in-call services |
| 105 | - com/vayunmathur/auto/telephony/CarProjectionInCallService.kt |
| 106 | - com/vayunmathur/auto/telephony/NonCarInCallService.kt |
| 107 | ### notifications/ — message mirroring + replies |
| 108 | - com/vayunmathur/auto/notifications/MessageMirrorService.kt |
| 109 | - com/vayunmathur/auto/notifications/MessageMirrorBus.kt |
| 110 | - com/vayunmathur/auto/notifications/MessageReplyRoute.kt |
| 111 | ### ui/ — phone-side pairing + session status |
| 112 | - com/vayunmathur/auto/ui/AutoScreen.kt |
| 113 | - com/vayunmathur/auto/ui/PairingScreen.kt |
| 114 | - com/vayunmathur/auto/ui/SessionCard.kt |
| 115 | - com/vayunmathur/auto/ui/AudioRow.kt |
| 116 | - com/vayunmathur/auto/ui/MessagingConsentCard.kt |
| 117 | - com/vayunmathur/auto/ui/MicPermissionCard.kt |
| 118 | - com/vayunmathur/auto/ui/MusicCaptureCard.kt |
| 119 | - com/vayunmathur/auto/ui/MusicCaptureGrant.kt |
| 120 | |
| 121 | ## Verify (this module only) |
| 122 | ``` |
| 123 | ./gradlew :auto:compileDevKotlin |
| 124 | ./gradlew :auto:lint |
| 125 | ./gradlew :auto:checkMetadata |
| 126 | ``` |