diff --git a/app/src/main/java/eu/faircode/email/Helper.java b/app/src/main/java/eu/faircode/email/Helper.java index 11635b2c5d..f73a4a21be 100644 --- a/app/src/main/java/eu/faircode/email/Helper.java +++ b/app/src/main/java/eu/faircode/email/Helper.java @@ -2645,7 +2645,7 @@ public class Helper { parent.mkdir(); File dir = new File(parent, subdir); - dir.mkdir(); + Log.jni_safe_mkdirs(dir); synchronized (exists) { if (exists.containsKey(dir)) diff --git a/app/src/main/java/eu/faircode/email/Log.java b/app/src/main/java/eu/faircode/email/Log.java index 9ff9fa20c3..d2775879d1 100644 --- a/app/src/main/java/eu/faircode/email/Log.java +++ b/app/src/main/java/eu/faircode/email/Log.java @@ -245,6 +245,8 @@ public class Log { public static native void jni_safe_write(OutputStream os, byte[] data); + public static native boolean jni_safe_mkdirs(File file); + public static native long[] jni_safe_runtime_stats(); public static void setLevel(Context context) { @@ -403,7 +405,6 @@ public class Log { return t.toSafeString() + "\n" + t.getSafeStackTraceString(); } - public static void persist(EntityLog.Type type, String message) { if (ctx == null) Log.e(message); @@ -1932,6 +1933,8 @@ public class Log { db.endTransaction(); } + Log.jni_safe_mkdirs(new File(context.getFilesDir(), "testing")); + ServiceSynchronize.eval(context, "debuginfo"); return draft; diff --git a/app/src/main/jni/fairemail.cc b/app/src/main/jni/fairemail.cc index 25ab83d299..0e0b6884ea 100644 --- a/app/src/main/jni/fairemail.cc +++ b/app/src/main/jni/fairemail.cc @@ -74,6 +74,14 @@ Java_eu_faircode_email_Log_jni_1safe_1write(JNIEnv *env, jclass clazz, env->CallVoidMethod(os, mid, data); } +extern "C" +JNIEXPORT jboolean JNICALL +Java_eu_faircode_email_Log_jni_1safe_1mkdirs(JNIEnv *env, jclass clazz, jobject file) { + jclass cls = env->FindClass("java/io/File"); + jmethodID mid = env->GetMethodID(cls, "mkdirs", "()Z"); + return (jboolean) env->CallBooleanMethod(file, mid); +} + extern "C" JNIEXPORT jlongArray JNICALL Java_eu_faircode_email_Log_jni_1safe_1runtime_1stats(JNIEnv *env, jclass clazz) {