mirror of https://github.com/M66B/NetGuard.git
Give service on background time to stop
This commit is contained in:
parent
81b3148ddf
commit
4a0adc143e
|
@ -800,8 +800,15 @@ public class SinkholeService extends VpnService implements SharedPreferences.OnS
|
||||||
|
|
||||||
if (user_foreground) {
|
if (user_foreground) {
|
||||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(SinkholeService.this);
|
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);
|
start("foreground", SinkholeService.this);
|
||||||
|
}
|
||||||
} else
|
} else
|
||||||
stop("background", SinkholeService.this);
|
stop("background", SinkholeService.this);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue