From 58b0c6aa1a8a58e0f2dabacefd4f2fd25090f87c Mon Sep 17 00:00:00 2001 From: M66B Date: Sat, 28 Nov 2020 15:17:19 +0100 Subject: [PATCH] Revert "Revert "Workaround suspended VPNs"" This reverts commit 217eb460186e865a5e3c97652093e78fd47bc58c. --- app/src/main/java/eu/faircode/email/ConnectionHelper.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/eu/faircode/email/ConnectionHelper.java b/app/src/main/java/eu/faircode/email/ConnectionHelper.java index 4ebd039308..a1e0508914 100644 --- a/app/src/main/java/eu/faircode/email/ConnectionHelper.java +++ b/app/src/main/java/eu/faircode/email/ConnectionHelper.java @@ -234,8 +234,11 @@ public class ConnectionHelper { // onLost [... state: DISCONNECTED/DISCONNECTED ... available: true] NetworkInfo ani = cm.getNetworkInfo(active); if (ani == null || ani.getState() != NetworkInfo.State.CONNECTED) { - Log.i("isMetered: no active info ani=" + ani); - return null; + Log.i("isMetered: no/connected active info ani=" + ani); + if (ani == null || + ani.getState() != NetworkInfo.State.SUSPENDED || + ani.getType() != ConnectivityManager.TYPE_VPN) + return null; } NetworkCapabilities caps = cm.getNetworkCapabilities(active);