From 4a7488e0b5dc2a0069d2a4c9b461631016a95d45 Mon Sep 17 00:00:00 2001 From: Arne Schwabe Date: Sat, 5 May 2012 17:55:46 +0200 Subject: First time a fd was successfully transfered over a socket :) --- src/de/blinkt/openvpn/AboutFragment.java | 13 ++++ src/de/blinkt/openvpn/LaunchVPN.java | 1 - src/de/blinkt/openvpn/MainActivity.java | 4 +- src/de/blinkt/openvpn/OpenVpnManagementThread.java | 76 +++++++++++++++------- src/de/blinkt/openvpn/OpenVpnService.java | 3 - 5 files changed, 69 insertions(+), 28 deletions(-) (limited to 'src/de/blinkt') diff --git a/src/de/blinkt/openvpn/AboutFragment.java b/src/de/blinkt/openvpn/AboutFragment.java index c96c5833..065e53bc 100644 --- a/src/de/blinkt/openvpn/AboutFragment.java +++ b/src/de/blinkt/openvpn/AboutFragment.java @@ -1,10 +1,12 @@ package de.blinkt.openvpn; import android.app.Fragment; +import android.content.pm.PackageManager.NameNotFoundException; import android.os.Bundle; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; +import android.widget.TextView; public class AboutFragment extends Fragment { @@ -18,6 +20,17 @@ public class AboutFragment extends Fragment { public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View v= inflater.inflate(R.layout.about, container, false); + TextView ver = (TextView) v.findViewById(R.id.version); + + String version; + try { + version = getActivity().getPackageManager().getPackageInfo(getActivity().getPackageName(), 0).versionName; + } catch (NameNotFoundException e) { + version = "error fetching version"; + } + + + ver.setText(getString(R.string.version_info,version)); return v; } diff --git a/src/de/blinkt/openvpn/LaunchVPN.java b/src/de/blinkt/openvpn/LaunchVPN.java index 2e25f7a2..28abaf3d 100644 --- a/src/de/blinkt/openvpn/LaunchVPN.java +++ b/src/de/blinkt/openvpn/LaunchVPN.java @@ -32,7 +32,6 @@ import android.os.Parcelable; import android.text.InputType; import android.text.method.PasswordTransformationMethod; import android.view.View; -import android.view.inputmethod.EditorInfo; import android.widget.AdapterView; import android.widget.AdapterView.OnItemClickListener; import android.widget.ArrayAdapter; diff --git a/src/de/blinkt/openvpn/MainActivity.java b/src/de/blinkt/openvpn/MainActivity.java index 5eaf146c..86c1d73f 100644 --- a/src/de/blinkt/openvpn/MainActivity.java +++ b/src/de/blinkt/openvpn/MainActivity.java @@ -9,7 +9,9 @@ public class MainActivity extends PreferenceActivity { @Override public void onBuildHeaders(List
target) { - loadHeadersFromResource(R.xml.main_headers, target); + loadHeadersFromResource(R.xml.main_headers, target); + //debug + OpenVPN.foo(); } @Override diff --git a/src/de/blinkt/openvpn/OpenVpnManagementThread.java b/src/de/blinkt/openvpn/OpenVpnManagementThread.java index 2421b28c..093e4d6d 100644 --- a/src/de/blinkt/openvpn/OpenVpnManagementThread.java +++ b/src/de/blinkt/openvpn/OpenVpnManagementThread.java @@ -3,6 +3,8 @@ package de.blinkt.openvpn; import java.io.FileDescriptor; import java.io.IOException; import java.io.InputStream; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; import java.util.Vector; import android.net.LocalSocket; @@ -14,9 +16,10 @@ public class OpenVpnManagementThread implements Runnable { private LocalSocket mSocket; private VpnProfile mProfile; private OpenVpnService mOpenVPNService; - -private static Vector active=new Vector(); - + private Vector mFDList=new Vector(); + + private static Vector active=new Vector(); + public OpenVpnManagementThread(VpnProfile profile, LocalSocket mgmtsocket, OpenVpnService openVpnService) { mProfile = profile; mSocket = mgmtsocket; @@ -46,7 +49,7 @@ private static Vector active=new Vector active=new Vector active=new Vector active=new Vector active=new Vector active=new Vector active=new Vector