Commit graph

7 commits

Author SHA1 Message Date
Jason Monk
a2be40e67f Replace fully qualified names with imports across production code
Audit of production Kotlin sources for inline `java.*`, `kotlinx.*`,
`io.ktor.*`, and `android.*` FQNs. Replaced with proper imports in:

- core/mcp: McpRouting.kt (RoutingCall, JsonArray, JsonElement,
  JsonPrimitive, URI, UUID), AuthorizationCodeManager.kt (URI, UUID),
  McpSession.kt (EmbeddedServer)
- outreach: OutreachMcpProvider.kt (JsonArray, PackageManager)
- usage: UsageMcpProvider.kt (JsonArray)
- work: IdleTimeoutManager.kt (StateFlow)
- app: AppModule.kt (Context, PowerManager), MainActivity.kt (Color),
  RouseContextApp.kt (Color), AppNavigation.kt (Uri),
  FileCertificateStore.kt (Base64), MtlsWebSocketFactory.kt (Base64)

No behavior change. ktlintFormat applied.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-14 15:56:28 -04:00
Jason Monk
304e40a8d7 Fix #18: Update Gradle wrapper and dependencies to latest stable
- Gradle: 8.12 -> 8.14
- AGP: 8.10.0 -> 8.13.2
- Compose BOM: 2025.02.00 -> 2026.03.00
- Firebase BOM: 33.10.0 -> 34.12.0 (migrate -ktx to main modules)
- Ktor: 3.1.3 -> 3.4.1
- Activity/Activity-Compose: 1.10.1 -> 1.12.4
- Lifecycle: 2.9.0 -> 2.10.0
- Navigation Compose: 2.8.9 -> 2.9.6
- Room: 2.7.1 -> 2.8.4
- WorkManager: 2.10.0 -> 2.11.2
- Koin: 4.0.0 -> 4.1.1
- DataStore: 1.1.1 -> 1.2.1
- OkHttp: 4.12.0 -> 5.3.0
- kotlinx-serialization-json: 1.9.0 -> 1.11.0
- kotlinx-io: 0.7.0 -> 0.9.0
- Health Connect: 1.1.0-alpha12 -> 1.1.0 (stable)
- Roborazzi: 1.36.0 -> 1.58.0
- Robolectric: 4.14.1 -> 4.16.1
- MockK: 1.13.16 -> 1.14.9
- JUnit Jupiter: 5.11.4 -> 5.13.4
- ktlint plugin: 12.2.0 -> 14.2.0
- detekt: 1.23.7 -> 1.23.8
- Splashscreen: 1.0.1 -> 1.2.0
- AppCompat: 1.7.0 -> 1.7.1
- Acme4j: 3.5.0 -> 3.5.1
- Google Services: 4.4.2 -> 4.4.4
- compileSdk: 35 -> 36

Also runs ktlintFormat to fix new class-signature rule violations.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-11 17:36:46 -04:00
Jason Monk
dc5c2097f5 Fix #21, #44, #36: Usage events quality, cooldown text, notification history
#21 Usage events quality:
- Replace event type when-expression with comprehensive lookup table
  covering all 30 documented UsageEvents constants (was showing "unknown(11)")
- Format timestamps as ISO-8601 instead of raw epoch millis
- Filter out com.rousecontext and Android system intelligence packages
  by default; add include_system parameter to opt back in

#44 Generate new address cooldown text:
- Change misleading "(once per 30 days)" to "Changes take effect immediately"
  since secret rotation has no cooldown

#36 Notification history empty:
- Seed active notifications into Room when NotificationCaptureService
  first connects via onListenerConnected, so pre-existing notifications
  appear in history queries

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-10 14:05:22 -04:00
Jason Monk
269e2a268c Fix usage tools returning duplicate entries per package
UsageStatsManager returns multiple UsageStats entries per package for
different internal time buckets. All usage tools (summary, per-app,
compare) now merge entries by package name, summing foreground time
before returning results. The daily breakdown in get_app_usage also
merges by date to avoid duplicate day entries.

Adds a test verifying deduplication produces one entry per package
with correctly summed time.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-10 13:14:55 -04:00
Jason Monk
3ce208e232 Lower minSdk from 29 to 24 to support ~98% of active Android devices
- Enable core library desugaring for java.time and java.util.Base64 usage
  in app, core:mcp, health, and notifications modules
- Guard NotificationChannel creation (API 26+) in NotificationChannels
  and OutreachMcpProvider
- Guard FOREGROUND_SERVICE_TYPE_DATA_SYNC (API 29+) in
  TunnelForegroundService, fall back to type-less startForeground
- Use ContextCompat.startForegroundService() in FcmReceiver and
  TestWakeReceiver for pre-API-26 compatibility
- Guard Health Connect availability check for API 28+ in
  HealthConnectIntegration
- Add tools:overrideLibrary for Health Connect in health manifest
- Pin Robolectric to SDK 33 in outreach, work, and notifications test
  resources to match app module

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-07 12:15:09 -04:00
Jason Monk
6403c38af6 Upgrade MCP Kotlin SDK to 0.10.0 for protocol version 2025-11-25
Claude's client sends protocolVersion "2025-11-25" in its initialize
request. SDK 0.4.0 only supported 2024-11-05 and fell back to that
version, which modern clients may reject. SDK 0.10.0 advertises
2025-11-25 and negotiates down to 2025-06-18 / 2025-03-26 / 2024-11-05.

Breaking changes from the SDK upgrade:
- Types moved from io.modelcontextprotocol.kotlin.sdk to .sdk.types
- Tool.Input renamed to ToolSchema
- CallToolRequest.arguments moved to CallToolRequest.params.arguments
  (now nullable JsonObject?)
- Transport.send gains TransportSendOptions? parameter
- Server.connect() renamed to Server.createSession()
- addTool/addResource handlers receive ClientConnection receiver

Also bumps Kotlin 2.1.10 -> 2.2.21, AGP 8.8.2 -> 8.10.0, and
KSP 2.1.10-1.0.31 -> 2.2.21-2.0.5 to satisfy SDK metadata version
requirements.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-07 09:58:16 -04:00
Jason Monk
5108f7fee4 Add Usage Stats MCP integration for device usage data
New :usage module exposes UsageStatsManager data as MCP tools:
- get_usage_summary: per-app screen time breakdown for a period
- get_app_usage: detailed single-app usage with daily breakdown
- get_usage_events: raw usage events (app open/close)
- compare_usage: compare two periods, show biggest changes

Wired into app via UsageIntegration with AppOpsManager permission check.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-06 18:08:49 -04:00