To make issues more manageable, I would appreciate it if you fill out the following details as applicable:
General information
Android Version
irrelevant
Android Vendor/Custom ROM
irrelevant
Device
irrelevant
Version of the app (version number/play store version/self-built)
0.7.51
Description of the issue
I'd suggest a minor enhancement to allow setting the option "allow vpn bypass" when importing a profile using the AIDL-interface.
I already have tried it with following patch
Subject: [PATCH] add api-function addNewVPNProfileWithExtras()
---
Index: main/src/main/aidl/de/blinkt/openvpn/api/IOpenVPNAPIService.aidl
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/main/src/main/aidl/de/blinkt/openvpn/api/IOpenVPNAPIService.aidl b/main/src/main/aidl/de/blinkt/openvpn/api/IOpenVPNAPIService.aidl
--- a/main/src/main/aidl/de/blinkt/openvpn/api/IOpenVPNAPIService.aidl (revision 4473ad1f1bc49c166fb8ab92ee7a7b91c608135e)
+++ b/main/src/main/aidl/de/blinkt/openvpn/api/IOpenVPNAPIService.aidl (date 1720018856664)
@@ -67,4 +67,10 @@
/** Same as startVPN(String), but also takes a Bundle with extra parameters,
* which will be applied to the created VPNProfile (e.g. allow vpn bypass). */
void startVPNwithExtras(in String inlineconfig, in Bundle extras);
+
+ /** Same as addNewVPNProfile(String, boolean, String) but giving possibility to pass a Bundle like
+ * in startVPNwithExtras(String, Bundle) to apply e.g. "allow vpn bypass" to profile.
+ * up to now the only extra that can be put is a boolean "de.blinkt.openvpn.api.ALLOW_VPN_BYPASS"
+ */
+ APIVpnProfile addNewVPNProfileWithExtras (String name, boolean userEditable, String config, in Bundle extras);
}
\ No newline at end of file
Index: main/src/main/java/de/blinkt/openvpn/api/ExternalOpenVPNService.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/main/src/main/java/de/blinkt/openvpn/api/ExternalOpenVPNService.java b/main/src/main/java/de/blinkt/openvpn/api/ExternalOpenVPNService.java
--- a/main/src/main/java/de/blinkt/openvpn/api/ExternalOpenVPNService.java (revision 4473ad1f1bc49c166fb8ab92ee7a7b91c608135e)
+++ b/main/src/main/java/de/blinkt/openvpn/api/ExternalOpenVPNService.java (date 1720018897380)
@@ -151,6 +151,13 @@
}
+ private void updateProfileFromExtras(Bundle extras, VpnProfile vp) {
+ if (extras != null) {
+ vp.mAllowAppVpnBypass = extras.getBoolean(EXTRA_INLINE_PROFILE_ALLOW_VPN_BYPASS, false);
+ VpnStatus.logDebug("got extra " + EXTRA_INLINE_PROFILE_ALLOW_VPN_BYPASS + ", mAllowAppVpnBypass=" + vp.mAllowAppVpnBypass);
+ }
+ }
+
@Override
public void startProfile(String profileUUID) throws RemoteException {
mExtAppDb.checkOpenVPNPermission(getPackageManager());
@@ -176,9 +183,7 @@
vp.mProfileCreator = callingApp;
- if (extras != null) {
- vp.mAllowAppVpnBypass = extras.getBoolean(EXTRA_INLINE_PROFILE_ALLOW_VPN_BYPASS, false);
- }
+ updateProfileFromExtras(extras, vp);
/*int needpw = vp.needUserPWInput(false);
if(needpw !=0)
@@ -207,6 +212,11 @@
@Override
public APIVpnProfile addNewVPNProfile(String name, boolean userEditable, String config) throws RemoteException {
+ return addNewVPNProfileWithExtras(name, userEditable, config, null);
+ }
+
+ @Override
+ public APIVpnProfile addNewVPNProfileWithExtras(String name, boolean userEditable, String config, Bundle extras) throws RemoteException {
String callingPackage = mExtAppDb.checkOpenVPNPermission(getPackageManager());
ConfigParser cp = new ConfigParser();
@@ -216,6 +226,7 @@
vp.mName = name;
vp.mProfileCreator = callingPackage;
vp.mUserEditable = userEditable;
+ updateProfileFromExtras(extras, vp);
ProfileManager pm = ProfileManager.getInstance(getBaseContext());
pm.addProfile(vp);
pm.saveProfile(ExternalOpenVPNService.this, vp);
To make issues more manageable, I would appreciate it if you fill out the following details as applicable:
General information
Description of the issue
I'd suggest a minor enhancement to allow setting the option "allow vpn bypass" when importing a profile using the AIDL-interface. I already have tried it with following patch
I could also provide an according PR if desired.