File tree Expand file tree Collapse file tree
app/src/main/java/eu/faircode/netguard Expand file tree Collapse file tree Original file line number Diff line number Diff line change 104104import java .util .HashSet ;
105105import java .util .List ;
106106import java .util .Map ;
107+ import java .util .Objects ;
107108import java .util .Set ;
108109import java .util .TreeMap ;
109110import java .util .concurrent .ExecutorService ;
@@ -3245,6 +3246,7 @@ private void removeWarningNotifications() {
32453246 }
32463247
32473248 private class Builder extends VpnService .Builder {
3249+ private Network activeNetwork ;
32483250 private NetworkInfo networkInfo ;
32493251 private int mtu ;
32503252 private List <String > listAddress = new ArrayList <>();
@@ -3256,6 +3258,7 @@ private class Builder extends VpnService.Builder {
32563258 private Builder () {
32573259 super ();
32583260 ConnectivityManager cm = (ConnectivityManager ) getSystemService (Context .CONNECTIVITY_SERVICE );
3261+ activeNetwork = (Build .VERSION .SDK_INT < Build .VERSION_CODES .M ? null : cm .getActiveNetwork ());
32593262 networkInfo = cm .getActiveNetworkInfo ();
32603263 }
32613264
@@ -3314,6 +3317,9 @@ public boolean equals(Object obj) {
33143317 if (other == null )
33153318 return false ;
33163319
3320+ if (!Objects .equals (this .activeNetwork , other .activeNetwork ))
3321+ return false ;
3322+
33173323 if (this .networkInfo == null || other .networkInfo == null ||
33183324 this .networkInfo .getType () != other .networkInfo .getType ())
33193325 return false ;
You can’t perform that action at this time.
0 commit comments