summaryrefslogtreecommitdiff
path: root/src/de/blinkt/openvpn/SendDumpActivity.java
diff options
context:
space:
mode:
authorArne Schwabe <arne@rfc2549.org>2012-12-26 04:58:57 +0100
committerArne Schwabe <arne@rfc2549.org>2012-12-26 04:58:57 +0100
commit8a94d6c21681896f60054c18e2495ef8c53e6f7c (patch)
tree42f3214fe619e402d8f02f2164097e4717d07c16 /src/de/blinkt/openvpn/SendDumpActivity.java
parentfd7570835b7e7fdd335b55bc006791ecb402277b (diff)
parent58131bfbde80b433992ab2e7deabb0b63aac072e (diff)
Return to the old icon, I do not like the new ones yet...
Diffstat (limited to 'src/de/blinkt/openvpn/SendDumpActivity.java')
-rw-r--r--src/de/blinkt/openvpn/SendDumpActivity.java60
1 files changed, 60 insertions, 0 deletions
diff --git a/src/de/blinkt/openvpn/SendDumpActivity.java b/src/de/blinkt/openvpn/SendDumpActivity.java
new file mode 100644
index 00000000..8a09b535
--- /dev/null
+++ b/src/de/blinkt/openvpn/SendDumpActivity.java
@@ -0,0 +1,60 @@
+package de.blinkt.openvpn;
+
+import java.io.File;
+import java.util.ArrayList;
+
+import android.app.Activity;
+import android.content.Context;
+import android.content.Intent;
+import android.net.Uri;
+
+public class SendDumpActivity extends Activity {
+
+ protected void onStart() {
+ super.onStart();
+ emailMiniDumps();
+ finish();
+ };
+
+ 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>"});
+ emailIntent.putExtra(Intent.EXTRA_SUBJECT, "OpenVPN Minidump");
+
+ emailIntent.putExtra(Intent.EXTRA_TEXT, "Please describe the issue you have experienced");
+
+ ArrayList<Uri> uris = new ArrayList<Uri>();
+
+ File ldump = getLastestDump(this);
+ 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;
+ }
+ }
+ return newestDumpFile;
+ }
+}