Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 72768ed9 authored by Andreas Gampe's avatar Andreas Gampe
Browse files

Frameworks: Add fdatasync after dumping a trace

Ensure that data hits storage when dumping.

Bug: 133525168
Test: m
Test: manual (induce ANRs with various platform changes)
Merged-In: I66eac0c5e77ea98ba1777d0803b35f38d9ca648f
Change-Id: I66eac0c5e77ea98ba1777d0803b35f38d9ca648f
parent fa178e14
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -717,7 +717,11 @@ static bool dumpTraces(JNIEnv* env, jint pid, jstring fileName, jint timeoutSecs
        return false;
    }

    return (dump_backtrace_to_file_timeout(pid, dumpType, timeoutSecs, fd) == 0);
    int res = dump_backtrace_to_file_timeout(pid, dumpType, timeoutSecs, fd);
    if (fdatasync(fd.get()) != 0) {
        PLOG(ERROR) << "Failed flushing trace.";
    }
    return res == 0;
}

static jboolean android_os_Debug_dumpJavaBacktraceToFileTimeout(JNIEnv* env, jobject clazz,