summaryrefslogtreecommitdiff
path: root/main/src/main/java/de/blinkt/openvpn/api/ExternalOpenVPNService.java
diff options
context:
space:
mode:
Diffstat (limited to 'main/src/main/java/de/blinkt/openvpn/api/ExternalOpenVPNService.java')
-rw-r--r--main/src/main/java/de/blinkt/openvpn/api/ExternalOpenVPNService.java10
1 files changed, 7 insertions, 3 deletions
diff --git a/main/src/main/java/de/blinkt/openvpn/api/ExternalOpenVPNService.java b/main/src/main/java/de/blinkt/openvpn/api/ExternalOpenVPNService.java
index 690c349e..ab71f00b 100644
--- a/main/src/main/java/de/blinkt/openvpn/api/ExternalOpenVPNService.java
+++ b/main/src/main/java/de/blinkt/openvpn/api/ExternalOpenVPNService.java
@@ -139,16 +139,18 @@ public class ExternalOpenVPNService extends Service implements StateListener {
* Check if we need to ask for username/password */
int neddPassword = vp.needUserPWInput(null, null);
+ String startReason = "external OpenVPN service by uid: " + Binder.getCallingUid();
if(vpnPermissionIntent != null || neddPassword != 0){
Intent shortVPNIntent = new Intent(Intent.ACTION_MAIN);
shortVPNIntent.setClass(getBaseContext(), de.blinkt.openvpn.LaunchVPN.class);
shortVPNIntent.putExtra(de.blinkt.openvpn.LaunchVPN.EXTRA_KEY, vp.getUUIDString());
shortVPNIntent.putExtra(de.blinkt.openvpn.LaunchVPN.EXTRA_HIDELOG, true);
+ shortVPNIntent.putExtra(de.blinkt.openvpn.LaunchVPN.EXTRA_START_REASON, startReason);
shortVPNIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(shortVPNIntent);
} else {
- VPNLaunchHelper.startOpenVpn(vp, getBaseContext());
+ VPNLaunchHelper.startOpenVpn(vp, getBaseContext(), startReason);
}
}
@@ -237,6 +239,8 @@ public class ExternalOpenVPNService extends Service implements StateListener {
mExtAppDb.checkOpenVPNPermission(getPackageManager());
ProfileManager pm = ProfileManager.getInstance(getBaseContext());
VpnProfile vp = ProfileManager.get(getBaseContext(), profileUUID);
+ if (vp == null)
+ throw new RemoteException("Profile not found");
pm.removeProfile(ExternalOpenVPNService.this, vp);
}
@@ -244,7 +248,7 @@ public class ExternalOpenVPNService extends Service implements StateListener {
public boolean protectSocket(ParcelFileDescriptor pfd) throws RemoteException {
mExtAppDb.checkOpenVPNPermission(getPackageManager());
try {
- boolean success= mService.protect(pfd.getFd());
+ boolean success = mService.protect(pfd.getFd());
pfd.close();
return success;
} catch (IOException e) {
@@ -339,7 +343,7 @@ public class ExternalOpenVPNService extends Service implements StateListener {
- class UpdateMessage {
+ static class UpdateMessage {
public String state;
public String logmessage;
public ConnectionStatus level;