mirror of
https://github.com/d4rken-org/capod.git
synced 2026-09-16 11:16:12 -04:00
fix: Catch Hilt DI failure in MonitorService.onCreate()
Wrap super.onCreate() (Hilt injection) in try-catch to prevent DI failures from crashing the process. The service is already foreground at this point, so a graceful stopSelf() satisfies the FGS timeout requirement without killing the app.
This commit is contained in:
@@ -114,7 +114,15 @@ class MonitorService : Service() {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
super.onCreate()
|
try {
|
||||||
|
super.onCreate()
|
||||||
|
} catch (e: Exception) {
|
||||||
|
log(TAG, WARN) { "Hilt DI failed in onCreate(), stopping service: ${e.asLog()}" }
|
||||||
|
Bugs.report(tag = TAG, "Hilt DI failed in onCreate()", exception = e)
|
||||||
|
foregroundStartFailed = true
|
||||||
|
stopSelf()
|
||||||
|
return
|
||||||
|
}
|
||||||
log(TAG, VERBOSE) { "onCreate()" }
|
log(TAG, VERBOSE) { "onCreate()" }
|
||||||
|
|
||||||
// Replace early notification with the full one from injected MonitorNotifications.
|
// Replace early notification with the full one from injected MonitorNotifications.
|
||||||
|
|||||||
Reference in New Issue
Block a user