Title: Deprecate AndroidCurrentDateProvider in favor of MonotonicTicker · Issue #6102 · getsentry/sentry-java · GitHub
Open Graph Title: Deprecate AndroidCurrentDateProvider in favor of MonotonicTicker · Issue #6102 · getsentry/sentry-java
X Title: Deprecate AndroidCurrentDateProvider in favor of MonotonicTicker · Issue #6102 · getsentry/sentry-java
Description: AndroidCurrentDateProvider is a hazard and should carry a deprecation warning pointing at MonotonicTicker. Why it is a hazard It implements ICurrentDateProvider.getCurrentTimeMillis() with SystemClock.uptimeMillis() — sentry-android-core...
Open Graph Description: AndroidCurrentDateProvider is a hazard and should carry a deprecation warning pointing at MonotonicTicker. Why it is a hazard It implements ICurrentDateProvider.getCurrentTimeMillis() with SystemCl...
X Description: AndroidCurrentDateProvider is a hazard and should carry a deprecation warning pointing at MonotonicTicker. Why it is a hazard It implements ICurrentDateProvider.getCurrentTimeMillis() with SystemCl...
Opengraph URL: https://github.com/getsentry/sentry-java/issues/6102
X: @github
Domain: github.com
IPv4 address: 140.82.112.4
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Deprecate AndroidCurrentDateProvider in favor of MonotonicTicker","articleBody":"`AndroidCurrentDateProvider` is a hazard and should carry a deprecation warning pointing at `MonotonicTicker`.\n\n## Why it is a hazard\n\nIt implements `ICurrentDateProvider.getCurrentTimeMillis()` with `SystemClock.uptimeMillis()` — `sentry-android-core/src/main/java/io/sentry/android/core/internal/util/AndroidCurrentDateProvider.java:20`. Two problems, neither visible at a call site:\n\n1. **The name lies.** It is not a current date. A field or parameter declared `ICurrentDateProvider` accepts this *or* `CurrentDateProvider` (`System.currentTimeMillis()`, epoch). The two disagree by however long the device has been suspended, and a wrong wiring compiles silently.\n2. `uptimeMillis()` **stops in deep sleep.** Any interval measured with it under-reports real elapsed time, so a window looks un-expired long after it actually expired.\n\n`MonotonicTicker` is the replacement: `CLOCK_BOOTTIME` via `SystemClock.elapsedRealtimeNanos()` on Android, no epoch pretense in the name, and it documents that only differences between two of its own ticks are meaningful.\n\n## Scope\n\nDeprecate only, in one independent PR. Nothing is migrated and nothing is removed — the point is to start the warning cycle.\n\nThe annotation goes on `getInstance()`, not on the type. `build.gradle.kts:107` sets `-Xlint:all -Werror` and the Android modules compile at `sourceCompatibility 1.8`, where javac still warns on an `import` of a deprecated type (JEP 211 elides those only from source 9 on) and an import declaration cannot carry a `@SuppressWarnings`. Deprecating the sole factory method warns every caller just as loudly, and each warning lands somewhere a suppression can go. The type javadoc still names the replacement.\n\nThe five internal call sites get `@SuppressWarnings(\"deprecation\")` to keep `-Werror` green:\n\n* `ViewHierarchyEventProcessor.java:53`, `ScreenshotEventProcessor.java:59`, `SystemEventsBreadcrumbsIntegration.java:302`, `AppComponentsBreadcrumbsIntegration.java:38` — all constructing `Debouncer`\n* `AndroidEnvelopeCache.java:42`\n\n## Relationship to other work\n\nPR getsentry/sentry-java#6043 (getsentry/sentry-java#5574, draft) deprecates this class as one row of a five-row batch that also covers `ICurrentDateProvider`, `CurrentDateProvider`, `DateUtils.getCurrentDateTime()` and `AndroidDateUtils.getCurrentSentryDateTime()`, stacked behind six other PRs. This issue pulls the `AndroidCurrentDateProvider` row out so it can land on its own.\n\nMigrating the call sites off the deprecated provider is deliberately **not** in scope here and needs its own issue. Note that `AndroidEnvelopeCache:75` cannot be migrated in isolation: it subtracts `TimeSpan.getStartUptimeMs()`, and `TimeSpan` is explicitly built on `SystemClock.uptimeMillis()` (`performance/TimeSpan.java:14`), so moving one operand alone would subtract two different clock bases.","author":{"url":"https://github.com/runningcode","@type":"Person","name":"runningcode"},"datePublished":"2026-09-11T15:26:01Z","url":"https://github.com/getsentry/sentry-java/issues/6102"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:bff96ac5-18a5-2294-e1d4-4a9caf44872a |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | D012:3C90A4:4642A5:62E6CF:6B0470B7 |
| html-safe-nonce | f1d3ec450d137e288b8773ff643b08e4c8131c969873893508f7744fb1e38729 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEMDEyOjNDOTBBNDo0NjQyQTU6NjJFNkNGOjZCMDQ3MEI3IiwidmlzaXRvcl9pZCI6IjExNDg1OTc1MzUxOTIxNTAxOTkiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | c6cc78039547bbc57e1cf5b61425452f85665de34af0b0c29d8b4e0efe1532e5 |
| hovercard-subject-tag | issue:5426047590 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/getsentry/sentry-java/6102/issue_layout |
| twitter:image | https://opengraph.githubassets.com/65e5e086370c66555f4ec6a088dbbda196ea2359da5794c7c92984a76ce6a437/getsentry/sentry-java/issues/6102 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/65e5e086370c66555f4ec6a088dbbda196ea2359da5794c7c92984a76ce6a437/getsentry/sentry-java/issues/6102 |
| og:image:alt | AndroidCurrentDateProvider is a hazard and should carry a deprecation warning pointing at MonotonicTicker. Why it is a hazard It implements ICurrentDateProvider.getCurrentTimeMillis() with SystemCl... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | runningcode |
| hostname | github.com |
| expected-hostname | github.com |
| None | ae8802492f12d3ba4f6b0d814054e617a2a5616b6327bf8555c10cd5b0dc2a6f |
| turbo-cache-control | no-preview |
| go-import | github.com/getsentry/sentry-java git https://github.com/getsentry/sentry-java.git |
| octolytics-dimension-user_id | 1396951 |
| octolytics-dimension-user_login | getsentry |
| octolytics-dimension-repository_id | 3368190 |
| octolytics-dimension-repository_nwo | getsentry/sentry-java |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 3368190 |
| octolytics-dimension-repository_network_root_nwo | getsentry/sentry-java |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | cfb5f24c6e01d85f70804652a5107e5cac03a161 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | max-age=0, private, must-revalidate |
Viewport: width=device-width