Summary
MemoryLimiterIntegration currently recognizes MemoryLimiter process deaths only when ApplicationExitInfo.getReason() == REASON_OTHER and the description contains the MemoryLimiter: prefix.
Android 17 / API 37.2 added ApplicationExitInfo.REASON_MEMORY_LIMITER, and our integration does not account for it yet. That means newer platform versions can report a dedicated MemoryLimiter reason that we may fail to capture.
Relevant code:
sentry-android-core/src/main/java/io/sentry/android/core/MemoryLimiterIntegration.java
sentry-android-core/src/test/java/io/sentry/android/core/MemoryLimiterIntegrationTest.kt
Android reference:
Current Behavior
MemoryLimiterPolicy.matches(...) currently returns true only when:
exitInfo.getReason() == ApplicationExitInfo.REASON_OTHER
exitInfo.getDescription() contains MemoryLimiter:
Expected Behavior
MemoryLimiterIntegration should also recognize exits reported with ApplicationExitInfo.REASON_MEMORY_LIMITER.
We should preserve current behavior for existing REASON_OTHER + MemoryLimiter: records, since older platform behavior may still surface that combination.
Acceptance Criteria
- Update
MemoryLimiterPolicy.matches(...) to handle REASON_MEMORY_LIMITER in addition to the existing legacy path.
- Keep backward compatibility for older Android versions / SDK stubs where the new constant may not be available at compile or runtime.
- Add regression tests covering the dedicated MemoryLimiter reason.
- Verify existing tests around the legacy
REASON_OTHER path still pass.
Notes
The implementation may need to avoid directly referencing the new constant from older compile targets if that creates compatibility issues with our current Android SDK setup.
Summary
MemoryLimiterIntegrationcurrently recognizes MemoryLimiter process deaths only whenApplicationExitInfo.getReason() == REASON_OTHERand the description contains theMemoryLimiter:prefix.Android 17 / API 37.2 added
ApplicationExitInfo.REASON_MEMORY_LIMITER, and our integration does not account for it yet. That means newer platform versions can report a dedicated MemoryLimiter reason that we may fail to capture.Relevant code:
sentry-android-core/src/main/java/io/sentry/android/core/MemoryLimiterIntegration.javasentry-android-core/src/test/java/io/sentry/android/core/MemoryLimiterIntegrationTest.ktAndroid reference:
Current Behavior
MemoryLimiterPolicy.matches(...)currently returnstrueonly when:exitInfo.getReason() == ApplicationExitInfo.REASON_OTHERexitInfo.getDescription()containsMemoryLimiter:Expected Behavior
MemoryLimiterIntegrationshould also recognize exits reported withApplicationExitInfo.REASON_MEMORY_LIMITER.We should preserve current behavior for existing
REASON_OTHER+MemoryLimiter:records, since older platform behavior may still surface that combination.Acceptance Criteria
MemoryLimiterPolicy.matches(...)to handleREASON_MEMORY_LIMITERin addition to the existing legacy path.REASON_OTHERpath still pass.Notes
The implementation may need to avoid directly referencing the new constant from older compile targets if that creates compatibility issues with our current Android SDK setup.