1
0
Fork 0
mirror of https://github.com/M66B/NetGuard.git synced 2025-03-08 21:06:33 +00:00

Prevent loop

This commit is contained in:
M66B 2023-06-11 14:30:58 +02:00
parent db7aaa69b7
commit 5b8939720e

View file

@ -21,6 +21,7 @@ package eu.faircode.netguard;
import android.annotation.TargetApi; import android.annotation.TargetApi;
import android.app.AlarmManager; import android.app.AlarmManager;
import android.app.ForegroundServiceStartNotAllowedException;
import android.app.Notification; import android.app.Notification;
import android.app.NotificationManager; import android.app.NotificationManager;
import android.app.PendingIntent; import android.app.PendingIntent;
@ -3296,7 +3297,8 @@ public class ServiceSinkhole extends VpnService implements SharedPreferences.OnS
try { try {
ContextCompat.startForegroundService(context, intent); ContextCompat.startForegroundService(context, intent);
} catch (Throwable ex) { } catch (Throwable ex) {
// ForegroundServiceStartNotAllowedException if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S &&
ex instanceof ForegroundServiceStartNotAllowedException)
try { try {
context.startService(intent); context.startService(intent);
} catch (Throwable exex) { } catch (Throwable exex) {
@ -3312,7 +3314,8 @@ public class ServiceSinkhole extends VpnService implements SharedPreferences.OnS
try { try {
ContextCompat.startForegroundService(context, intent); ContextCompat.startForegroundService(context, intent);
} catch (Throwable ex) { } catch (Throwable ex) {
// ForegroundServiceStartNotAllowedException if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S &&
ex instanceof ForegroundServiceStartNotAllowedException)
try { try {
context.startService(intent); context.startService(intent);
} catch (Throwable exex) { } catch (Throwable exex) {
@ -3331,7 +3334,8 @@ public class ServiceSinkhole extends VpnService implements SharedPreferences.OnS
try { try {
ContextCompat.startForegroundService(context, intent); ContextCompat.startForegroundService(context, intent);
} catch (Throwable ex) { } catch (Throwable ex) {
// ForegroundServiceStartNotAllowedException if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S &&
ex instanceof ForegroundServiceStartNotAllowedException)
try { try {
context.startService(intent); context.startService(intent);
} catch (Throwable exex) { } catch (Throwable exex) {
@ -3349,7 +3353,8 @@ public class ServiceSinkhole extends VpnService implements SharedPreferences.OnS
try { try {
ContextCompat.startForegroundService(context, intent); ContextCompat.startForegroundService(context, intent);
} catch (Throwable ex) { } catch (Throwable ex) {
// ForegroundServiceStartNotAllowedException if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S &&
ex instanceof ForegroundServiceStartNotAllowedException)
try { try {
context.startService(intent); context.startService(intent);
} catch (Throwable exex) { } catch (Throwable exex) {
@ -3365,7 +3370,8 @@ public class ServiceSinkhole extends VpnService implements SharedPreferences.OnS
try { try {
ContextCompat.startForegroundService(context, intent); ContextCompat.startForegroundService(context, intent);
} catch (Throwable ex) { } catch (Throwable ex) {
// ForegroundServiceStartNotAllowedException if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S &&
ex instanceof ForegroundServiceStartNotAllowedException)
try { try {
context.startService(intent); context.startService(intent);
} catch (Throwable exex) { } catch (Throwable exex) {