1
0
Fork 0
mirror of https://github.com/M66B/NetGuard.git synced 2024-12-27 02:09:41 +00:00

Rebuild on legacy restart

This commit is contained in:
M66B 2016-02-29 13:51:46 +01:00
parent 8498ed58e3
commit 4e7eb2674c

View file

@ -408,10 +408,13 @@ public class SinkholeService extends VpnService implements SharedPreferences.OnS
List<Rule> listRule = Rule.getRules(true, SinkholeService.this);
List<Rule> listAllowed = getAllowedRules(listRule);
SinkholeService.Builder builder = getBuilder(listAllowed, listRule);
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP_MR1) {
last_builder = builder;
Log.i(TAG, "Legacy restart");
if (vpn != null) {
Log.i(TAG, "Legacy restart");
stopNative(vpn, false);
stopVPN(vpn);
vpn = null;
@ -420,11 +423,9 @@ public class SinkholeService extends VpnService implements SharedPreferences.OnS
} catch (InterruptedException ignored) {
}
}
last_builder = getBuilder(listAllowed, listRule);
vpn = startVPN(last_builder);
} else {
SinkholeService.Builder builder = getBuilder(listAllowed, listRule);
if (prefs.getBoolean("filter", false) && builder.equals(last_builder)) {
Log.i(TAG, "Native restart");
stopNative(vpn, false);