summaryrefslogtreecommitdiff
path: root/src/de/blinkt/openvpn/fragments/SendDumpFragment.java
diff options
context:
space:
mode:
authorArne Schwabe <arne@rfc2549.org>2013-03-12 14:18:53 +0100
committerArne Schwabe <arne@rfc2549.org>2013-03-12 14:18:53 +0100
commitef4438a0ede0394736f8abdbcf4fa24b712ec7eb (patch)
treea0ea8ba4002e2063438a2dcc7123dfa98f0fc7ab /src/de/blinkt/openvpn/fragments/SendDumpFragment.java
parent94e4d391a1f2731a132ccc70dbe98a7cbb458274 (diff)
Break the classes into core classes that deal with handling the backend logic, the fragment and rest.
LaunchVPN, MainActivity, ConfigConvert are public API that is recorded in shortcuts, launchers etc. Moving them would break public API. Also VPNProfile belongs into core but since the reading VPN Profiles depends on the class name keep it in the main package. --HG-- rename : src/de/blinkt/openvpn/CIDRIP.java => src/de/blinkt/openvpn/core/CIDRIP.java rename : src/de/blinkt/openvpn/ConfigParser.java => src/de/blinkt/openvpn/core/ConfigParser.java rename : src/de/blinkt/openvpn/NetworkSateReceiver.java => src/de/blinkt/openvpn/core/NetworkSateReceiver.java rename : src/de/blinkt/openvpn/OpenVPN.java => src/de/blinkt/openvpn/core/OpenVPN.java rename : src/de/blinkt/openvpn/OpenVPNMangement.java => src/de/blinkt/openvpn/core/OpenVPNMangement.java rename : src/de/blinkt/openvpn/OpenVPNThread.java => src/de/blinkt/openvpn/core/OpenVPNThread.java rename : src/de/blinkt/openvpn/OpenVpnManagementThread.java => src/de/blinkt/openvpn/core/OpenVpnManagementThread.java rename : src/de/blinkt/openvpn/OpenVpnService.java => src/de/blinkt/openvpn/core/OpenVpnService.java rename : src/de/blinkt/openvpn/ProfileManager.java => src/de/blinkt/openvpn/core/ProfileManager.java rename : src/de/blinkt/openvpn/ProxyDetection.java => src/de/blinkt/openvpn/core/ProxyDetection.java rename : src/de/blinkt/openvpn/VPNLaunchHelper.java => src/de/blinkt/openvpn/core/VPNLaunchHelper.java rename : src/de/blinkt/openvpn/AboutFragment.java => src/de/blinkt/openvpn/fragments/AboutFragment.java rename : src/de/blinkt/openvpn/FaqFragment.java => src/de/blinkt/openvpn/fragments/FaqFragment.java rename : src/de/blinkt/openvpn/FileSelectionFragment.java => src/de/blinkt/openvpn/fragments/FileSelectionFragment.java rename : src/de/blinkt/openvpn/GeneralSettings.java => src/de/blinkt/openvpn/fragments/GeneralSettings.java rename : src/de/blinkt/openvpn/InlineFileTab.java => src/de/blinkt/openvpn/fragments/InlineFileTab.java rename : src/de/blinkt/openvpn/OpenVpnPreferencesFragment.java => src/de/blinkt/openvpn/fragments/OpenVpnPreferencesFragment.java rename : src/de/blinkt/openvpn/SendDumpFragment.java => src/de/blinkt/openvpn/fragments/SendDumpFragment.java rename : src/de/blinkt/openvpn/Settings_Authentication.java => src/de/blinkt/openvpn/fragments/Settings_Authentication.java rename : src/de/blinkt/openvpn/Settings_Basic.java => src/de/blinkt/openvpn/fragments/Settings_Basic.java rename : src/de/blinkt/openvpn/Settings_IP.java => src/de/blinkt/openvpn/fragments/Settings_IP.java rename : src/de/blinkt/openvpn/Settings_Obscure.java => src/de/blinkt/openvpn/fragments/Settings_Obscure.java rename : src/de/blinkt/openvpn/Settings_Routing.java => src/de/blinkt/openvpn/fragments/Settings_Routing.java rename : src/de/blinkt/openvpn/ShowConfigFragment.java => src/de/blinkt/openvpn/fragments/ShowConfigFragment.java rename : src/de/blinkt/openvpn/VPNProfileList.java => src/de/blinkt/openvpn/fragments/VPNProfileList.java
Diffstat (limited to 'src/de/blinkt/openvpn/fragments/SendDumpFragment.java')
-rw-r--r--src/de/blinkt/openvpn/fragments/SendDumpFragment.java94
1 files changed, 94 insertions, 0 deletions
diff --git a/src/de/blinkt/openvpn/fragments/SendDumpFragment.java b/src/de/blinkt/openvpn/fragments/SendDumpFragment.java
new file mode 100644
index 00000000..020379ef
--- /dev/null
+++ b/src/de/blinkt/openvpn/fragments/SendDumpFragment.java
@@ -0,0 +1,94 @@
+package de.blinkt.openvpn.fragments;
+
+import java.io.File;
+import java.util.ArrayList;
+
+import android.app.Fragment;
+import android.content.Context;
+import android.content.Intent;
+import android.content.pm.PackageInfo;
+import android.content.pm.PackageManager.NameNotFoundException;
+import android.net.Uri;
+import android.os.Bundle;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.View.OnClickListener;
+import android.view.ViewGroup;
+import de.blinkt.openvpn.R;
+import de.blinkt.openvpn.core.OpenVPN;
+
+public class SendDumpFragment extends Fragment {
+
+ @Override
+ public View onCreateView(LayoutInflater inflater, ViewGroup container,
+ Bundle savedInstanceState) {
+
+ View v = inflater.inflate(R.layout.fragment_senddump, container, false);
+ v.findViewById(R.id.senddump).setOnClickListener(new OnClickListener() {
+
+ @Override
+ public void onClick(View v) {
+ emailMiniDumps();
+ }
+ });
+ return v;
+ }
+
+ public void emailMiniDumps()
+ {
+ //need to "send multiple" to get more than one attachment
+ final Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND_MULTIPLE);
+ emailIntent.setType("*/*");
+ emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL,
+ new String[]{"Arne Schwabe <arne@rfc2549.org>"});
+
+ String version;
+ String name="ics-openvpn";
+ try {
+ PackageInfo packageinfo = getActivity().getPackageManager().getPackageInfo(getActivity().getPackageName(), 0);
+ version = packageinfo.versionName;
+ name = packageinfo.applicationInfo.name;
+ } catch (NameNotFoundException e) {
+ version = "error fetching version";
+ }
+
+
+ emailIntent.putExtra(Intent.EXTRA_SUBJECT, String.format("%s %s Minidump",name,version));
+
+ emailIntent.putExtra(Intent.EXTRA_TEXT, "Please describe the issue you have experienced");
+
+ ArrayList<Uri> uris = new ArrayList<Uri>();
+
+ File ldump = getLastestDump(getActivity());
+ if(ldump==null) {
+ OpenVPN.logError("No Minidump found!");
+ }
+
+ uris.add(Uri.parse("content://de.blinkt.openvpn.FileProvider/" + ldump.getName()));
+ uris.add(Uri.parse("content://de.blinkt.openvpn.FileProvider/" + ldump.getName() + ".log"));
+
+ emailIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
+ emailIntent.putParcelableArrayListExtra(Intent.EXTRA_STREAM, uris);
+ startActivity(emailIntent);
+ }
+
+ static public File getLastestDump(Context c) {
+ long newestDumpTime=0;
+ File newestDumpFile=null;
+
+ for(File f:c.getCacheDir().listFiles()) {
+ if(!f.getName().endsWith(".dmp"))
+ continue;
+
+ if (newestDumpTime < f.lastModified()) {
+ newestDumpTime = f.lastModified();
+ newestDumpFile=f;
+ }
+ }
+ // Ignore old dumps
+ //if(System.currentTimeMillis() - 48 * 60 * 1000 > newestDumpTime )
+ //return null;
+
+ return newestDumpFile;
+ }
+}