Skip to content

Commit 9e69d52

Browse files
authored
Remove organization ID from DataTransport payloads (#1411)
No longer necessary due to backend upgrades
1 parent d0c06ca commit 9e69d52

File tree

3 files changed

+15
-46
lines changed

3 files changed

+15
-46
lines changed

firebase-crashlytics/src/androidTest/java/com/google/firebase/crashlytics/internal/common/SessionReportingCoordinatorTest.java

Lines changed: 10 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -360,13 +360,12 @@ public void onSessionsFinalize_finalizesReports() {
360360
@Test
361361
@SuppressWarnings("unchecked")
362362
public void onReportSend_successfulReportsAreDeleted() {
363-
final String orgId = "testOrgId";
364363
final String sessionId1 = "sessionId1";
365364
final String sessionId2 = "sessionId2";
366365

367366
final List<CrashlyticsReportWithSessionId> finalizedReports = new ArrayList<>();
368-
final CrashlyticsReportWithSessionId mockReport1 = mockReportWithSessionId(sessionId1, orgId);
369-
final CrashlyticsReportWithSessionId mockReport2 = mockReportWithSessionId(sessionId2, orgId);
367+
final CrashlyticsReportWithSessionId mockReport1 = mockReportWithSessionId(sessionId1);
368+
final CrashlyticsReportWithSessionId mockReport2 = mockReportWithSessionId(sessionId2);
370369
finalizedReports.add(mockReport1);
371370
finalizedReports.add(mockReport2);
372371

@@ -379,7 +378,7 @@ public void onReportSend_successfulReportsAreDeleted() {
379378
when(reportSender.sendReport(mockReport1)).thenReturn(successfulTask);
380379
when(reportSender.sendReport(mockReport2)).thenReturn(failedTask);
381380

382-
reportManager.sendReports(orgId, Runnable::run, DataTransportState.ALL);
381+
reportManager.sendReports(Runnable::run, DataTransportState.ALL);
383382

384383
verify(reportSender).sendReport(mockReport1);
385384
verify(reportSender).sendReport(mockReport2);
@@ -390,7 +389,7 @@ public void onReportSend_successfulReportsAreDeleted() {
390389

391390
@Test
392391
public void onReportSend_reportsAreDeletedWithoutBeingSent_whenDataTransportStateNone() {
393-
reportManager.sendReports("testOrgId", Runnable::run, DataTransportState.NONE);
392+
reportManager.sendReports(Runnable::run, DataTransportState.NONE);
394393

395394
verify(reportPersistence).deleteAllReports();
396395
verify(reportPersistence, never()).loadFinalizedReports();
@@ -401,15 +400,13 @@ public void onReportSend_reportsAreDeletedWithoutBeingSent_whenDataTransportStat
401400
@Test
402401
public void
403402
onReportSend_javaReportsAreSentNativeReportsDeletedWithoutBeingSent_whenDataTransportStateJavaOnly() {
404-
final String orgId = "testOrgId";
405403
final String sessionIdJava = "sessionIdJava";
406404
final String sessionIdNative = "sessionIdNative";
407405

408406
final List<CrashlyticsReportWithSessionId> finalizedReports = new ArrayList<>();
409-
final CrashlyticsReportWithSessionId mockReportJava =
410-
mockReportWithSessionId(sessionIdJava, orgId);
407+
final CrashlyticsReportWithSessionId mockReportJava = mockReportWithSessionId(sessionIdJava);
411408
final CrashlyticsReportWithSessionId mockReportNative =
412-
mockReportWithSessionId(sessionIdNative, orgId);
409+
mockReportWithSessionId(sessionIdNative);
413410
finalizedReports.add(mockReportJava);
414411
finalizedReports.add(mockReportNative);
415412

@@ -420,7 +417,7 @@ public void onReportSend_reportsAreDeletedWithoutBeingSent_whenDataTransportStat
420417

421418
when(reportSender.sendReport(mockReportJava)).thenReturn(Tasks.forResult(mockReportJava));
422419

423-
reportManager.sendReports(orgId, Runnable::run, DataTransportState.JAVA_ONLY);
420+
reportManager.sendReports(Runnable::run, DataTransportState.JAVA_ONLY);
424421

425422
verify(reportSender).sendReport(mockReportJava);
426423
verify(reportSender, never()).sendReport(mockReportNative);
@@ -450,17 +447,6 @@ public void testRemoveAllReports_deletesPersistedReports() {
450447
verify(reportPersistence).deleteAllReports();
451448
}
452449

453-
private static CrashlyticsReport makeIncompleteReport() {
454-
return CrashlyticsReport.builder()
455-
.setSdkVersion("sdkVersion")
456-
.setGmpAppId("gmpAppId")
457-
.setPlatform(1)
458-
.setInstallationUuid("installationId")
459-
.setBuildVersion("1")
460-
.setDisplayVersion("1.0.0")
461-
.build();
462-
}
463-
464450
private void mockEventInteractions() {
465451
when(mockEvent.toBuilder()).thenReturn(mockEventBuilder);
466452
when(mockEventBuilder.build()).thenReturn(mockEvent);
@@ -479,17 +465,15 @@ private void mockEventInteractions() {
479465
.thenReturn(mockEvent);
480466
}
481467

482-
private static CrashlyticsReport mockReport(String sessionId, String orgId) {
468+
private static CrashlyticsReport mockReport(String sessionId) {
483469
final CrashlyticsReport mockReport = mock(CrashlyticsReport.class);
484470
final CrashlyticsReport.Session mockSession = mock(CrashlyticsReport.Session.class);
485471
when(mockSession.getIdentifier()).thenReturn(sessionId);
486472
when(mockReport.getSession()).thenReturn(mockSession);
487-
when(mockReport.withOrganizationId(orgId)).thenReturn(mockReport);
488473
return mockReport;
489474
}
490475

491-
private static CrashlyticsReportWithSessionId mockReportWithSessionId(
492-
String sessionId, String orgId) {
493-
return CrashlyticsReportWithSessionId.create(mockReport(sessionId, orgId), sessionId);
476+
private static CrashlyticsReportWithSessionId mockReportWithSessionId(String sessionId) {
477+
return CrashlyticsReportWithSessionId.create(mockReport(sessionId), sessionId);
494478
}
495479
}

firebase-crashlytics/src/main/java/com/google/firebase/crashlytics/internal/common/CrashlyticsController.java

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -436,9 +436,7 @@ public Task<Void> then(@Nullable AppSettingsData appSettingsData)
436436
boolean dataCollectionToken = true;
437437
sendSessionReports(appSettingsData, dataCollectionToken);
438438
reportingCoordinator.sendReports(
439-
appSettingsData.organizationId,
440-
executor,
441-
DataTransportState.getState(appSettingsData));
439+
executor, DataTransportState.getState(appSettingsData));
442440
return recordFatalFirebaseEventTask;
443441
}
444442
});
@@ -596,9 +594,7 @@ public Task<Void> then(@Nullable AppSettingsData appSettingsData)
596594
reportUploaderProvider.createReportUploader(appSettingsData);
597595
uploader.uploadReportsAsync(reports, dataCollectionToken, delay);
598596
reportingCoordinator.sendReports(
599-
appSettingsData.organizationId,
600-
executor,
601-
DataTransportState.getState(appSettingsData));
597+
executor, DataTransportState.getState(appSettingsData));
602598
unsentReportsHandled.trySetResult(null);
603599

604600
return Tasks.forResult(null);

firebase-crashlytics/src/main/java/com/google/firebase/crashlytics/internal/common/SessionReportingCoordinator.java

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -166,13 +166,11 @@ public void removeAllReports() {
166166
/**
167167
* Send all finalized reports.
168168
*
169-
* @param organizationId The organization ID this crash report should be associated with
170169
* @param reportSendCompleteExecutor executor on which to run report cleanup after each report is
171170
* sent.
172171
* @param dataTransportState used to determine whether to send the report before cleaning it up.
173172
*/
174173
public void sendReports(
175-
@Nullable String organizationId,
176174
@NonNull Executor reportSendCompleteExecutor,
177175
@NonNull DataTransportState dataTransportState) {
178176
if (dataTransportState == DataTransportState.NONE) {
@@ -182,24 +180,15 @@ public void sendReports(
182180
}
183181
final List<CrashlyticsReportWithSessionId> reportsToSend =
184182
reportPersistence.loadFinalizedReports();
185-
for (CrashlyticsReportWithSessionId reportWithSessionId : reportsToSend) {
186-
if (reportWithSessionId.getReport().getType() == CrashlyticsReport.Type.NATIVE
183+
for (CrashlyticsReportWithSessionId reportToSend : reportsToSend) {
184+
if (reportToSend.getReport().getType() == CrashlyticsReport.Type.NATIVE
187185
&& dataTransportState != DataTransportState.ALL) {
188186
Logger.getLogger()
189187
.d("Send native reports via DataTransport disabled. Removing DataTransport reports.");
190-
reportPersistence.deleteFinalizedReport(reportWithSessionId.getSessionId());
188+
reportPersistence.deleteFinalizedReport(reportToSend.getSessionId());
191189
continue;
192190
}
193191

194-
// When an organization ID is available, hydrate the underlying report with it, otherwise pass
195-
// through.
196-
final CrashlyticsReportWithSessionId reportToSend =
197-
(organizationId == null)
198-
? reportWithSessionId
199-
: CrashlyticsReportWithSessionId.create(
200-
reportWithSessionId.getReport().withOrganizationId(organizationId),
201-
reportWithSessionId.getSessionId());
202-
203192
reportsSender
204193
.sendReport(reportToSend)
205194
.continueWith(reportSendCompleteExecutor, this::onReportSendComplete);

0 commit comments

Comments
 (0)