summaryrefslogtreecommitdiff
path: root/main/src
diff options
context:
space:
mode:
authorArne Schwabe <arne@rfc2549.org>2016-06-16 16:44:54 +0200
committerArne Schwabe <arne@rfc2549.org>2016-06-16 16:44:54 +0200
commit39eb34415c13863928f13f37cd1da499530c4d5c (patch)
tree91a4897a90ce618978af4da41597554d5da079b9 /main/src
parenta9745b3441294059a697b1044da9ef624a1597c7 (diff)
Fix crash when using Always-on option in Android N
Diffstat (limited to 'main/src')
-rw-r--r--main/src/main/java/de/blinkt/openvpn/core/OpenVPNService.java8
-rw-r--r--main/src/main/java/de/blinkt/openvpn/core/OpenVPNThread.java12
2 files changed, 4 insertions, 16 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 321140fd..c981f6f0 100644
--- a/main/src/main/java/de/blinkt/openvpn/core/OpenVPNService.java
+++ b/main/src/main/java/de/blinkt/openvpn/core/OpenVPNService.java
@@ -11,7 +11,6 @@ import android.app.Notification;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.app.UiModeManager;
-import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
@@ -28,7 +27,6 @@ import android.os.IBinder;
import android.os.Message;
import android.os.ParcelFileDescriptor;
import android.preference.PreferenceManager;
-import android.service.quicksettings.TileService;
import android.system.OsConstants;
import android.text.TextUtils;
import android.util.Log;
@@ -41,12 +39,10 @@ import java.net.Inet6Address;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.Collection;
-import java.util.HashMap;
import java.util.Locale;
import java.util.Vector;
import de.blinkt.openvpn.BuildConfig;
-import de.blinkt.openvpn.OpenVPNTileService;
import de.blinkt.openvpn.R;
import de.blinkt.openvpn.VpnProfile;
import de.blinkt.openvpn.activities.DisconnectVPN;
@@ -57,7 +53,6 @@ import de.blinkt.openvpn.core.VpnStatus.StateListener;
import static de.blinkt.openvpn.core.NetworkSpace.ipAddress;
import static de.blinkt.openvpn.core.VpnStatus.ConnectionStatus.LEVEL_CONNECTED;
-import static de.blinkt.openvpn.core.VpnStatus.ConnectionStatus.LEVEL_CONNECTING_NO_SERVER_REPLY_YET;
import static de.blinkt.openvpn.core.VpnStatus.ConnectionStatus.LEVEL_WAITING_FOR_USER_INPUT;
public class OpenVPNService extends VpnService implements StateListener, Callback, ByteCountListener {
@@ -467,8 +462,7 @@ public class OpenVPNService extends VpnService implements StateListener, Callbac
} else {
- HashMap<String, String> env = new HashMap<>();
- processThread = new OpenVPNThread(this, argv, env, nativeLibraryDirectory);
+ processThread = new OpenVPNThread(this, argv, nativeLibraryDirectory);
mOpenVPNThread = processThread;
}
diff --git a/main/src/main/java/de/blinkt/openvpn/core/OpenVPNThread.java b/main/src/main/java/de/blinkt/openvpn/core/OpenVPNThread.java
index 4f743a19..59bcca37 100644
--- a/main/src/main/java/de/blinkt/openvpn/core/OpenVPNThread.java
+++ b/main/src/main/java/de/blinkt/openvpn/core/OpenVPNThread.java
@@ -42,15 +42,13 @@ public class OpenVPNThread implements Runnable {
private String mNativeDir;
private OpenVPNService mService;
private String mDumpPath;
- private Map<String, String> mProcessEnv;
private boolean mBrokenPie = false;
private boolean mNoProcessExitStatus = false;
- public OpenVPNThread(OpenVPNService service, String[] argv, Map<String, String> processEnv, String nativelibdir) {
+ public OpenVPNThread(OpenVPNService service, String[] argv, String nativelibdir) {
mArgv = argv;
mNativeDir = nativelibdir;
mService = service;
- mProcessEnv = processEnv;
}
public void stopProcess() {
@@ -66,7 +64,7 @@ public class OpenVPNThread implements Runnable {
public void run() {
try {
Log.i(TAG, "Starting openvpn");
- startOpenVPNThreadArgs(mArgv, mProcessEnv);
+ startOpenVPNThreadArgs(mArgv);
Log.i(TAG, "OpenVPN process exited");
} catch (Exception e) {
VpnStatus.logException("Starting OpenVPN Thread", e);
@@ -122,7 +120,7 @@ public class OpenVPNThread implements Runnable {
}
}
- private void startOpenVPNThreadArgs(String[] argv, Map<String, String> env) {
+ private void startOpenVPNThreadArgs(String[] argv) {
LinkedList<String> argvlist = new LinkedList<String>();
Collections.addAll(argvlist, argv);
@@ -134,10 +132,6 @@ public class OpenVPNThread implements Runnable {
pb.environment().put("LD_LIBRARY_PATH", lbpath);
- // Add extra variables
- for (Entry<String, String> e : env.entrySet()) {
- pb.environment().put(e.getKey(), e.getValue());
- }
pb.redirectErrorStream(true);
try {
mProcess = pb.start();