summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArne Schwabe <arne@rfc2549.org>2022-07-22 16:34:16 +0200
committerArne Schwabe <arne@rfc2549.org>2022-07-22 16:35:02 +0200
commit552264611d9ca218a905e3e461df27e3d0f860cd (patch)
treea01b3a88a7a43ae46b1f1930d896ff968e503d42
parentc1d835922541bcbb7ab88a8e3b9a80a3913a351d (diff)
Do not delete any app permission when viewing settings (closes #1469)
-rw-r--r--README.md7
-rw-r--r--main/src/ui/java/de/blinkt/openvpn/fragments/GeneralSettings.kt19
2 files changed, 18 insertions, 8 deletions
diff --git a/README.md b/README.md
index 2a2e2e06..415fc0ca 100644
--- a/README.md
+++ b/README.md
@@ -37,7 +37,12 @@ acitvies to start/stop, pause/resume (like a user would with the notification)
- `de.blinkt.openvpn.api.PauseVPN`
- `de.blinkt.openvpn.api.ResumeVPN`
-They use `de.blinkt.openvpn.api.profileName` as extra for the name of the VPN profile..
+They use `de.blinkt.openvpn.api.profileName` as extra for the name of the VPN profile.
+
+You can use `adb` to to test these intents:
+
+ adb -d shell am start -a android.intent.action.MAIN -n de.blinkt.openvpn/.api.ConnectVPN --es de.blinkt.openvpn.api.profileName myvpnprofile
+
Note to administrators
------------------------
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 0842925d..7db8cba6 100644
--- a/main/src/ui/java/de/blinkt/openvpn/fragments/GeneralSettings.kt
+++ b/main/src/ui/java/de/blinkt/openvpn/fragments/GeneralSettings.kt
@@ -20,6 +20,7 @@ import androidx.preference.*
import de.blinkt.openvpn.BuildConfig
import de.blinkt.openvpn.R
import de.blinkt.openvpn.activities.OpenSSLSpeed
+import de.blinkt.openvpn.api.ConfirmDialog.ANONYMOUS_PACKAGE
import de.blinkt.openvpn.api.ExternalAppDatabase
import de.blinkt.openvpn.core.ProfileManager
import java.io.File
@@ -153,13 +154,17 @@ class GeneralSettings : PreferenceFragmentCompat(), Preference.OnPreferenceClick
val pm = requireActivity().packageManager
val applist = StringBuilder()
for (packagename in mExtapp.extAppList) {
- try {
- app = pm.getApplicationInfo(packagename, 0)
- if (applist.length != 0) applist.append(delim)
- applist.append(app.loadLabel(pm))
- } catch (e: PackageManager.NameNotFoundException) {
- // App not found. Remove it from the list
- mExtapp.removeApp(packagename)
+ if (packagename == ANONYMOUS_PACKAGE) {
+ applist.append("(Any app)")
+ } else {
+ try {
+ app = pm.getApplicationInfo(packagename, 0)
+ if (applist.length != 0) applist.append(delim)
+ applist.append(app.loadLabel(pm))
+ } catch (e: PackageManager.NameNotFoundException) {
+ // App not found. Remove it from the list
+ mExtapp.removeApp(packagename)
+ }
}
}
return applist.toString()