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
1 changed files with 8 additions and 1 deletions

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);
}