use of com.google.firebase.crashlytics.internal.model.CrashlyticsReport.Session in project firebase-android-sdk by firebase.
the class CrashlyticsReportPersistence method synthesizeReportFile.
private void synthesizeReportFile(@NonNull File reportFile, @NonNull List<Event> events, long sessionEndTime, boolean isHighPriorityReport, @Nullable String userId) {
try {
CrashlyticsReport report = TRANSFORM.reportFromJson(readTextFile(reportFile)).withSessionEndFields(sessionEndTime, isHighPriorityReport, userId).withEvents(ImmutableList.from(events));
final Session session = report.getSession();
if (session == null) {
// This shouldn't happen, but is a valid state for NDK-based reports
return;
}
File finalizedReportFile = isHighPriorityReport ? fileStore.getPriorityReport(session.getIdentifier()) : fileStore.getReport(session.getIdentifier());
writeTextFile(finalizedReportFile, TRANSFORM.reportToJson(report));
} catch (IOException e) {
Logger.getLogger().w("Could not synthesize final report file for " + reportFile, e);
}
}
use of com.google.firebase.crashlytics.internal.model.CrashlyticsReport.Session in project firebase-android-sdk by firebase.
the class CrashlyticsReportPersistence method persistReport.
public void persistReport(@NonNull CrashlyticsReport report) {
final Session session = report.getSession();
if (session == null) {
Logger.getLogger().d("Could not get session for report");
return;
}
final String sessionId = session.getIdentifier();
try {
final String json = TRANSFORM.reportToJson(report);
writeTextFile(fileStore.getSessionFile(sessionId, REPORT_FILE_NAME), json);
writeTextFile(fileStore.getSessionFile(sessionId, SESSION_START_TIMESTAMP_FILE_NAME), "", session.getStartedAt());
} catch (IOException e) {
Logger.getLogger().d("Could not persist report for session " + sessionId, e);
}
}
Aggregations