Modern Apps git
git clone https://git.maproj.org/Modern-Apps.git
main ▾

Modern-Apps.git / auto / AGENTS.md

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