Skip remove exceptions when reporting crash

pull/125/head
M66B 6 years ago
parent 96756858e5
commit 2f23f0bbda

@ -23,6 +23,7 @@ import android.app.Application;
import android.app.Notification; import android.app.Notification;
import android.app.NotificationChannel; import android.app.NotificationChannel;
import android.app.NotificationManager; import android.app.NotificationManager;
import android.os.RemoteException;
import android.util.Log; import android.util.Log;
import java.io.File; import java.io.File;
@ -41,23 +42,25 @@ public class ApplicationEx extends Application {
Thread.setDefaultUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() { Thread.setDefaultUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() {
@Override @Override
public void uncaughtException(Thread thread, Throwable ex) { public void uncaughtException(Thread thread, Throwable ex) {
Log.e(Helper.TAG, ex + "\r\n" + Log.getStackTraceString(ex)); if (!(ex instanceof RemoteException) /* DeadSystemException */) {
Log.e(Helper.TAG, ex + "\r\n" + Log.getStackTraceString(ex));
File file = new File(getCacheDir(), "crash.log");
Log.w(Helper.TAG, "Writing exception to " + file); File file = new File(getCacheDir(), "crash.log");
Log.w(Helper.TAG, "Writing exception to " + file);
FileWriter out = null;
try { FileWriter out = null;
out = new FileWriter(file); try {
out.write(ex.toString() + "\n" + Log.getStackTraceString(ex)); out = new FileWriter(file);
} catch (IOException e) { out.write(ex.toString() + "\n" + Log.getStackTraceString(ex));
Log.e(Helper.TAG, e + "\n" + Log.getStackTraceString(e)); } catch (IOException e) {
} finally { Log.e(Helper.TAG, e + "\n" + Log.getStackTraceString(e));
if (out != null) { } finally {
try { if (out != null) {
out.close(); try {
} catch (IOException e) { out.close();
Log.e(Helper.TAG, e + "\n" + Log.getStackTraceString(e)); } catch (IOException e) {
Log.e(Helper.TAG, e + "\n" + Log.getStackTraceString(e));
}
} }
} }
} }

Loading…
Cancel
Save