From 3211fed0646db057c1a4bc8c3a8ac6583bbf7ca3 Mon Sep 17 00:00:00 2001 From: Arne Schwabe Date: Mon, 22 May 2023 12:50:14 +0200 Subject: Simplify list of allowed AIDL apps to be a simple string --- .../main/java/de/blinkt/openvpn/api/AppRestrictions.java | 12 ++++-------- main/src/main/res/values/untranslatable.xml | 5 +---- main/src/main/res/xml/app_restrictions.xml | 16 ++-------------- 3 files changed, 7 insertions(+), 26 deletions(-) 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 8a5d1c71..06da238e 100644 --- a/main/src/main/java/de/blinkt/openvpn/api/AppRestrictions.java +++ b/main/src/main/java/de/blinkt/openvpn/api/AppRestrictions.java @@ -107,7 +107,7 @@ public class AppRestrictions { } private void setAllowedRemoteControl(Context c, Bundle restrictions) { - Parcelable[] allowedApps = restrictions.getParcelableArray("allowed_remote_access"); + String allowedApps = restrictions.getString("allowed_remote_access", null); ExternalAppDatabase extapps = new ExternalAppDatabase(c); if (allowedApps == null) @@ -118,15 +118,11 @@ public class AppRestrictions { HashSet restrictionApps = new HashSet<>(); - for (Parcelable allowedApp: allowedApps) { - if (!(allowedApp instanceof Bundle)) { - VpnStatus.logError("App restriction allowed app has wrong type"); - continue; + for (String package_name:allowedApps.split("[, \n\r]")) { + if (!TextUtils.isEmpty(package_name)) { + restrictionApps.add(package_name); } - String package_name = ((Bundle) allowedApp).getString("package_name"); - restrictionApps.add(package_name); } - extapps.setFlagManagedConfiguration(true); extapps.clearAllApiApps(); diff --git a/main/src/main/res/values/untranslatable.xml b/main/src/main/res/values/untranslatable.xml index 9da7f522..6b3c1f70 100644 --- a/main/src/main/res/values/untranslatable.xml +++ b/main/src/main/res/values/untranslatable.xml @@ -85,10 +85,7 @@ Failed to negotiate cipher with server URL Pause VPN when screen is off and less than 64 kB transferred data in 60s - List of apps that are allowed to use the remote AIDL. If this list is in the restrictions, the app will not allowe any changes to the list by the user. - Package name of the allow app (e.g. de.blinkt.openvpn.remoteapp) - Package - Allowed remote access app + 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 55bc6888..b3258b50 100644 --- a/main/src/main/res/xml/app_restrictions.xml +++ b/main/src/main/res/xml/app_restrictions.xml @@ -75,18 +75,6 @@ - - - - - + android:restrictionType="string" + android:title="@string/apprest_remoteaidl" /> \ No newline at end of file -- cgit v1.2.3