Skip to content

Commit ea1caf5

Browse files
authored
Remove hard limit on Crashlytics payload size (#1439)
DataTransport SDK will support larger payloads going forward, and we will continue to iterate on more precise changes to reduce payload sizes in the future.
1 parent 4498fcc commit ea1caf5

File tree

2 files changed

+0
-38
lines changed

2 files changed

+0
-38
lines changed

firebase-crashlytics/src/androidTest/java/com/google/firebase/crashlytics/internal/send/DataTransportCrashlyticsReportSenderTest.java

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,6 @@
2020
import static org.mockito.ArgumentMatchers.any;
2121
import static org.mockito.Mockito.doAnswer;
2222
import static org.mockito.Mockito.mock;
23-
import static org.mockito.Mockito.never;
24-
import static org.mockito.Mockito.verify;
2523
import static org.mockito.Mockito.when;
2624

2725
import androidx.test.runner.AndroidJUnit4;
@@ -129,26 +127,6 @@ public void testSendReports_oneSuccessOneFail() throws Exception {
129127
assertEquals(ex, send2.getException());
130128
}
131129

132-
@Test
133-
public void testSendLargeReport_successfulWithoutSchedulingToDataTransport() throws Exception {
134-
doAnswer(callbackAnswer(null)).when(mockTransport).schedule(any(), any());
135-
136-
final CrashlyticsReportWithSessionId report = mockReportWithSessionId();
137-
138-
when(mockTransform.apply(report.getReport())).thenReturn(new byte[1024 * 1024]);
139-
140-
final Task<CrashlyticsReportWithSessionId> send = reportSender.sendReport(report);
141-
142-
try {
143-
Tasks.await(send);
144-
} catch (ExecutionException e) {
145-
// Allow this to fall through
146-
}
147-
148-
assertTrue(send.isSuccessful());
149-
verify(mockTransport, never()).schedule(any(), any());
150-
}
151-
152130
private static Answer<Void> callbackAnswer(Exception failure) {
153131
return (i) -> {
154132
final TransportScheduleCallback callback = i.getArgument(1);

firebase-crashlytics/src/main/java/com/google/firebase/crashlytics/internal/send/DataTransportCrashlyticsReportSender.java

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,6 @@
2424
import com.google.android.datatransport.runtime.TransportRuntime;
2525
import com.google.android.gms.tasks.Task;
2626
import com.google.android.gms.tasks.TaskCompletionSource;
27-
import com.google.android.gms.tasks.Tasks;
28-
import com.google.firebase.crashlytics.internal.Logger;
2927
import com.google.firebase.crashlytics.internal.common.CrashlyticsReportWithSessionId;
3028
import com.google.firebase.crashlytics.internal.model.CrashlyticsReport;
3129
import com.google.firebase.crashlytics.internal.model.serialization.CrashlyticsReportJsonTransform;
@@ -47,9 +45,6 @@ public class DataTransportCrashlyticsReportSender {
4745
private static final Transformer<CrashlyticsReport, byte[]> DEFAULT_TRANSFORM =
4846
(r) -> TRANSFORM.reportToJson(r).getBytes(Charset.forName("UTF-8"));
4947

50-
// Assumed limit of 1MB, with a little extra headroom
51-
private static final int MAX_DATATRANSPORT_BYTES = 1024 * 832;
52-
5348
private final Transport<CrashlyticsReport> transport;
5449
private final Transformer<CrashlyticsReport, byte[]> transportTransform;
5550

@@ -78,17 +73,6 @@ public Task<CrashlyticsReportWithSessionId> sendReport(
7873
@NonNull CrashlyticsReportWithSessionId reportWithSessionId) {
7974
final CrashlyticsReport report = reportWithSessionId.getReport();
8075

81-
// Workaround for b/152905875, impose a maximum size on reports.
82-
final int reportSize = transportTransform.apply(report).length;
83-
if (reportSize > MAX_DATATRANSPORT_BYTES) {
84-
Logger.getLogger()
85-
.d(
86-
String.format(
87-
"Report is too large to be sent via DataTransport. Maximum size is %d bytes. Report size is %d bytes. Removing report.",
88-
MAX_DATATRANSPORT_BYTES, reportSize));
89-
return Tasks.forResult(reportWithSessionId);
90-
}
91-
9276
TaskCompletionSource<CrashlyticsReportWithSessionId> tcs = new TaskCompletionSource<>();
9377
transport.schedule(
9478
Event.ofUrgent(report),

0 commit comments

Comments
 (0)