From d786249594a650d2e31a1abae8248e53e85c6971 Mon Sep 17 00:00:00 2001 From: M66B Date: Sun, 3 Dec 2023 17:53:59 +0100 Subject: [PATCH] Revert "Simplification" This reverts commit 2861b11661e00bcea7f48d1f2053293fac590d55. --- app/src/main/java/eu/faircode/netguard/Util.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/eu/faircode/netguard/Util.java b/app/src/main/java/eu/faircode/netguard/Util.java index 865a6636..40b1dc71 100644 --- a/app/src/main/java/eu/faircode/netguard/Util.java +++ b/app/src/main/java/eu/faircode/netguard/Util.java @@ -38,7 +38,6 @@ import android.graphics.BitmapFactory; import android.net.ConnectivityManager; import android.net.LinkProperties; import android.net.Network; -import android.net.NetworkCapabilities; import android.net.NetworkInfo; import android.net.wifi.WifiManager; import android.os.Build; @@ -166,6 +165,16 @@ public class Util { if (ni != null && ni.isConnected()) return true; + Network[] networks = cm.getAllNetworks(); + if (networks == null) + return false; + + for (Network network : networks) { + ni = cm.getNetworkInfo(network); + if (ni != null && ni.getType() != ConnectivityManager.TYPE_VPN && ni.isConnected()) + return true; + } + return false; }