From e86d8b67696568b17854ccdc846191dc9635841d Mon Sep 17 00:00:00 2001 From: Arne Schwabe Date: Wed, 9 May 2012 17:57:40 +0200 Subject: Only try to write minivpn once per program lifetime. Remove debug logging --- src/de/blinkt/openvpn/LaunchVPN.java | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'src/de/blinkt/openvpn/LaunchVPN.java') diff --git a/src/de/blinkt/openvpn/LaunchVPN.java b/src/de/blinkt/openvpn/LaunchVPN.java index 17313cd5..858c8d38 100644 --- a/src/de/blinkt/openvpn/LaunchVPN.java +++ b/src/de/blinkt/openvpn/LaunchVPN.java @@ -78,6 +78,8 @@ public class LaunchVPN extends ListActivity implements OnItemClickListener { private ProfileManager mPM; private VpnProfile mSelectedProfile; + static boolean minivpnwritten=false; + @Override public void onCreate(Bundle icicle) { super.onCreate(icicle); @@ -210,6 +212,8 @@ public class LaunchVPN extends ListActivity implements OnItemClickListener { } private boolean writeMiniVPN() { + if(minivpnwritten) + return true; try { InputStream mvpn = getAssets().open("minivpn"); File mvpnout = new File(getCacheDir(),"minivpn"); @@ -227,7 +231,7 @@ public class LaunchVPN extends ListActivity implements OnItemClickListener { if(!mvpnout.setExecutable(true)) return false; - + minivpnwritten=true; return true; } catch (IOException e) { e.printStackTrace(); @@ -321,8 +325,10 @@ public class LaunchVPN extends ListActivity implements OnItemClickListener { // Start the query try { startActivityForResult(intent, START_VPN_PROFILE); - } catch (ActivityNotFoundException ane){ - Toast.makeText(this, "Your image does not support the VPNService API,sorry :(", Toast.LENGTH_LONG).show(); + } catch (ActivityNotFoundException ane) { + // Shame on you Sony! At least one user reported that + // an official Sony Xperia Arc S image triggers this exception + Toast.makeText(this, R.string.no_vpn_support_image, Toast.LENGTH_LONG).show(); } } else { onActivityResult(START_VPN_PROFILE, Activity.RESULT_OK, null); @@ -341,7 +347,6 @@ public class LaunchVPN extends ListActivity implements OnItemClickListener { Intent startLW = new Intent(getBaseContext(),LogWindow.class); startActivity(startLW); - OpenVPN.logMessage(0, "", "Writing minivpn binary"); if(!writeMiniVPN()) { OpenVPN.logMessage(0, "", "Error writing minivpn binary"); return; -- cgit v1.2.3