Reload on link properties changed on Android O only

This commit is contained in:
M66B 2017-08-08 18:05:47 +02:00
parent dd7d7a55ef
commit 76e94aa3e6
1 changed files with 4 additions and 3 deletions

View File

@ -2196,7 +2196,7 @@ public class ServiceSinkhole extends VpnService implements SharedPreferences.OnS
registerReceiver(packageChangedReceiver, ifPackage);
registeredPackageChanged = true;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O)
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP)
listenNetworkChanges();
else
listenConnectivityChanges();
@ -2232,7 +2232,8 @@ public class ServiceSinkhole extends VpnService implements SharedPreferences.OnS
@Override
public void onLinkPropertiesChanged(Network network, LinkProperties linkProperties) {
reload("link properties changed", ServiceSinkhole.this, false);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O)
reload("link properties changed", ServiceSinkhole.this, false);
}
@Override
@ -2414,7 +2415,7 @@ public class ServiceSinkhole extends VpnService implements SharedPreferences.OnS
registeredPackageChanged = false;
}
if (networkCallback != null && Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
if (networkCallback != null) {
unlistenNetworkChanges();
networkCallback = null;
}