Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## Unreleased

### Features

- Support the `io.sentry.tombstone.report-historical` manifest option to enable historical tombstone reporting via `AndroidManifest.xml` `<meta-data>` ([#5683](https://github.com/getsentry/sentry-java/pull/5683))

## 8.47.0

### Behavioral Changes
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ final class ManifestMetadataReader {

static final String TOMBSTONE_ENABLE = "io.sentry.tombstone.enable";
static final String TOMBSTONE_ATTACH_RAW = "io.sentry.tombstone.attach-raw";
static final String TOMBSTONE_REPORT_HISTORICAL = "io.sentry.tombstone.report-historical";

static final String AUTO_INIT = "io.sentry.auto-init";
static final String NDK_ENABLE = "io.sentry.ndk.enable";
Expand Down Expand Up @@ -232,6 +233,12 @@ static void applyMetadata(
readBool(metadata, logger, TOMBSTONE_ENABLE, options.isTombstoneEnabled()));
options.setAttachRawTombstone(
readBool(metadata, logger, TOMBSTONE_ATTACH_RAW, options.isAttachRawTombstone()));
options.setReportHistoricalTombstones(
readBool(
metadata,
logger,
TOMBSTONE_REPORT_HISTORICAL,
options.isReportHistoricalTombstones()));

// use enableAutoSessionTracking as fallback
options.setEnableAutoSessionTracking(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,56 @@ class ManifestMetadataReaderTest {
assertEquals(false, fixture.options.isAttachRawTombstone)
}

@Test
fun `applyMetadata reads tombstone enable to options`() {
// Arrange
val bundle = bundleOf(ManifestMetadataReader.TOMBSTONE_ENABLE to true)
val context = fixture.getContext(metaData = bundle)

// Act
ManifestMetadataReader.applyMetadata(context, fixture.options, fixture.buildInfoProvider)

// Assert
assertEquals(true, fixture.options.isTombstoneEnabled)
}

@Test
fun `applyMetadata reads tombstone enable to options and keeps default`() {
// Arrange
val context = fixture.getContext()

// Act
ManifestMetadataReader.applyMetadata(context, fixture.options, fixture.buildInfoProvider)

// Assert
assertEquals(false, fixture.options.isTombstoneEnabled)
}

@Test
fun `applyMetadata reads tombstone report historical to options`() {
// Arrange
val bundle = bundleOf(ManifestMetadataReader.TOMBSTONE_REPORT_HISTORICAL to true)
val context = fixture.getContext(metaData = bundle)

// Act
ManifestMetadataReader.applyMetadata(context, fixture.options, fixture.buildInfoProvider)

// Assert
assertEquals(true, fixture.options.isReportHistoricalTombstones)
}

@Test
fun `applyMetadata reads tombstone report historical to options and keeps default`() {
// Arrange
val context = fixture.getContext()

// Act
ManifestMetadataReader.applyMetadata(context, fixture.options, fixture.buildInfoProvider)

// Assert
assertEquals(false, fixture.options.isReportHistoricalTombstones)
}

@Test
fun `applyMetadata reads anr report historical to options`() {
// Arrange
Expand Down
Loading