update + Fix

This commit is contained in:
Johnny
2026-07-03 06:58:57 +02:00
parent 485d21344e
commit 68c63958f4
2 changed files with 5 additions and 1 deletions

Binary file not shown.

View File

@@ -33,6 +33,11 @@ class FirewallVpnService : VpnService() {
@Volatile private var running = false
override fun onStartCommand(intent: Intent?, flags: Int, startId: Int): Int {
// Le service est toujours lancé via startForegroundService() (y compris pour ACTION_STOP,
// cf. DataMonitorService.applyVpnMode) : le système impose un appel à startForeground()
// dans les 5 secondes qui suivent, sous peine de crash (ForegroundServiceDidNotStartInTimeException
// sur Android 12+), même si le service s'arrête immédiatement après.
startForeground(NOTIF_ID, buildNotification())
when (intent?.action) {
ACTION_STOP -> {
stopTunnel()
@@ -41,7 +46,6 @@ class FirewallVpnService : VpnService() {
}
ACTION_START_FILTER, ACTION_START_BLOCK_ALL -> {
val allowed = intent.getStringArrayListExtra(EXTRA_ALLOWED_PACKAGES)?.toSet() ?: emptySet()
startForeground(NOTIF_ID, buildNotification())
establishTunnel(allowed)
}
}