mirror of
https://github.com/schwabe/ics-openvpn.git
synced 2024-09-20 03:52:27 +02:00
Fix OpenVPN not starting from Quick in upsidedown cake (closes #1652)
This commit is contained in:
parent
83e20b974f
commit
c53c6853dc
@ -759,6 +759,9 @@ public class OpenVPNService extends VpnService implements StateListener, Callbac
|
|||||||
private static String getTunConfigString(TunConfig tc) {
|
private static String getTunConfigString(TunConfig tc) {
|
||||||
// The format of the string is not important, only that
|
// The format of the string is not important, only that
|
||||||
// two identical configurations produce the same result
|
// two identical configurations produce the same result
|
||||||
|
if (tc == null)
|
||||||
|
return "NULL";
|
||||||
|
|
||||||
String cfg = "TUNCFG UNQIUE STRING ips:";
|
String cfg = "TUNCFG UNQIUE STRING ips:";
|
||||||
|
|
||||||
if (tc.mLocalIP != null)
|
if (tc.mLocalIP != null)
|
||||||
@ -1323,7 +1326,7 @@ public class OpenVPNService extends VpnService implements StateListener, Callbac
|
|||||||
}
|
}
|
||||||
|
|
||||||
public String getTunReopenStatus() {
|
public String getTunReopenStatus() {
|
||||||
String currentConfiguration = getTunConfigString(mLastTunCfg);
|
String currentConfiguration = getTunConfigString(tunConfig);
|
||||||
if (currentConfiguration.equals(getTunConfigString(mLastTunCfg))) {
|
if (currentConfiguration.equals(getTunConfigString(mLastTunCfg))) {
|
||||||
return "NOACTION";
|
return "NOACTION";
|
||||||
} else {
|
} else {
|
||||||
|
@ -7,7 +7,6 @@ package de.blinkt.openvpn;
|
|||||||
|
|
||||||
import android.annotation.SuppressLint;
|
import android.annotation.SuppressLint;
|
||||||
import android.annotation.TargetApi;
|
import android.annotation.TargetApi;
|
||||||
import android.app.PendingIntent;
|
|
||||||
import android.content.ComponentName;
|
import android.content.ComponentName;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
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.IOpenVPNServiceInternal;
|
||||||
import de.blinkt.openvpn.core.OpenVPNService;
|
import de.blinkt.openvpn.core.OpenVPNService;
|
||||||
import de.blinkt.openvpn.core.ProfileManager;
|
import de.blinkt.openvpn.core.ProfileManager;
|
||||||
|
import de.blinkt.openvpn.core.VPNLaunchHelper;
|
||||||
import de.blinkt.openvpn.core.VpnStatus;
|
import de.blinkt.openvpn.core.VpnStatus;
|
||||||
|
|
||||||
|
|
||||||
@ -85,14 +85,7 @@ public class OpenVPNTileService extends TileService implements VpnStatus.StateLi
|
|||||||
@SuppressLint("Override")
|
@SuppressLint("Override")
|
||||||
@TargetApi(Build.VERSION_CODES.N)
|
@TargetApi(Build.VERSION_CODES.N)
|
||||||
void launchVPN(VpnProfile profile, Context context) {
|
void launchVPN(VpnProfile profile, Context context) {
|
||||||
Intent startVpnIntent = new Intent(Intent.ACTION_MAIN);
|
VPNLaunchHelper.startOpenVpn(profile, getBaseContext(), "QuickTile");
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@TargetApi(Build.VERSION_CODES.N)
|
@TargetApi(Build.VERSION_CODES.N)
|
||||||
|
Loading…
Reference in New Issue
Block a user