@@ -122,6 +122,12 @@ public AnrV2EventProcessor(
122122 return event ;
123123 }
124124
125+ // TODO: right now, any event with a Backfillable Hint will get here. This is fine if the
126+ // enrichment code is generically applicable to any Backfilling Event. However some parts
127+ // in the ANRv2EventProcessor are specific to ANRs and currently override the tombstone
128+ // events. Similar to the Integration we should find an abstraction split that allows to
129+ // separate the generic from the specific.
130+
125131 // we always set exception values, platform, os and device even if the ANR is not enrich-able
126132 // even though the OS context may change in the meantime (OS update), we consider this an
127133 // edge-case
@@ -255,6 +261,7 @@ private void setFingerprints(final @NotNull SentryEvent event, final @NotNull Ob
255261 // sentry does not yet have a capability to provide default server-side fingerprint rules,
256262 // so we're doing this on the SDK side to group background and foreground ANRs separately
257263 // even if they have similar stacktraces
264+ // TODO: this will always set the fingerprint of tombstones to foreground-anr
258265 final boolean isBackgroundAnr = isBackgroundAnr (hint );
259266 if (event .getFingerprints () == null ) {
260267 event .setFingerprints (
@@ -385,6 +392,8 @@ private void setApp(final @NotNull SentryBaseEvent event, final @NotNull Object
385392 // TODO: not entirely correct, because we define background ANRs as not the ones of
386393 // IMPORTANCE_FOREGROUND, but this doesn't mean the app was in foreground when an ANR happened
387394 // but it's our best effort for now. We could serialize AppState in theory.
395+
396+ // TODO: this will always be true of tombstones
388397 app .setInForeground (!isBackgroundAnr (hint ));
389398
390399 final PackageInfo packageInfo = ContextUtils .getPackageInfo (context , buildInfoProvider );
@@ -533,6 +542,9 @@ private void setStaticValues(final @NotNull SentryEvent event) {
533542 private void setPlatform (final @ NotNull SentryBaseEvent event ) {
534543 if (event .getPlatform () == null ) {
535544 // this actually means JVM related.
545+ // TODO: since we write this from the tombstone parser we are current unaffected. It is good
546+ // that it doesn't overwrite previous platform values, however we still rely on the
547+ // order in which each event processor was called.
536548 event .setPlatform (SentryBaseEvent .DEFAULT_PLATFORM );
537549 }
538550 }
@@ -564,12 +576,16 @@ private void setExceptions(final @NotNull SentryEvent event, final @NotNull Obje
564576 // and make an exception out of its stacktrace
565577 final Mechanism mechanism = new Mechanism ();
566578 if (!((Backfillable ) hint ).shouldEnrich ()) {
579+ // TODO: this currently overrides the signalhandler mechanism we set in the TombstoneParser
580+ // with a new type (can be the right choice down the road, but currently is
581+ // unintentional, and it might be better to leave it close to the Native SDK)
567582 // we only enrich the latest ANR in the list, so this is historical
568583 mechanism .setType ("HistoricalAppExitInfo" );
569584 } else {
570585 mechanism .setType ("AppExitInfo" );
571586 }
572587
588+ // TODO: this currently overrides the tombstone exceptions
573589 final boolean isBackgroundAnr = isBackgroundAnr (hint );
574590 String message = "ANR" ;
575591 if (isBackgroundAnr ) {
0 commit comments