Repository navigation
fix(android): Detect startup crashes on the boottime clock - #6738
Merged
Merged
Conversation
Contributor
PR risk: mediumFor commit Main concerns: public contract, host performance, reach. Rules that block low also fired:
This label is a hint for reviewers, not an approval. |
📲 Install BuildsAndroid
|
runningcode
commented
Nov 23, 2026
runningcode
marked this pull request as ready for review
November 23, 2026 10:34
runningcode
requested review from
0xadam-brown and
romtsn
and removed request for
a team
November 23, 2026 10:34
runningcode
force-pushed
the
no/java-729-startup-crash-ticker
branch
from
November 25, 2026 12:45
7e7a282 to
081b698
Compare
runningcode
force-pushed
the
no/java-729-startup-crash-ticker
branch
from
November 25, 2026 15:07
081b698 to
3a20dd8
Compare
romtsn
reviewed
Nov 25, 2026
romtsn
approved these changes
Nov 25, 2026
romtsn
left a comment
Contributor
There was a problem hiding this comment.
one test needs hardening perhaps, LGTM otherwise!
Startup crash detection measured the time since SDK init with SystemClock.uptimeMillis(), which stops while the device is in deep sleep. A crash long after init, with sleep in between, could fall under the threshold and be marked as a startup crash. Both SDK init entry points now also start a Stopwatch on the MonotonicTicker, which counts deep sleep, and AndroidEnvelopeCache reads that. The TimeSpan stays on uptime because changing its base is a v9 decision. This removes the last production use of AndroidCurrentDateProvider; the class itself goes away in v9. Fixes JAVA-729 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Advancing a test ticker can't tell a boottime clock from an uptime clock. Run the real AndroidMonotonicTicker through Robolectric's simulated deep sleep, which an uptime-based check would miss. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
runningcode
force-pushed
the
no/java-729-startup-crash-ticker
branch
from
November 26, 2026 07:50
54965d7 to
a0dea82
Compare
runningcode
enabled auto-merge (squash)
November 26, 2026 08:05
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
📜 Description
Startup crash detection now measures the time since SDK init on the
MonotonicTicker(CLOCK_BOOTTIME), notSystemClock.uptimeMillis().Both SDK init entry points (
SentryPerformanceProviderandSentryAndroid) now start aStopwatchwhen their class loads. This happens next to the existingsdkInitMillis, andAppStartMetricsstores theStopwatchwith the same "first one wins" rule assdkInitTimeSpan.AndroidEnvelopeCachereads it.TimeSpanstays on uptime because changing its base is a v9 decision (JAVA-827). This was the last production use ofAndroidCurrentDateProvider. The class itself is deleted in v9.💡 Motivation and Context
Uptime stops during deep sleep. So a crash long after init could fall under
startupCrashDurationThresholdMillisif the device slept in between, and it would be marked as a startup crash.💚 How did you test it?
Unit tests use
TestMonotonicTicker. They include a test where the ticker jumps 5 hours, which an uptime clock would have left out.📝 Checklist
sendDefaultPIIis enabled.🔮 Next steps
Delete
AndroidCurrentDateProviderin v9 (JAVA-827).🤖 Generated with Claude Code