summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArne Schwabe <arne@rfc2549.org>2023-05-22 12:50:14 +0200
committerArne Schwabe <arne@rfc2549.org>2023-05-22 12:50:14 +0200
commit3211fed0646db057c1a4bc8c3a8ac6583bbf7ca3 (patch)
treeff592cb958ab1350f753b102a369528602405e87
parenta688889a1e54cee8439f8a61c3162f7913530b37 (diff)
Simplify list of allowed AIDL apps to be a simple string
-rw-r--r--main/src/main/java/de/blinkt/openvpn/api/AppRestrictions.java12
-rw-r--r--main/src/main/res/values/untranslatable.xml5
-rw-r--r--main/src/main/res/xml/app_restrictions.xml16
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<String> 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 @@
<string name="faq_title_ncp">Failed to negotiate cipher with server</string>
<string name="import_from_URL">URL</string>
<string name="restriction_pausevpn">Pause VPN when screen is off and less than 64 kB transferred data in 60s</string>
- <string name="apprest_aidl_list">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.</string>
- <string name="apprest_remoteapi_package">Package name of the allow app (e.g. de.blinkt.openvpn.remoteapp)</string>
- <string name="apprest_remoteapi_package_title">Package</string>
- <string name="apprest_allowed_aidl_app">Allowed remote access app</string>
+ <string name="apprest_aidl_list">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</string>
<string name="apprest_remoteaidl">Remote API access</string>
<string-array name="tls_profile_values" translatable="false">
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 @@
<restriction
android:description="@string/apprest_aidl_list"
android:key="allowed_remote_access"
- android:restrictionType="bundle_array"
- android:title="@string/apprest_remoteaidl">
- <restriction
- android:key="allowed_app"
- android:restrictionType="bundle"
- android:title="@string/apprest_allowed_aidl_app">
- <restriction
- android:description="@string/apprest_remoteapi_package"
- android:key="package_name"
- android:restrictionType="string"
- android:title="@string/apprest_remoteapi_package_title" />
- </restriction>
-
- </restriction>
+ android:restrictionType="string"
+ android:title="@string/apprest_remoteaidl" />
</restrictions> \ No newline at end of file