1
0
Fork 0
mirror of https://github.com/M66B/NetGuard.git synced 2025-01-18 13:46:00 +00:00

Give service on background time to stop

This commit is contained in:
M66B 2016-01-11 18:42:50 +01:00
parent 81b3148ddf
commit 4a0adc143e

View file

@ -800,8 +800,15 @@ public class SinkholeService extends VpnService implements SharedPreferences.OnS
if (user_foreground) {
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(SinkholeService.this);
if (prefs.getBoolean("enabled", false))
if (prefs.getBoolean("enabled", false)) {
// Allow service of background user to stop
try {
Thread.sleep(3000);
} catch (InterruptedException ignored) {
}
start("foreground", SinkholeService.this);
}
} else
stop("background", SinkholeService.this);
}