From 9ea8c8a18a4e02531df8acb87ad12a578805ee37 Mon Sep 17 00:00:00 2001 From: Arne Schwabe Date: Sat, 25 May 2013 11:50:43 +0200 Subject: Extend external API documentation and change hasPermission to prepareVPNService --- src/de/blinkt/openvpn/api/ExternalOpenVPNService.java | 7 +++++-- src/de/blinkt/openvpn/api/IOpenVPNAPIService.aidl | 8 +++++--- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/de/blinkt/openvpn/api/ExternalOpenVPNService.java b/src/de/blinkt/openvpn/api/ExternalOpenVPNService.java index 21580eb4..866fb698 100644 --- a/src/de/blinkt/openvpn/api/ExternalOpenVPNService.java +++ b/src/de/blinkt/openvpn/api/ExternalOpenVPNService.java @@ -177,10 +177,13 @@ public class ExternalOpenVPNService extends Service implements StateListener { } @Override - public boolean hasPermission() throws RemoteException { + public Intent prepareVPNService() throws RemoteException { checkOpenVPNPermission(); - return VpnService.prepare(ExternalOpenVPNService.this)==null; + if(VpnService.prepare(ExternalOpenVPNService.this)==null) + return null; + else + return new Intent(getBaseContext(), GrantPermissionsActivity.class); } diff --git a/src/de/blinkt/openvpn/api/IOpenVPNAPIService.aidl b/src/de/blinkt/openvpn/api/IOpenVPNAPIService.aidl index c1e32eac..3e0b94e4 100644 --- a/src/de/blinkt/openvpn/api/IOpenVPNAPIService.aidl +++ b/src/de/blinkt/openvpn/api/IOpenVPNAPIService.aidl @@ -19,11 +19,13 @@ interface IOpenVPNAPIService { void startVPN (String inlineconfig); /* This permission framework is used to avoid confused deputy style attack to the VPN - * calling this will give null if the app is allowed to use the frame and null otherwise */ + * calling this will give null if the app is allowed to use the external API and an Intent + * that can be launched to request permissions otherwise */ Intent prepare (String packagename); - /* Tells the calling app wether we already have permission to avoid calling the activity/flicker */ - boolean hasPermission(); + /* Used to trigger to the Android VPN permission dialog (VPNService.prepare()) in advance, + * if this return null OpenVPN for ANdroid already has the permissions */ + Intent prepareVPNService (); /* Disconnect the VPN */ void disconnect(); -- cgit v1.2.3