diff options
author | Arne Schwabe <arne@rfc2549.org> | 2012-05-30 17:17:36 +0200 |
---|---|---|
committer | Arne Schwabe <arne@rfc2549.org> | 2012-05-30 17:17:36 +0200 |
commit | 07da9cd38bf6a485943aa458cd9641b37dafbdd4 (patch) | |
tree | d31c545e654e88708e12afeae9fa8b83a34430c6 /src | |
parent | 9513c78707f2578a14a9fff0fce9a516b321f4bd (diff) |
Add fix for CM9 /dev/tun ownership (closes issue #35)
Diffstat (limited to 'src')
-rw-r--r-- | src/de/blinkt/openvpn/GeneralSettings.java | 17 | ||||
-rw-r--r-- | src/de/blinkt/openvpn/LaunchVPN.java | 25 |
2 files changed, 41 insertions, 1 deletions
diff --git a/src/de/blinkt/openvpn/GeneralSettings.java b/src/de/blinkt/openvpn/GeneralSettings.java new file mode 100644 index 00000000..24bf2616 --- /dev/null +++ b/src/de/blinkt/openvpn/GeneralSettings.java @@ -0,0 +1,17 @@ +package de.blinkt.openvpn; +import android.os.Bundle; +import android.preference.PreferenceFragment; + +public class GeneralSettings extends PreferenceFragment { + + @Override + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + + + // Load the preferences from an XML resource + addPreferencesFromResource(R.xml.general_settings); + } + + + }
\ No newline at end of file diff --git a/src/de/blinkt/openvpn/LaunchVPN.java b/src/de/blinkt/openvpn/LaunchVPN.java index 5d17e6b3..b7b010a4 100644 --- a/src/de/blinkt/openvpn/LaunchVPN.java +++ b/src/de/blinkt/openvpn/LaunchVPN.java @@ -30,9 +30,11 @@ import android.content.ActivityNotFoundException; import android.content.DialogInterface; import android.content.DialogInterface.OnClickListener; import android.content.Intent; +import android.content.SharedPreferences; import android.net.VpnService; import android.os.Bundle; import android.os.Parcelable; +import android.preference.PreferenceManager; import android.text.InputType; import android.text.method.PasswordTransformationMethod; import android.view.View; @@ -76,7 +78,9 @@ public class LaunchVPN extends ListActivity implements OnItemClickListener { private ProfileManager mPM; private VpnProfile mSelectedProfile; - + + + private boolean mCmfixed=false; static boolean minivpnwritten=false; @Override @@ -326,6 +330,25 @@ public class LaunchVPN extends ListActivity implements OnItemClickListener { } Intent intent = VpnService.prepare(this); + // Check if we want to fix /dev/tun + SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this); + boolean usecm9fix = prefs.getBoolean("useCM9Fix", false); + + if(usecm9fix && !mCmfixed ) { + ProcessBuilder pb = new ProcessBuilder(new String[] {"su","-c","chown system /dev/tun"}); + try { + Process p = pb.start(); + int ret = p.waitFor(); + if(ret ==0) + mCmfixed=true; + } catch (InterruptedException e) { + e.printStackTrace(); + } catch (IOException e) { + e.printStackTrace(); + } + } + + if (intent != null) { // Start the query |