summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--main/src/main/java/de/blinkt/openvpn/core/OpenVPNService.java24
-rw-r--r--main/src/main/java/de/blinkt/openvpn/core/OpenVpnManagementThread.java4
-rw-r--r--main/src/ovpn3/java/de/blinkt/openvpn/core/OpenVPNThreadv3.java3
3 files changed, 24 insertions, 7 deletions
diff --git a/main/src/main/java/de/blinkt/openvpn/core/OpenVPNService.java b/main/src/main/java/de/blinkt/openvpn/core/OpenVPNService.java
index cf602a52..a2126861 100644
--- a/main/src/main/java/de/blinkt/openvpn/core/OpenVPNService.java
+++ b/main/src/main/java/de/blinkt/openvpn/core/OpenVPNService.java
@@ -136,6 +136,7 @@ public class OpenVPNService extends VpnService implements StateListener, Callbac
private Handler guiHandler;
private Toast mlastToast;
private Runnable mOpenVPNThread;
+ private PendingIntent mSSOPendingIntent = null;
// From: http://stackoverflow.com/questions/3758606/how-to-convert-byte-size-into-human-readable-format-in-java
public static String humanReadableByteCount(long bytes, boolean speed, Resources res) {
@@ -268,8 +269,13 @@ public class OpenVPNService extends VpnService implements StateListener, Callbac
nbuilder.setOngoing(true);
nbuilder.setSmallIcon(icon);
- if (status == LEVEL_WAITING_FOR_USER_INPUT)
- nbuilder.setContentIntent(getUserInputIntent(msg));
+ if (status == LEVEL_WAITING_FOR_USER_INPUT) {
+ if (mSSOPendingIntent != null) {
+ nbuilder.setContentIntent(mSSOPendingIntent);
+ } else {
+ nbuilder.setContentIntent(getUserInputIntent(msg));
+ }
+ }
else
nbuilder.setContentIntent(getGraphPendingIntent());
@@ -1254,10 +1260,11 @@ public class OpenVPNService extends VpnService implements StateListener, Callbac
Intent intent;
+ int reason;
if (method.equals("OPEN_URL")) {
String url = info.split(":", 2)[1];
-
- nbuilder.setContentTitle(getString(R.string.openurl_requested));
+ reason = R.string.openurl_requested;
+ nbuilder.setContentTitle(getString(reason));
nbuilder.setContentText(url);
@@ -1269,7 +1276,8 @@ public class OpenVPNService extends VpnService implements StateListener, Callbac
} else if (method.equals("CR_TEXT")) {
String challenge = info.split(":", 2)[1];
- nbuilder.setContentTitle(getString(R.string.crtext_requested));
+ reason = R.string.crtext_requested;
+ nbuilder.setContentTitle(getString(reason));
nbuilder.setContentText(challenge);
intent = new Intent(this, CredentialsPopup.class);
@@ -1280,7 +1288,11 @@ public class OpenVPNService extends VpnService implements StateListener, Callbac
return;
}
- nbuilder.setContentIntent(PendingIntent.getActivity(this, 0, intent, 0));
+ // updateStateString trigger the notification of the VPN to be refreshed, save this intent
+ // to have that notification also this intent to be set
+ mSSOPendingIntent = PendingIntent.getActivity(this, 0, intent, 0);
+ VpnStatus.updateStateString("USER_INPUT", "waiting for user input", reason, LEVEL_WAITING_FOR_USER_INPUT);
+ nbuilder.setContentIntent(mSSOPendingIntent);
// Try to set the priority available since API 16 (Jellybean)
diff --git a/main/src/main/java/de/blinkt/openvpn/core/OpenVpnManagementThread.java b/main/src/main/java/de/blinkt/openvpn/core/OpenVpnManagementThread.java
index 83132505..c8609e41 100644
--- a/main/src/main/java/de/blinkt/openvpn/core/OpenVpnManagementThread.java
+++ b/main/src/main/java/de/blinkt/openvpn/core/OpenVpnManagementThread.java
@@ -345,6 +345,10 @@ public class OpenVpnManagementThread implements Runnable, OpenVPNManagement {
{
mOpenVPNService.trigger_sso(info);
}
+ else
+ {
+ VpnStatus.logDebug("Info message from server:" + info);
+ }
}
private void processLogMessage(String argument) {
diff --git a/main/src/ovpn3/java/de/blinkt/openvpn/core/OpenVPNThreadv3.java b/main/src/ovpn3/java/de/blinkt/openvpn/core/OpenVPNThreadv3.java
index f453205a..c74281e7 100644
--- a/main/src/ovpn3/java/de/blinkt/openvpn/core/OpenVPNThreadv3.java
+++ b/main/src/ovpn3/java/de/blinkt/openvpn/core/OpenVPNThreadv3.java
@@ -283,9 +283,10 @@ public class OpenVPNThreadv3 extends ClientAPI_OpenVPNClient implements Runnable
String name = event.getName();
String info = event.getInfo();
if (name.equals("INFO")) {
- VpnStatus.logInfo(R.string.info_from_server, info);
if (info.startsWith("OPEN_URL:") || info.startsWith("CR_TEXT:")) {
mService.trigger_sso(info);
+ } else {
+ VpnStatus.logInfo(R.string.info_from_server, info);
}
} else {
VpnStatus.updateStateString(name, info);