Search in sources :

Example 6 with CrashlyticsReport

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();
}
Also used : TaskCompletionSource(com.google.android.gms.tasks.TaskCompletionSource) CrashlyticsReport(com.google.firebase.crashlytics.internal.model.CrashlyticsReport) CrashlyticsReportWithSessionId(com.google.firebase.crashlytics.internal.common.CrashlyticsReportWithSessionId) NonNull(androidx.annotation.NonNull)

Example 7 with CrashlyticsReport

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);
}
Also used : CrashlyticsReport(com.google.firebase.crashlytics.internal.model.CrashlyticsReport)

Example 8 with CrashlyticsReport

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);
    }
}
Also used : CrashlyticsReport(com.google.firebase.crashlytics.internal.model.CrashlyticsReport) IOException(java.io.IOException) File(java.io.File) Session(com.google.firebase.crashlytics.internal.model.CrashlyticsReport.Session)

Example 9 with CrashlyticsReport

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);
    }
}
Also used : CrashlyticsReport(com.google.firebase.crashlytics.internal.model.CrashlyticsReport) IOException(java.io.IOException)

Example 10 with CrashlyticsReport

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());
}
Also used : CrashlyticsReport(com.google.firebase.crashlytics.internal.model.CrashlyticsReport) Test(org.junit.Test)

Aggregations

CrashlyticsReport (com.google.firebase.crashlytics.internal.model.CrashlyticsReport)34 CrashlyticsReportWithSessionId (com.google.firebase.crashlytics.internal.common.CrashlyticsReportWithSessionId)13 Session (com.google.firebase.crashlytics.internal.model.CrashlyticsReport.Session)13 Event (com.google.firebase.crashlytics.internal.model.CrashlyticsReport.Session.Event)13 IOException (java.io.IOException)8 File (java.io.File)6 Test (org.junit.Test)5 Logger (com.google.firebase.crashlytics.internal.Logger)4 NonNull (androidx.annotation.NonNull)2 TaskCompletionSource (com.google.android.gms.tasks.TaskCompletionSource)2 ArrayList (java.util.ArrayList)2 JsonReader (android.util.JsonReader)1 Settings (com.google.firebase.crashlytics.internal.settings.Settings)1 FeatureFlagData (com.google.firebase.crashlytics.internal.settings.Settings.FeatureFlagData)1 SettingsProvider (com.google.firebase.crashlytics.internal.settings.SettingsProvider)1 StringReader (java.io.StringReader)1