Extra network type from JellyBean MR1

Refs #243
This commit is contained in:
M66B 2016-01-31 14:19:29 +01:00
parent 487e8edd13
commit e4f56f2d75
1 changed files with 5 additions and 3 deletions

View File

@ -1167,9 +1167,11 @@ public class SinkholeService extends VpnService implements SharedPreferences.OnS
@Override
public void onReceive(Context context, Intent intent) {
// Filter VPN connectivity changes
int networkType = intent.getIntExtra(ConnectivityManager.EXTRA_NETWORK_TYPE, ConnectivityManager.TYPE_DUMMY);
if (networkType == ConnectivityManager.TYPE_VPN)
return;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
int networkType = intent.getIntExtra(ConnectivityManager.EXTRA_NETWORK_TYPE, ConnectivityManager.TYPE_DUMMY);
if (networkType == ConnectivityManager.TYPE_VPN)
return;
}
// Reload rules
Log.i(TAG, "Received " + intent);