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

Modern-Apps.git / launcher / AGENTS.md

AGENTS.md8.9 KiBRenderedCodeRaw
1# AGENTS.md — launcher/ (':launcher')
2
3> Scoped supplement. Global rules in root `AGENTS.md` apply. Stay inside `launcher/` + allowed shared modules. Do not root-scan.
4
5_Install: ./install launcher (dev by default). For a TV over Wi-Fi: `sh launcher/install-tv.sh <TV_IP>` builds, installs and offers to set it as the default home; `sh launcher/undo-tv.sh <TV_IP>` restores the stock home._
6<!-- last-reviewed: 2026-10-20 -->
7- Gradle: :launcher / dir: launcher/
8- Package roots present: ui, data, domain, platform + tv/{ui,data,domain,platform}
9- Entry files: MainActivity.kt (UiMode-routed), Route.kt + Navigation.kt (phone), tv/TvRoute.kt + tv/TvNavigation.kt (TV)
10- Deps: :library:room + androidx.tv.material (via common-conventions-tv)
11- Metadata: metadata_data/launcher.md (present, mentions TV mode)
12- Rust: no / screenshotTest: yes
13
14## Overview
15**Purpose:** Offline home-screen replacement — paged grid, hotseat, folders, searchable drawer, real widget hosting on phones; calm banner home with HDMI inputs and D-pad reorder on TVs. One APK routes by UI mode. Layout in encrypted Room (phone) / DataStore order (TV); no account, nothing uploaded.
16**Key features:**
17- Workspace grid with drag/drop/reorder/folder-merge, drop-bar targets, page-edge dwell, widget resize frames (`ui/components/` drag system + `domain/` placement math)
18- App drawer with fast scroll + predictions; widget host incl. configurable providers (`platform/LauncherWidgetHost`)
19- Icon cache, app-change monitor, privilege-gated surfaces; settings pages
20- TV mode (`tv/`): 6-per-row 16:9 banner grid, bottom glass row (App Store/HDMI/Settings/Reorder), clock + network header, single-OK pick-up/drop reorder with focus-chase and slot glide, edit/add menus, HOME role — DataStore order, no Room/widget init
21**Architecture / data-flow:** `ui/` home/drawer/folder/settings → `platform/LauncherViewModel` (+ `LauncherUiContract`) → `data/LauncherRepository` over Room; `domain/` is pure grid math (occupancy, placement, reorder, folders, hotseat, pagination) — the single biggest pure-logic area in any app, testable without Compose. `tv/ui/` → `tv/platform/TvHomeViewModel` (+ `TvUiContract`) → `tv/data/TvPrefs` (DataStore); `tv/domain/TvRowOrder` is pure row math. `MainActivity` routes by `UiModeManager`; neither mode initializes the other's stack.
22**Entry points + reading order:** `Route` → `MainActivity.kt` (UiMode branch) → phone `Navigation.kt` → `ui/HomeWorkspace.kt` → `platform/LauncherViewModel.kt` → `domain/GridPlacer.kt` + `domain/ReconcileUseCase.kt`; TV `TvRoute` → `tv/TvNavigation.kt` → `tv/ui/TvHomeScreen.kt` → `tv/platform/TvHomeViewModel.kt` → `tv/domain/TvRowOrder.kt`.
23**Gotchas:**
24- Exempt from the raw-animation rule: built on `animateBounds`/`Animatable` — do NOT "migrate" its motion to library helpers. TV code under `tv/` keeps using `library.ui` helpers anyway — no regression just because the package is exempt.
25- Reconcile (installed-apps vs stored layout) runs on package changes — launcher bugs after installs live in `ReconcileUseCase` + `LauncherAppsMonitor`
26- Drag input math is in `domain/`, gesture plumbing in `ui/components/` — keep them separated
27- TV Back order: edit menu → cancel hold (quiet restore) → disarm reorder → no-op. TV hint slot is always composed (`TvReorderHint`) — never conditionally compose hints in the `SpaceBetween` column or the grid jumps.
28- One HOME filter carries MAIN+LAUNCHER+LEANBACK_LAUNCHER+HOME+DEFAULT together — split filters on one activity confuse resolver elections.
29
30## Key files
31### Root — entry + navigation
32- com/vayunmathur/launcher/MainActivity.kt
33- com/vayunmathur/launcher/Navigation.kt
34- com/vayunmathur/launcher/Route.kt
35### data/ — encrypted layout store
36- com/vayunmathur/launcher/data/LauncherDatabase.kt
37- com/vayunmathur/launcher/data/LauncherRepository.kt
38- com/vayunmathur/launcher/data/LauncherItemEntity.kt
39### domain/ — pure grid math (no Android/Compose)
40- com/vayunmathur/launcher/domain/ReconcileUseCase.kt
41- com/vayunmathur/launcher/domain/GridPlacer.kt
42- com/vayunmathur/launcher/domain/GridReorder.kt
43- com/vayunmathur/launcher/domain/CellOccupancy.kt
44- com/vayunmathur/launcher/domain/CellRect.kt
45- com/vayunmathur/launcher/domain/ContainerRef.kt
46- com/vayunmathur/launcher/domain/AutoPlacer.kt
47- com/vayunmathur/launcher/domain/DropBarTargets.kt
48- com/vayunmathur/launcher/domain/FolderMerge.kt
49- com/vayunmathur/launcher/domain/FolderRules.kt
50- com/vayunmathur/launcher/domain/GridPreview.kt
51- com/vayunmathur/launcher/domain/HotseatArrange.kt
52- com/vayunmathur/launcher/domain/LauncherItemType.kt
53- com/vayunmathur/launcher/domain/LauncherTuning.kt
54- com/vayunmathur/launcher/domain/PageCount.kt
55- com/vayunmathur/launcher/domain/ReorderDwell.kt
56- com/vayunmathur/launcher/domain/FastScroll.kt
57- com/vayunmathur/launcher/domain/WidgetResize.kt
58### platform/ — ViewModel, monitor, widgets, bridge
59- com/vayunmathur/launcher/platform/LauncherViewModel.kt
60- com/vayunmathur/launcher/platform/LauncherUiContract.kt
61- com/vayunmathur/launcher/platform/LauncherAppsMonitor.kt
62- com/vayunmathur/launcher/platform/LauncherPredictions.kt
63- com/vayunmathur/launcher/platform/LauncherWidgetHost.kt
64- com/vayunmathur/launcher/platform/LauncherWidgets.kt
65- com/vayunmathur/launcher/platform/IconCache.kt
66- com/vayunmathur/launcher/platform/ActivityBridge.kt
67- com/vayunmathur/launcher/platform/LauncherPrivilege.kt
68### tv/ — TV mode (UiMode-routed, DataStore order, no Room/widgets)
69- com/vayunmathur/launcher/tv/TvRoute.kt
70- com/vayunmathur/launcher/tv/TvNavigation.kt
71- com/vayunmathur/launcher/tv/data/TvPrefs.kt
72- com/vayunmathur/launcher/tv/domain/TvRowOrder.kt
73- com/vayunmathur/launcher/tv/platform/TvHomeViewModel.kt
74- com/vayunmathur/launcher/tv/platform/TvUiContract.kt
75- com/vayunmathur/launcher/tv/platform/TvApps.kt
76- com/vayunmathur/launcher/tv/platform/TvInputs.kt
77- com/vayunmathur/launcher/tv/platform/TvHomeRole.kt
78- com/vayunmathur/launcher/tv/platform/TvArtCache.kt
79- com/vayunmathur/launcher/tv/ui/TvHomeScreen.kt
80- com/vayunmathur/launcher/tv/ui/TvHomePage.kt
81- com/vayunmathur/launcher/tv/ui/TvClockHeader.kt
82- com/vayunmathur/launcher/tv/ui/TvAppGrid.kt
83- com/vayunmathur/launcher/tv/ui/TvBottomRow.kt
84- com/vayunmathur/launcher/tv/ui/TvEditMenu.kt
85- com/vayunmathur/launcher/tv/ui/components/TvBannerTile.kt
86- com/vayunmathur/launcher/tv/ui/components/TvReorderHint.kt
87### ui/ + ui/components/ — workspace, drawer, drag system
88- com/vayunmathur/launcher/ui/HomeWorkspace.kt
89- com/vayunmathur/launcher/ui/HomePage.kt
90- com/vayunmathur/launcher/ui/HomeContent.kt
91- com/vayunmathur/launcher/ui/WorkspacePage.kt
92- com/vayunmathur/launcher/ui/WorkspaceGrid.kt
93- com/vayunmathur/launcher/ui/HomeGestureRoot.kt
94- com/vayunmathur/launcher/ui/HomeDropLogic.kt
95- com/vayunmathur/launcher/ui/HomeLaunch.kt
96- com/vayunmathur/launcher/ui/HomeEffects.kt
97- com/vayunmathur/launcher/ui/HomeOverlays.kt
98- com/vayunmathur/launcher/ui/HomePopups.kt
99- com/vayunmathur/launcher/ui/HomeConstants.kt
100- com/vayunmathur/launcher/ui/HomeDrawerSwipe.kt
101- com/vayunmathur/launcher/ui/WorkspaceOptionsContent.kt
102- com/vayunmathur/launcher/ui/HotseatBar.kt
103- com/vayunmathur/launcher/ui/FolderContent.kt
104- com/vayunmathur/launcher/ui/DrawerContent.kt
105- com/vayunmathur/launcher/ui/DrawerCells.kt
106- com/vayunmathur/launcher/ui/DrawerFastScroll.kt
107- com/vayunmathur/launcher/ui/ItemMenuContent.kt
108- com/vayunmathur/launcher/ui/SettingsPage.kt
109- com/vayunmathur/launcher/ui/SettingsContent.kt
110- com/vayunmathur/launcher/ui/WidgetPickerContent.kt
111- com/vayunmathur/launcher/ui/components/LauncherDragController.kt
112- com/vayunmathur/launcher/ui/components/DragLayer.kt
113- com/vayunmathur/launcher/ui/components/DragFeedback.kt
114- com/vayunmathur/launcher/ui/components/DragSourceModifier.kt
115- com/vayunmathur/launcher/ui/components/DropTargetModifier.kt
116- com/vayunmathur/launcher/ui/components/DropBar.kt
117- com/vayunmathur/launcher/ui/components/CellLayout.kt
118- com/vayunmathur/launcher/ui/components/CellPlacement.kt
119- com/vayunmathur/launcher/ui/components/LauncherDragInput.kt
120- com/vayunmathur/launcher/ui/components/LauncherDragInputSection.kt
121- com/vayunmathur/launcher/ui/components/LauncherAppIcon.kt
122- com/vayunmathur/launcher/ui/components/LauncherItemIcon.kt
123- com/vayunmathur/launcher/ui/components/LauncherPopup.kt
124- com/vayunmathur/launcher/ui/components/LauncherPopupSurface.kt
125- com/vayunmathur/launcher/ui/components/MergeRing.kt
126- com/vayunmathur/launcher/ui/components/ReorderPreview.kt
127- com/vayunmathur/launcher/ui/components/PageIndicator.kt
128- com/vayunmathur/launcher/ui/components/PageEdgeDwell.kt
129- com/vayunmathur/launcher/ui/components/FastScrollStrip.kt
130- com/vayunmathur/launcher/ui/components/HostedWidget.kt
131- com/vayunmathur/launcher/ui/components/MissingWidget.kt
132- com/vayunmathur/launcher/ui/components/WidgetResizeFrame.kt
133- com/vayunmathur/launcher/ui/components/AppWindowBounds.kt
134
135## Verify (this module only)
136```
137./gradlew :launcher:compileDevKotlin
138./gradlew :launcher:lint
139./gradlew :launcher:checkMetadata
140```