From d73ff892bd4966d51a78f8d3835f7999e61de6b3 Mon Sep 17 00:00:00 2001 From: Arne Schwabe Date: Mon, 5 Jun 2023 13:21:01 +0200 Subject: Rename Onboot to always active Also try to keep that connection always active --- main/src/ui/java/de/blinkt/openvpn/fragments/GeneralSettings.kt | 6 ++++-- main/src/ui/java/de/blinkt/openvpn/fragments/SendDumpFragment.java | 7 ++++++- 2 files changed, 10 insertions(+), 3 deletions(-) (limited to 'main/src/ui/java/de') diff --git a/main/src/ui/java/de/blinkt/openvpn/fragments/GeneralSettings.kt b/main/src/ui/java/de/blinkt/openvpn/fragments/GeneralSettings.kt index 3c878d4d..6ba7c6fd 100644 --- a/main/src/ui/java/de/blinkt/openvpn/fragments/GeneralSettings.kt +++ b/main/src/ui/java/de/blinkt/openvpn/fragments/GeneralSettings.kt @@ -73,8 +73,10 @@ class GeneralSettings : PreferenceFragmentCompat(), Preference.OnPreferenceClick findPreference("restartvpnonboot") as CheckBoxPreference if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) { - val vpn:VpnService = VpnService() - startOnBoot.isChecked = vpn.isAlwaysOn + val vpn = VpnService() + if (vpn.isAlwaysOn) + /* This is not reliable when the VPN is not active */ + startOnBoot.isChecked } startOnBoot.onPreferenceChangeListener = diff --git a/main/src/ui/java/de/blinkt/openvpn/fragments/SendDumpFragment.java b/main/src/ui/java/de/blinkt/openvpn/fragments/SendDumpFragment.java index 6d4d2968..ae90f3d5 100644 --- a/main/src/ui/java/de/blinkt/openvpn/fragments/SendDumpFragment.java +++ b/main/src/ui/java/de/blinkt/openvpn/fragments/SendDumpFragment.java @@ -36,7 +36,12 @@ public class SendDumpFragment extends Fragment { if (c.getCacheDir() == null) return null; - for (File f : c.getCacheDir().listFiles()) { + File[] filesList = c.getCacheDir().listFiles(); + + if (filesList == null) + return null; + + for (File f : filesList) { if (!f.getName().endsWith(".dmp")) continue; -- cgit v1.2.3