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

Modern-Apps.git / cast / tv / AGENTS.md

AGENTS.md3.4 KiBRenderedCodeRaw
1# AGENTS.md — cast/tv/ (':cast:tv')
2
3> Scoped supplement. Global rules in root `AGENTS.md` apply. Stay inside `cast/tv/` + allowed shared modules. Do not root-scan.
4
5_Install: ./install cast/tv (dev by default)._
6- Gradle: :cast:tv / dir: cast/tv/
7- Package roots present: ui, platform, service
8- Entry files: MainActivity.kt, Route.kt, Navigation.kt (receiver shell — NOT a phone app; one-deep Route host, TV panel modes instead)
9- Deps: :cast:protocol, :library:e2ee-p2p
10- Metadata: metadata_data/cast-tv.md (present)
11- Rust: no / screenshotTest: no
12
13## Overview
14**Purpose:** Android-TV receiver for the `cast/` sender — advertises, pairs, decodes and plays mirrored screen + handed-off media. Runs on TV, never evaluated as a phone app.
15**Key features:**
16- Receiver advertisement + pairing handshake (`ReceiverAdvertiser`, `ReceiverPairing`, `PairingStore`) against `:cast:protocol`
17- Control channel + media loop (`ReceiverController`, `ReceiverMediaLoop`) feeding `ContentPlayer`/`AudioPlayer`/`VideoDecoder` with artwork fetch
18- TV panel modes + transport overlay + now-playing UI (`PanelModes`, `TransportOverlay`, `NowPlaying`)
19**Architecture / data-flow:** `service/ReceiverService` owns lifetime → `platform/ReceiverController` + `ControlChannel` → `ReceiverMediaLoop` → decoders/players → `ui/` TV surfaces; mirror input lands in `MirrorActivity`.
20**Entry points + reading order:** `MainActivity.kt` → `service/ReceiverService.kt` → `platform/ReceiverController.kt` → `platform/ReceiverMediaLoop.kt` → `platform/ContentPlayer.kt`.
21**Gotchas:**
22- TV-only: no edge-to-edge phone chrome, D-pad focus matters, no touch assumptions
23- Decoder capabilities feed back to the sender's codec negotiation — receiver bugs surface as sender quality drops
24- Pairing store persists trust; clearing it force-drops all senders
25
26## Key files
27### Root — receiver shell + navigation
28- com/vayunmathur/cast/tv/MainActivity.kt
29- com/vayunmathur/cast/tv/Route.kt — Starting/Ready/Pairing/Connected/Failed destinations
30- com/vayunmathur/cast/tv/Navigation.kt — one-deep MainNavigation host (phase → Route)
31### platform/ — receiver pipeline
32- com/vayunmathur/cast/tv/platform/ReceiverController.kt
33- com/vayunmathur/cast/tv/platform/ReceiverUiContract.kt
34- com/vayunmathur/cast/tv/platform/ReceiverAdvertiser.kt
35- com/vayunmathur/cast/tv/platform/ReceiverPairing.kt
36- com/vayunmathur/cast/tv/platform/PairingStore.kt
37- com/vayunmathur/cast/tv/platform/ControlChannel.kt
38- com/vayunmathur/cast/tv/platform/ReceiverMediaLoop.kt
39- com/vayunmathur/cast/tv/platform/ReceiverContentSession.kt
40- com/vayunmathur/cast/tv/platform/MediaReceiver.kt
41- com/vayunmathur/cast/tv/platform/ContentPlayer.kt
42- com/vayunmathur/cast/tv/platform/AudioPlayer.kt
43- com/vayunmathur/cast/tv/platform/VideoDecoder.kt
44- com/vayunmathur/cast/tv/platform/ArtworkFetcher.kt
45- com/vayunmathur/cast/tv/platform/MirrorActivity.kt
46- com/vayunmathur/cast/tv/platform/PanelModes.kt
47### service/ — receiver lifetime
48- com/vayunmathur/cast/tv/service/ReceiverService.kt
49### ui/ — TV surfaces (D-pad, not touch)
50- com/vayunmathur/cast/tv/ui/ReceiverContent.kt
51- com/vayunmathur/cast/tv/ui/NowPlaying.kt
52- com/vayunmathur/cast/tv/ui/TransportOverlay.kt
53- com/vayunmathur/cast/tv/ui/Theme.kt — TV receiver theme (not DynamicTheme)
54
55## Verify (this module only)
56```
57./gradlew :cast:tv:compileDevKotlin
58./gradlew :cast:tv:lint
59./gradlew :cast:tv:checkMetadata
60```