use of com.google.firebase.crashlytics.internal.model.CrashlyticsReport in project firebase-android-sdk by firebase.
the class DataTransportCrashlyticsReportSender method sendReport.
@NonNull
public Task<CrashlyticsReportWithSessionId> sendReport(@NonNull CrashlyticsReportWithSessionId reportWithSessionId) {
final CrashlyticsReport report = reportWithSessionId.getReport();
TaskCompletionSource<CrashlyticsReportWithSessionId> tcs = new TaskCompletionSource<>();
transport.schedule(Event.ofUrgent(report), error -> {
if (error != null) {
tcs.trySetException(error);
return;
}
tcs.trySetResult(reportWithSessionId);
});
return tcs.getTask();
}
use of com.google.firebase.crashlytics.internal.model.CrashlyticsReport in project firebase-android-sdk by firebase.
the class SessionReportingCoordinator method onBeginSession.
@Override
public void onBeginSession(@NonNull String sessionId, long timestampSeconds) {
final CrashlyticsReport capturedReport = dataCapture.captureReportData(sessionId, timestampSeconds);
reportPersistence.persistReport(capturedReport);
}
use of com.google.firebase.crashlytics.internal.model.CrashlyticsReport 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 in project firebase-android-sdk by firebase.
the class CrashlyticsReportPersistence method synthesizeNativeReportFile.
private void synthesizeNativeReportFile(@NonNull File reportFile, @NonNull CrashlyticsReport.FilesPayload ndkPayload, @NonNull String previousSessionId) {
try {
final CrashlyticsReport report = TRANSFORM.reportFromJson(readTextFile(reportFile)).withNdkPayload(ndkPayload);
writeTextFile(fileStore.getNativeReport(previousSessionId), TRANSFORM.reportToJson(report));
} catch (IOException e) {
Logger.getLogger().w("Could not synthesize final native report file for " + reportFile, e);
}
}
use of com.google.firebase.crashlytics.internal.model.CrashlyticsReport in project firebase-android-sdk by firebase.
the class CrashlyticsReportDataCaptureTest method testCaptureReport_containsNoDeveloperPlatformFieldsWhenUnityIsMissing.
@Test
public void testCaptureReport_containsNoDeveloperPlatformFieldsWhenUnityIsMissing() throws Exception {
when(developmentPlatformProvider.getDevelopmentPlatform()).thenReturn(null);
initDataCapture();
final CrashlyticsReport report = dataCapture.captureReportData("sessionId", 0);
assertNotNull(report.getSession());
assertNull(report.getSession().getApp().getDevelopmentPlatform());
assertNull(report.getSession().getApp().getDevelopmentPlatformVersion());
}
Aggregations