summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArne Schwabe <arne@rfc2549.org>2023-10-10 19:38:44 +0200
committerArne Schwabe <arne@rfc2549.org>2023-10-10 19:38:44 +0200
commitc53c6853dc819b0a9caa574c13806f5d091d6da8 (patch)
tree211c1bd8d46d02a4b110207299cd0529c591eee9
parent83e20b974f916710255c9211dc3dd77595c0aebf (diff)
Fix OpenVPN not starting from Quick in upsidedown cake (closes #1652)
-rw-r--r--main/src/main/java/de/blinkt/openvpn/core/OpenVPNService.java5
-rw-r--r--main/src/ui/java/de/blinkt/openvpn/OpenVPNTileService.java11
2 files changed, 6 insertions, 10 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 5b59a907..0e8793e4 100644
--- a/main/src/main/java/de/blinkt/openvpn/core/OpenVPNService.java
+++ b/main/src/main/java/de/blinkt/openvpn/core/OpenVPNService.java
@@ -759,6 +759,9 @@ public class OpenVPNService extends VpnService implements StateListener, Callbac
private static String getTunConfigString(TunConfig tc) {
// The format of the string is not important, only that
// two identical configurations produce the same result
+ if (tc == null)
+ return "NULL";
+
String cfg = "TUNCFG UNQIUE STRING ips:";
if (tc.mLocalIP != null)
@@ -1323,7 +1326,7 @@ public class OpenVPNService extends VpnService implements StateListener, Callbac
}
public String getTunReopenStatus() {
- String currentConfiguration = getTunConfigString(mLastTunCfg);
+ String currentConfiguration = getTunConfigString(tunConfig);
if (currentConfiguration.equals(getTunConfigString(mLastTunCfg))) {
return "NOACTION";
} else {
diff --git a/main/src/ui/java/de/blinkt/openvpn/OpenVPNTileService.java b/main/src/ui/java/de/blinkt/openvpn/OpenVPNTileService.java
index 9cb69a3d..94c1f1db 100644
--- a/main/src/ui/java/de/blinkt/openvpn/OpenVPNTileService.java
+++ b/main/src/ui/java/de/blinkt/openvpn/OpenVPNTileService.java
@@ -7,7 +7,6 @@ package de.blinkt.openvpn;
import android.annotation.SuppressLint;
import android.annotation.TargetApi;
-import android.app.PendingIntent;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
@@ -23,6 +22,7 @@ import de.blinkt.openvpn.core.ConnectionStatus;
import de.blinkt.openvpn.core.IOpenVPNServiceInternal;
import de.blinkt.openvpn.core.OpenVPNService;
import de.blinkt.openvpn.core.ProfileManager;
+import de.blinkt.openvpn.core.VPNLaunchHelper;
import de.blinkt.openvpn.core.VpnStatus;
@@ -85,14 +85,7 @@ public class OpenVPNTileService extends TileService implements VpnStatus.StateLi
@SuppressLint("Override")
@TargetApi(Build.VERSION_CODES.N)
void launchVPN(VpnProfile profile, Context context) {
- Intent startVpnIntent = new Intent(Intent.ACTION_MAIN);
- startVpnIntent.setClass(context, LaunchVPN.class);
- startVpnIntent.putExtra(LaunchVPN.EXTRA_KEY, profile.getUUIDString());
- startVpnIntent.putExtra(LaunchVPN.EXTRA_START_REASON, "QuickTile");
- startVpnIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
- startVpnIntent.putExtra(LaunchVPN.EXTRA_HIDELOG, true);
-
- context.startActivity(startVpnIntent);
+ VPNLaunchHelper.startOpenVpn(profile, getBaseContext(), "QuickTile");
}
@TargetApi(Build.VERSION_CODES.N)