summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.hgignore2
-rw-r--r--.hgtags1
-rw-r--r--src/de/blinkt/openvpn/LogWindow.java14
-rw-r--r--src/de/blinkt/openvpn/OpenVPNMangement.java13
-rw-r--r--src/de/blinkt/openvpn/OpenVpnService.java44
5 files changed, 55 insertions, 19 deletions
diff --git a/.hgignore b/.hgignore
index eab1094c..e6d2de68 100644
--- a/.hgignore
+++ b/.hgignore
@@ -24,7 +24,7 @@ openvpn/build/msvc/Makefile.in
openvpn/src/openvpn/.deps
openvpn/src/compat/.deps
*.o
-
+ovpn3
*.patch
openvpn/distro/Makefile.in
openvpn/distro/rpm/Makefile.in
diff --git a/.hgtags b/.hgtags
index 6b5d6fae..2880959e 100644
--- a/.hgtags
+++ b/.hgtags
@@ -33,3 +33,4 @@ d356e8526528be9d800d83022aa8004c910fa407 v0.5.23
2385ce9867e4f8f5943fcd1c29c91ec271abc9ba v0.5.28
3645320702ad87a17193d10e14abc8f946a6436d v0.5.29
68f61c0742cafff043ffdf4f059a58ba944cb541 v0.5.30
+3881143690fa7858ae7e0e3e766ab7418cb3fbd6 v0.5.31
diff --git a/src/de/blinkt/openvpn/LogWindow.java b/src/de/blinkt/openvpn/LogWindow.java
index 69d1f859..4d2047f8 100644
--- a/src/de/blinkt/openvpn/LogWindow.java
+++ b/src/de/blinkt/openvpn/LogWindow.java
@@ -262,9 +262,18 @@ public class LogWindow extends ListActivity implements StateListener {
Toast.makeText(this, R.string.log_no_last_vpn, Toast.LENGTH_LONG).show();
}
+ } else if(item.getItemId() == android.R.id.home) {
+ // This is called when the Home (Up) button is pressed
+ // in the Action Bar.
+ Intent parentActivityIntent = new Intent(this, MainActivity.class);
+ parentActivityIntent.addFlags(
+ Intent.FLAG_ACTIVITY_CLEAR_TOP |
+ Intent.FLAG_ACTIVITY_NEW_TASK);
+ startActivity(parentActivityIntent);
+ finish();
+ return true;
}
-
return super.onOptionsItemSelected(item);
}
@@ -350,7 +359,8 @@ public class LogWindow extends ListActivity implements StateListener {
lv.setAdapter(ladapter);
mSpeedView = (TextView) findViewById(R.id.speed);
-
+ getActionBar().setDisplayHomeAsUpEnabled(true);
+
Intent intent = new Intent(getBaseContext(), OpenVpnService.class);
intent.setAction(OpenVpnService.START_SERVICE);
diff --git a/src/de/blinkt/openvpn/OpenVPNMangement.java b/src/de/blinkt/openvpn/OpenVPNMangement.java
new file mode 100644
index 00000000..0c6d7163
--- /dev/null
+++ b/src/de/blinkt/openvpn/OpenVPNMangement.java
@@ -0,0 +1,13 @@
+package de.blinkt.openvpn;
+
+public interface OpenVPNMangement {
+
+ void reconnect();
+
+ void pause();
+
+ void resume();
+
+ boolean stopVPN();
+
+}
diff --git a/src/de/blinkt/openvpn/OpenVpnService.java b/src/de/blinkt/openvpn/OpenVpnService.java
index d5d75589..34f612c3 100644
--- a/src/de/blinkt/openvpn/OpenVpnService.java
+++ b/src/de/blinkt/openvpn/OpenVpnService.java
@@ -86,10 +86,10 @@ public class OpenVpnService extends VpnService implements StateListener, Callbac
private final IBinder mBinder = new LocalBinder();
private boolean mOvpn3;
- private OpenVPNThreadv3 mOpenVPN3;
private Thread mSocketManagerThread;
private OpenVPNMangement mManagement;
+
public class LocalBinder extends Binder {
public OpenVpnService getService() {
// Return this instance of LocalService so clients can call public methods
@@ -249,8 +249,8 @@ public class OpenVpnService extends VpnService implements StateListener, Callbac
this.unregisterReceiver(mNetworkStateReceiver);
mNetworkStateReceiver=null;
}
-
-
+
+
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
@@ -288,16 +288,6 @@ public class OpenVpnService extends VpnService implements StateListener, Callbac
}
- if(mOpenVPN3!=null) {
- mOpenVPN3.stopVPN();
- try {
- Thread.sleep(1000);
- } catch (InterruptedException e) {
- }
-
- }
-
-
if (mProcessThread!=null) {
mProcessThread.interrupt();
try {
@@ -330,10 +320,11 @@ public class OpenVpnService extends VpnService implements StateListener, Callbac
Runnable processThread;
if(mOvpn3) {
- mOpenVPN3 = new OpenVPNThreadv3(this,mProfile);
- processThread = mOpenVPN3;
+
+ OpenVPNMangement mOpenVPN3 = instantiateOpenVPN3Core();
+ processThread = (Runnable) mOpenVPN3;
mManagement = mOpenVPN3;
-
+
} else {
processThread = new OpenVPNThread(this, argv,nativelibdir);
@@ -350,6 +341,27 @@ public class OpenVpnService extends VpnService implements StateListener, Callbac
return START_NOT_STICKY;
}
+ private OpenVPNMangement instantiateOpenVPN3Core() {
+ //new OpenVPNThreadv3(this,mProfile);
+ try {
+ Class cl = Class.forName("Lde/blinkt/openvpn/OpenVPNThreadv3;");
+ return (OpenVPNMangement) cl.getConstructor(OpenVpnService.class,VpnProfile.class).newInstance(this,mProfile);
+ } catch (IllegalArgumentException e) {
+ e.printStackTrace();
+ } catch (InstantiationException e) {
+ e.printStackTrace();
+ } catch (IllegalAccessException e) {
+ e.printStackTrace();
+ } catch (InvocationTargetException e) {
+ e.printStackTrace();
+ } catch (NoSuchMethodException e) {
+ e.printStackTrace();
+ } catch (ClassNotFoundException e) {
+ e.printStackTrace();
+ }
+ return null;
+ }
+
@Override
public void onDestroy() {
if (mProcessThread != null) {