From 823cb52eff9934d36214af161759580bac589fdf Mon Sep 17 00:00:00 2001 From: Arne Schwabe Date: Sat, 11 Nov 2023 17:02:22 +0100 Subject: Allow setting restart VPN on Boot setting via App restrictions --- main/src/main/java/de/blinkt/openvpn/api/AppRestrictions.java | 8 ++++++++ main/src/main/res/values/untranslatable.xml | 1 + main/src/main/res/xml/app_restrictions.xml | 5 +++++ 3 files changed, 14 insertions(+) (limited to 'main/src') diff --git a/main/src/main/java/de/blinkt/openvpn/api/AppRestrictions.java b/main/src/main/java/de/blinkt/openvpn/api/AppRestrictions.java index 53919216..48fbb2da 100644 --- a/main/src/main/java/de/blinkt/openvpn/api/AppRestrictions.java +++ b/main/src/main/java/de/blinkt/openvpn/api/AppRestrictions.java @@ -147,6 +147,13 @@ public class AppRestrictions { editor.putBoolean("screenoff", pauseVPN); editor.apply(); } + if (restrictions.containsKey("restartvpnonboot")) + { + boolean restartVPNonBoot = restrictions.getBoolean("restartvpnonboot"); + SharedPreferences.Editor editor = defaultPrefs.edit(); + editor.putBoolean("restartvpnonboot", restartVPNonBoot); + editor.apply(); + } } private void importVPNProfiles(Context c, Bundle restrictions, Parcelable[] profileList) { @@ -155,6 +162,7 @@ public class AppRestrictions { String defaultprofile = restrictions.getString("defaultprofile", null); boolean defaultprofileProvisioned = false; + ProfileManager pm = ProfileManager.getInstance(c); for (Parcelable profile : profileList) { if (!(profile instanceof Bundle)) { diff --git a/main/src/main/res/values/untranslatable.xml b/main/src/main/res/values/untranslatable.xml index 6b3c1f70..edafd76e 100644 --- a/main/src/main/res/values/untranslatable.xml +++ b/main/src/main/res/values/untranslatable.xml @@ -85,6 +85,7 @@ Failed to negotiate cipher with server URL Pause VPN when screen is off and less than 64 kB transferred data in 60s + Enable the workaround to use an on boot receiver to start the VPN if the Always On VPN functionality is not available List of apps that are allowed to use the remote AIDL. If this list is in the restrictions, the app will not allowed any changes to the list by the user. Package names of allowed apps separated by comma, space or newlines Remote API access diff --git a/main/src/main/res/xml/app_restrictions.xml b/main/src/main/res/xml/app_restrictions.xml index b3258b50..81171d6f 100644 --- a/main/src/main/res/xml/app_restrictions.xml +++ b/main/src/main/res/xml/app_restrictions.xml @@ -72,6 +72,11 @@ android:key="screenoffpausevpn" android:restrictionType="bool" android:title="@string/restriction_pausevpn" /> + +