[Android] Save crash/log files in VLC directories

Geoffrey Métais git at videolan.org
Wed Mar 8 17:26:43 CET 2017


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Wed Mar  8 14:06:09 2017 +0100| [277b233cbed0d395b59fe6f4e950a2e59081adb4] | committer: Geoffrey Métais

Save crash/log files in VLC directories

Do not flood external storage root anymore

> https://code.videolan.org/videolan/vlc-android/commit/277b233cbed0d395b59fe6f4e950a2e59081adb4
---

 .../src/org/videolan/vlc/VLCCrashHandler.java       | 21 ++++++++++-----------
 1 file changed, 10 insertions(+), 11 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/VLCCrashHandler.java b/vlc-android/src/org/videolan/vlc/VLCCrashHandler.java
index 72cedef..7009ad1 100644
--- a/vlc-android/src/org/videolan/vlc/VLCCrashHandler.java
+++ b/vlc-android/src/org/videolan/vlc/VLCCrashHandler.java
@@ -20,6 +20,13 @@
 
 package org.videolan.vlc;
 
+import android.os.Environment;
+import android.text.format.DateFormat;
+import android.util.Log;
+
+import org.videolan.vlc.util.Logcat;
+import org.videolan.vlc.util.Util;
+
 import java.io.BufferedWriter;
 import java.io.FileNotFoundException;
 import java.io.FileOutputStream;
@@ -30,14 +37,6 @@ import java.io.StringWriter;
 import java.io.Writer;
 import java.lang.Thread.UncaughtExceptionHandler;
 
-import org.videolan.vlc.util.AndroidDevices;
-import org.videolan.vlc.util.Logcat;
-import org.videolan.vlc.util.Util;
-
-import android.os.Environment;
-import android.text.format.DateFormat;
-import android.util.Log;
-
 public class VLCCrashHandler implements UncaughtExceptionHandler {
 
     private static final String TAG = "VLC/VlcCrashHandler";
@@ -69,9 +68,9 @@ public class VLCCrashHandler implements UncaughtExceptionHandler {
         Log.e(TAG, stacktrace);
 
         // Save the log on SD card if available
-        if(Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) {
-            writeLog(stacktrace, AndroidDevices.EXTERNAL_PUBLIC_DIRECTORY + "/vlc_crash");
-            writeLogcat(AndroidDevices.EXTERNAL_PUBLIC_DIRECTORY + "/vlc_logcat");
+        if (Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) {
+            writeLog(stacktrace, VLCApplication.getAppContext().getExternalFilesDir(null).getAbsolutePath()+"/vlc_crash");
+            writeLogcat(VLCApplication.getAppContext().getExternalFilesDir(null).getAbsolutePath()+"/vlc_logcat");
         }
 
         defaultUEH.uncaughtException(thread, ex);



More information about the Android mailing list