Modern-Apps.git
Publicgit clone https://git.maproj.org/Modern-Apps.gitModern-Apps.git / screentime / AGENTS.md
| 1 | # AGENTS.md — screentime/ (':screentime') |
| 2 | |
| 3 | > Scoped supplement. Global rules in root `AGENTS.md` apply. Stay inside `screentime/` + allowed shared modules. Do not root-scan. |
| 4 | |
| 5 | _Install: ./install screentime (dev by default)._ |
| 6 | - Gradle: :screentime / dir: screentime/ |
| 7 | - Package roots present: ui, data, domain, platform, service, widget, notifications, intents |
| 8 | - Entry files: MainActivity.kt + Route.kt + Navigation.kt (single host; FrictionActivity stays a system-triggered activity) |
| 9 | - Deps: :library:room, :library:widgets |
| 10 | - Metadata: metadata_data/screentime.md (present) |
| 11 | - Rust: no / screenshotTest: no |
| 12 | |
| 13 | ## Overview |
| 14 | **Purpose:** On-device screen-time dashboard — per-app usage, app timers + instant pauses, Wind Down (grayscale + DND), friction nudges, Glance widget. Sibling of `parentalcontrols/` (self-control vs supervised control). No account, nothing uploaded. |
| 15 | **Key features:** `platform/UsageHistory` + `domain/HourBuckets` feed dashboard/charts; `AppTimers`/`Suspender`/`Coordinator` enforce limits; `WindDownApplier` + `WindowScheduler` run bedtime; widget mirrors the dashboard. Assistant read via `intents/GetUsageIntent` (`screentime_get_usage`): aggregates only — today's total + top 5 apps with durations, built by `domain/ScreentimeUsageSummary` from `UsageHistory` per-package totals; no per-event data crosses, and missing usage access returns a typed empty summary. |
| 16 | **Entry points:** `MainActivity.kt` → `Navigation.kt` (`Route.Dashboard/AppDetails(packageName)/WindDown`) → `ui/DashboardScreen.kt` → `platform/ScreenTimeViewModel.kt` → `platform/Coordinator.kt` → `data/Rules.kt`. |
| 17 | **Gotchas:** |
| 18 | - `receiver/` is NOT a closed package root — don't add more files there |
| 19 | - Usage access is a special grant — behavior without it is an empty dashboard, not an error; handle gracefully |
| 20 | - Screenshot tests are off (`screenshotTest: no`) — verify timers/pause flows on device |
| 21 | |
| 22 | ## Key files |
| 23 | ### data/ + domain/ — rules + buckets |
| 24 | - com/vayunmathur/screentime/data/ScreenTimeDatabase.kt |
| 25 | - com/vayunmathur/screentime/data/Rules.kt |
| 26 | - com/vayunmathur/screentime/data/Migrations.kt |
| 27 | - com/vayunmathur/screentime/domain/HourBuckets.kt |
| 28 | - com/vayunmathur/screentime/domain/ScreentimeUsageSummary.kt — aggregates-only assistant summary (today's total + top 5 apps, capped/truncated) |
| 29 | ### intents/ — assistant IPC |
| 30 | - com/vayunmathur/screentime/intents/GetUsageIntent.kt — validated `screentime_get_usage` contract (signature-guarded, NoDisplay) |
| 31 | ### platform/ — coordination + enforcement |
| 32 | - com/vayunmathur/screentime/platform/Coordinator.kt |
| 33 | - com/vayunmathur/screentime/platform/ScreenTimeViewModel.kt |
| 34 | - com/vayunmathur/screentime/platform/AppTimers.kt |
| 35 | - com/vayunmathur/screentime/platform/Suspender.kt |
| 36 | - com/vayunmathur/screentime/platform/UsageAccess.kt |
| 37 | - com/vayunmathur/screentime/platform/UsageHistory.kt |
| 38 | - com/vayunmathur/screentime/platform/WindDownApplier.kt |
| 39 | - com/vayunmathur/screentime/platform/WindowScheduler.kt |
| 40 | - com/vayunmathur/screentime/platform/DndState.kt |
| 41 | ### receiver/ + service/ — system bridges |
| 42 | - com/vayunmathur/screentime/receiver/Receivers.kt |
| 43 | - com/vayunmathur/screentime/service/Services.kt |
| 44 | ### ui/ + widget/ — dashboard + widget (the entries) |
| 45 | - com/vayunmathur/screentime/MainActivity.kt |
| 46 | - com/vayunmathur/screentime/Route.kt |
| 47 | - com/vayunmathur/screentime/Navigation.kt |
| 48 | - com/vayunmathur/screentime/ui/DashboardScreen.kt |
| 49 | - com/vayunmathur/screentime/ui/AppDetailsScreen.kt |
| 50 | - com/vayunmathur/screentime/ui/dialogs/AppTimerPickerDialog.kt — stateless timer picker for the Route.AppTimerPickerDialog destination |
| 51 | - com/vayunmathur/screentime/ui/FocusScreen.kt |
| 52 | - com/vayunmathur/screentime/ui/FrictionScreen.kt |
| 53 | - com/vayunmathur/screentime/ui/WindDownScreen.kt |
| 54 | - com/vayunmathur/screentime/ui/UsageBarChart.kt |
| 55 | - com/vayunmathur/screentime/ui/UsageFormat.kt |
| 56 | - com/vayunmathur/screentime/ui/AppIconImage.kt |
| 57 | - com/vayunmathur/screentime/widget/ScreenTimeGlanceWidget.kt |
| 58 | - com/vayunmathur/screentime/widget/ScreenTimeWidgetReceiver.kt |
| 59 | |
| 60 | ## Verify (this module only) |
| 61 | ``` |
| 62 | ./gradlew :screentime:compileDevKotlin |
| 63 | ./gradlew :screentime:lint |
| 64 | ./gradlew :screentime:checkMetadata |
| 65 | ``` |