rouse-context/work
monkopedia-coder 4b2ec2fd68
Stop FGS gracefully on dataSync run-time timeout (#450) (#452)
Android 15+ enforces a cumulative ~6h/24h limit on dataSync foreground
services. When the budget is exhausted while the service is running, the
system calls Service.onTimeout() and requires a prompt stop; otherwise it
force-kills the process with ForegroundServiceDidNotStopInTimeException
(#450, #451).

TunnelForegroundService handled the symmetric start-time case
(ForegroundServiceStartNotAllowedException -> notify + stopSelf) but never
overrode onTimeout, so a budget that ran out mid-session crashed silently.
v1.0.2's keep-Ktor-alive-across-idle change made the service stay
foregrounded longer, accelerating accumulation toward the cap.

Override onTimeout to mirror the start-time path: suppress reconnect, post
the existing FgsLimitNotifier, and stopSelf. Add a Robolectric test
(@Config sdk=35) covering the handler, and a docs/ux-decisions.md entry for
the new lifecycle moment at which the budget notification can appear.

Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-26 16:13:24 -04:00
..
src Stop FGS gracefully on dataSync run-time timeout (#450) (#452) 2026-05-26 16:13:24 -04:00
build.gradle.kts Fix #233: Wire up Firebase Crashlytics for release builds (#261) 2026-04-18 21:46:22 -04:00