update + Fix
This commit is contained in:
Binary file not shown.
@@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user