From 5b049ea6ef7930d330b7f40a6fa368dbbdc5b454 Mon Sep 17 00:00:00 2001 From: Nelson Osacky Date: Fri, 11 Sep 2026 17:32:54 +0200 Subject: [PATCH 1/6] ref(android): Deprecate AndroidCurrentDateProvider (JAVA-728) AndroidCurrentDateProvider.getCurrentTimeMillis() is SystemClock.uptimeMillis(): not a date, and not a clock that counts deep sleep. Neither the name nor the ICurrentDateProvider type says so, and CurrentDateProvider implements that same interface with epoch milliseconds, so a call site declaring the interface accepts either and the two disagree by however long the device has been suspended. MonotonicTicker names the guarantee it gives and keeps counting through deep sleep. The annotation goes on getInstance() rather than on the type. The Android modules compile at Java 8, where javac still warns on an import of a deprecated type, and an import declaration cannot carry a @SuppressWarnings. Deprecating the sole factory method warns every caller just the same, and each warning lands somewhere a suppression can go. Nothing is migrated and nothing is removed. The five suppressed call sites are the migration list. AndroidEnvelopeCache cannot move on its own: it subtracts TimeSpan.getStartUptimeMs(), which is SystemClock.uptimeMillis() too, so moving one operand alone would subtract two different clock bases. Co-Authored-By: Claude Opus 5 (1M context) --- .../core/AppComponentsBreadcrumbsIntegration.java | 2 ++ .../android/core/ScreenshotEventProcessor.java | 2 ++ .../core/SystemEventsBreadcrumbsIntegration.java | 3 +++ .../android/core/ViewHierarchyEventProcessor.java | 2 ++ .../android/core/cache/AndroidEnvelopeCache.java | 3 +++ .../internal/util/AndroidCurrentDateProvider.java | 14 ++++++++++++++ 6 files changed, 26 insertions(+) diff --git a/sentry-android-core/src/main/java/io/sentry/android/core/AppComponentsBreadcrumbsIntegration.java b/sentry-android-core/src/main/java/io/sentry/android/core/AppComponentsBreadcrumbsIntegration.java index 43ed3422cd9..48b8125f1ab 100644 --- a/sentry-android-core/src/main/java/io/sentry/android/core/AppComponentsBreadcrumbsIntegration.java +++ b/sentry-android-core/src/main/java/io/sentry/android/core/AppComponentsBreadcrumbsIntegration.java @@ -34,6 +34,8 @@ public final class AppComponentsBreadcrumbsIntegration private @Nullable IScopes scopes; private @Nullable SentryAndroidOptions options; + // Debouncer measures on the uptime clock; moving it to MonotonicTicker changes behavior. + @SuppressWarnings("deprecation") private final @NotNull Debouncer trimMemoryDebouncer = new Debouncer(AndroidCurrentDateProvider.getInstance(), DEBOUNCE_WAIT_TIME_MS, 0); diff --git a/sentry-android-core/src/main/java/io/sentry/android/core/ScreenshotEventProcessor.java b/sentry-android-core/src/main/java/io/sentry/android/core/ScreenshotEventProcessor.java index dd0e259f937..afc392bf16c 100644 --- a/sentry-android-core/src/main/java/io/sentry/android/core/ScreenshotEventProcessor.java +++ b/sentry-android-core/src/main/java/io/sentry/android/core/ScreenshotEventProcessor.java @@ -47,6 +47,8 @@ public final class ScreenshotEventProcessor implements EventProcessor { private final boolean isReplayAvailable; private final AtomicBoolean isReplayModuleAbsenceLogged = new AtomicBoolean(false); + // Debouncer measures on the uptime clock; moving it to MonotonicTicker changes behavior. + @SuppressWarnings("deprecation") public ScreenshotEventProcessor( final @NotNull SentryAndroidOptions options, final @NotNull BuildInfoProvider buildInfoProvider, diff --git a/sentry-android-core/src/main/java/io/sentry/android/core/SystemEventsBreadcrumbsIntegration.java b/sentry-android-core/src/main/java/io/sentry/android/core/SystemEventsBreadcrumbsIntegration.java index 18ff901b0e9..034b7e9cdee 100644 --- a/sentry-android-core/src/main/java/io/sentry/android/core/SystemEventsBreadcrumbsIntegration.java +++ b/sentry-android-core/src/main/java/io/sentry/android/core/SystemEventsBreadcrumbsIntegration.java @@ -298,6 +298,9 @@ final class SystemEventsBroadcastReceiver extends BroadcastReceiver { private static final long DEBOUNCE_WAIT_TIME_MS = 60 * 1000; private final @NotNull IScopes scopes; private final @NotNull SentryAndroidOptions options; + + // Debouncer measures on the uptime clock; moving it to MonotonicTicker changes behavior. + @SuppressWarnings("deprecation") private final @NotNull Debouncer batteryChangedDebouncer = new Debouncer(AndroidCurrentDateProvider.getInstance(), DEBOUNCE_WAIT_TIME_MS, 0); diff --git a/sentry-android-core/src/main/java/io/sentry/android/core/ViewHierarchyEventProcessor.java b/sentry-android-core/src/main/java/io/sentry/android/core/ViewHierarchyEventProcessor.java index 7090985a38b..41a624a24fc 100644 --- a/sentry-android-core/src/main/java/io/sentry/android/core/ViewHierarchyEventProcessor.java +++ b/sentry-android-core/src/main/java/io/sentry/android/core/ViewHierarchyEventProcessor.java @@ -46,6 +46,8 @@ public final class ViewHierarchyEventProcessor implements EventProcessor { private static final long DEBOUNCE_WAIT_TIME_MS = 2000; private static final int DEBOUNCE_MAX_EXECUTIONS = 3; + // Debouncer measures on the uptime clock; moving it to MonotonicTicker changes behavior. + @SuppressWarnings("deprecation") public ViewHierarchyEventProcessor(final @NotNull SentryAndroidOptions options) { this.options = Objects.requireNonNull(options, "SentryAndroidOptions is required"); this.debouncer = diff --git a/sentry-android-core/src/main/java/io/sentry/android/core/cache/AndroidEnvelopeCache.java b/sentry-android-core/src/main/java/io/sentry/android/core/cache/AndroidEnvelopeCache.java index 0373c39deea..b5d18fd7cbb 100644 --- a/sentry-android-core/src/main/java/io/sentry/android/core/cache/AndroidEnvelopeCache.java +++ b/sentry-android-core/src/main/java/io/sentry/android/core/cache/AndroidEnvelopeCache.java @@ -38,6 +38,9 @@ public final class AndroidEnvelopeCache extends EnvelopeCache { private final @NotNull ICurrentDateProvider currentDateProvider; + // Pairs with TimeSpan.getStartUptimeMs(), which is SystemClock.uptimeMillis() too, so this + // site cannot move to MonotonicTicker on its own without mixing two clock bases. + @SuppressWarnings("deprecation") public AndroidEnvelopeCache(final @NotNull SentryAndroidOptions options) { this(options, AndroidCurrentDateProvider.getInstance()); } diff --git a/sentry-android-core/src/main/java/io/sentry/android/core/internal/util/AndroidCurrentDateProvider.java b/sentry-android-core/src/main/java/io/sentry/android/core/internal/util/AndroidCurrentDateProvider.java index cdf66c319a2..0d1714260c7 100644 --- a/sentry-android-core/src/main/java/io/sentry/android/core/internal/util/AndroidCurrentDateProvider.java +++ b/sentry-android-core/src/main/java/io/sentry/android/core/internal/util/AndroidCurrentDateProvider.java @@ -4,11 +4,25 @@ import io.sentry.transport.ICurrentDateProvider; import org.jetbrains.annotations.ApiStatus; +/** + * An uptime clock: {@link SystemClock#uptimeMillis()} excludes time the device spent in deep sleep, + * which neither the name nor the {@link ICurrentDateProvider} type says. {@link + * io.sentry.transport.CurrentDateProvider} implements that same type with epoch milliseconds, so a + * call site declaring the interface accepts either, and the two disagree by however long the device + * has been suspended. + * + *

Superseded by {@link io.sentry.time.MonotonicTicker}, which counts deep sleep and says in its + * name that only differences between its own ticks are meaningful. + */ @ApiStatus.Internal public final class AndroidCurrentDateProvider implements ICurrentDateProvider { private static final ICurrentDateProvider instance = new AndroidCurrentDateProvider(); + /** + * @deprecated use {@link io.sentry.time.MonotonicTicker} to measure an interval. + */ + @Deprecated public static ICurrentDateProvider getInstance() { return instance; } From 109570ade49917fd730ef2d238054152d434baa7 Mon Sep 17 00:00:00 2001 From: Nelson Osacky Date: Fri, 11 Sep 2026 17:34:06 +0200 Subject: [PATCH 2/6] changelog --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 62bbaabd38e..8a8eea2d9cf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -34,6 +34,10 @@ - Sentry can now configure Log4j2 automatically for Spring Boot 3 when `sentry-log4j2` is on the classpath and Log4j2 Core is the active logging backend ([#6072](https://github.com/getsentry/sentry-java/pull/6072)) - Disabled by default for now; enable it and configure levels the same way as described in the Spring Boot 4 entry above (`sentry.logging.enabled=true`) +### Internal + +- Deprecate `AndroidCurrentDateProvider.getInstance()` in favor of `MonotonicTicker`, which counts time spent in deep sleep and cannot be confused with the epoch-based `CurrentDateProvider` ([#6103](https://github.com/getsentry/sentry-java/pull/6103)) + ## 8.56.0 ### Behavioral Changes From 35e2907393e8012bf908d21b73bc4d1fe8a66d9e Mon Sep 17 00:00:00 2001 From: Nelson Osacky Date: Fri, 11 Sep 2026 17:38:59 +0200 Subject: [PATCH 3/6] ref(android): Deprecate the whole AndroidCurrentDateProvider type (JAVA-728) Deprecating the type rather than getInstance() says the hazard is the class itself, and warns on every mention of it, the import included. That is only affordable because this class has five use sites. An import of a deprecated type still warns at Java 8 (JEP 211 elides those only from source 9 on), -Werror turns it into an error, and an import declaration cannot carry a @SuppressWarnings. Dropping the five imports for fully-qualified names puts every reference inside a declaration that a suppression can cover. Verified by re-adding one import: the build fails with "warning: [deprecation] AndroidCurrentDateProvider in io.sentry.android.core.internal.util has been deprecated". The suppression comments now point at JAVA-729, which tracks migrating the call sites, rather than restating the reasoning at each one. Co-Authored-By: Claude Opus 5 (1M context) --- .../core/AppComponentsBreadcrumbsIntegration.java | 8 +++++--- .../io/sentry/android/core/ScreenshotEventProcessor.java | 5 ++--- .../android/core/SystemEventsBreadcrumbsIntegration.java | 8 +++++--- .../sentry/android/core/ViewHierarchyEventProcessor.java | 5 ++--- .../sentry/android/core/cache/AndroidEnvelopeCache.java | 6 ++---- .../core/internal/util/AndroidCurrentDateProvider.java | 9 +++------ 6 files changed, 19 insertions(+), 22 deletions(-) diff --git a/sentry-android-core/src/main/java/io/sentry/android/core/AppComponentsBreadcrumbsIntegration.java b/sentry-android-core/src/main/java/io/sentry/android/core/AppComponentsBreadcrumbsIntegration.java index 48b8125f1ab..2cd3e8ecd57 100644 --- a/sentry-android-core/src/main/java/io/sentry/android/core/AppComponentsBreadcrumbsIntegration.java +++ b/sentry-android-core/src/main/java/io/sentry/android/core/AppComponentsBreadcrumbsIntegration.java @@ -12,7 +12,6 @@ import io.sentry.Integration; import io.sentry.SentryLevel; import io.sentry.SentryOptions; -import io.sentry.android.core.internal.util.AndroidCurrentDateProvider; import io.sentry.android.core.internal.util.Debouncer; import io.sentry.android.core.internal.util.DeviceOrientations; import io.sentry.protocol.Device; @@ -34,10 +33,13 @@ public final class AppComponentsBreadcrumbsIntegration private @Nullable IScopes scopes; private @Nullable SentryAndroidOptions options; - // Debouncer measures on the uptime clock; moving it to MonotonicTicker changes behavior. + // TODO: JAVA-729 @SuppressWarnings("deprecation") private final @NotNull Debouncer trimMemoryDebouncer = - new Debouncer(AndroidCurrentDateProvider.getInstance(), DEBOUNCE_WAIT_TIME_MS, 0); + new Debouncer( + io.sentry.android.core.internal.util.AndroidCurrentDateProvider.getInstance(), + DEBOUNCE_WAIT_TIME_MS, + 0); public AppComponentsBreadcrumbsIntegration(final @NotNull Context context) { this.context = diff --git a/sentry-android-core/src/main/java/io/sentry/android/core/ScreenshotEventProcessor.java b/sentry-android-core/src/main/java/io/sentry/android/core/ScreenshotEventProcessor.java index afc392bf16c..98634abf44b 100644 --- a/sentry-android-core/src/main/java/io/sentry/android/core/ScreenshotEventProcessor.java +++ b/sentry-android-core/src/main/java/io/sentry/android/core/ScreenshotEventProcessor.java @@ -12,7 +12,6 @@ import io.sentry.Hint; import io.sentry.SentryEvent; import io.sentry.SentryLevel; -import io.sentry.android.core.internal.util.AndroidCurrentDateProvider; import io.sentry.android.core.internal.util.Debouncer; import io.sentry.android.core.internal.util.ScreenshotUtils; import io.sentry.android.replay.util.MaskRenderer; @@ -47,7 +46,7 @@ public final class ScreenshotEventProcessor implements EventProcessor { private final boolean isReplayAvailable; private final AtomicBoolean isReplayModuleAbsenceLogged = new AtomicBoolean(false); - // Debouncer measures on the uptime clock; moving it to MonotonicTicker changes behavior. + // TODO: JAVA-729 @SuppressWarnings("deprecation") public ScreenshotEventProcessor( final @NotNull SentryAndroidOptions options, @@ -58,7 +57,7 @@ public ScreenshotEventProcessor( Objects.requireNonNull(buildInfoProvider, "BuildInfoProvider is required"); this.debouncer = new Debouncer( - AndroidCurrentDateProvider.getInstance(), + io.sentry.android.core.internal.util.AndroidCurrentDateProvider.getInstance(), DEBOUNCE_WAIT_TIME_MS, DEBOUNCE_MAX_EXECUTIONS); diff --git a/sentry-android-core/src/main/java/io/sentry/android/core/SystemEventsBreadcrumbsIntegration.java b/sentry-android-core/src/main/java/io/sentry/android/core/SystemEventsBreadcrumbsIntegration.java index 034b7e9cdee..f0f8a619e93 100644 --- a/sentry-android-core/src/main/java/io/sentry/android/core/SystemEventsBreadcrumbsIntegration.java +++ b/sentry-android-core/src/main/java/io/sentry/android/core/SystemEventsBreadcrumbsIntegration.java @@ -35,7 +35,6 @@ import io.sentry.Integration; import io.sentry.SentryLevel; import io.sentry.SentryOptions; -import io.sentry.android.core.internal.util.AndroidCurrentDateProvider; import io.sentry.android.core.internal.util.Debouncer; import io.sentry.util.AutoClosableReentrantLock; import io.sentry.util.Objects; @@ -299,10 +298,13 @@ final class SystemEventsBroadcastReceiver extends BroadcastReceiver { private final @NotNull IScopes scopes; private final @NotNull SentryAndroidOptions options; - // Debouncer measures on the uptime clock; moving it to MonotonicTicker changes behavior. + // TODO: JAVA-729 @SuppressWarnings("deprecation") private final @NotNull Debouncer batteryChangedDebouncer = - new Debouncer(AndroidCurrentDateProvider.getInstance(), DEBOUNCE_WAIT_TIME_MS, 0); + new Debouncer( + io.sentry.android.core.internal.util.AndroidCurrentDateProvider.getInstance(), + DEBOUNCE_WAIT_TIME_MS, + 0); SystemEventsBroadcastReceiver( final @NotNull IScopes scopes, final @NotNull SentryAndroidOptions options) { diff --git a/sentry-android-core/src/main/java/io/sentry/android/core/ViewHierarchyEventProcessor.java b/sentry-android-core/src/main/java/io/sentry/android/core/ViewHierarchyEventProcessor.java index 41a624a24fc..2516dfc4c23 100644 --- a/sentry-android-core/src/main/java/io/sentry/android/core/ViewHierarchyEventProcessor.java +++ b/sentry-android-core/src/main/java/io/sentry/android/core/ViewHierarchyEventProcessor.java @@ -14,7 +14,6 @@ import io.sentry.SentryEvent; import io.sentry.SentryLevel; import io.sentry.android.core.internal.gestures.ViewUtils; -import io.sentry.android.core.internal.util.AndroidCurrentDateProvider; import io.sentry.android.core.internal.util.AndroidThreadChecker; import io.sentry.android.core.internal.util.ClassUtil; import io.sentry.android.core.internal.util.Debouncer; @@ -46,13 +45,13 @@ public final class ViewHierarchyEventProcessor implements EventProcessor { private static final long DEBOUNCE_WAIT_TIME_MS = 2000; private static final int DEBOUNCE_MAX_EXECUTIONS = 3; - // Debouncer measures on the uptime clock; moving it to MonotonicTicker changes behavior. + // TODO: JAVA-729 @SuppressWarnings("deprecation") public ViewHierarchyEventProcessor(final @NotNull SentryAndroidOptions options) { this.options = Objects.requireNonNull(options, "SentryAndroidOptions is required"); this.debouncer = new Debouncer( - AndroidCurrentDateProvider.getInstance(), + io.sentry.android.core.internal.util.AndroidCurrentDateProvider.getInstance(), DEBOUNCE_WAIT_TIME_MS, DEBOUNCE_MAX_EXECUTIONS); diff --git a/sentry-android-core/src/main/java/io/sentry/android/core/cache/AndroidEnvelopeCache.java b/sentry-android-core/src/main/java/io/sentry/android/core/cache/AndroidEnvelopeCache.java index b5d18fd7cbb..66f503133ce 100644 --- a/sentry-android-core/src/main/java/io/sentry/android/core/cache/AndroidEnvelopeCache.java +++ b/sentry-android-core/src/main/java/io/sentry/android/core/cache/AndroidEnvelopeCache.java @@ -11,7 +11,6 @@ import io.sentry.android.core.AnrV2Integration; import io.sentry.android.core.SentryAndroidOptions; import io.sentry.android.core.TombstoneIntegration; -import io.sentry.android.core.internal.util.AndroidCurrentDateProvider; import io.sentry.android.core.performance.AppStartMetrics; import io.sentry.android.core.performance.TimeSpan; import io.sentry.cache.EnvelopeCache; @@ -38,11 +37,10 @@ public final class AndroidEnvelopeCache extends EnvelopeCache { private final @NotNull ICurrentDateProvider currentDateProvider; - // Pairs with TimeSpan.getStartUptimeMs(), which is SystemClock.uptimeMillis() too, so this - // site cannot move to MonotonicTicker on its own without mixing two clock bases. + // TODO: JAVA-729 @SuppressWarnings("deprecation") public AndroidEnvelopeCache(final @NotNull SentryAndroidOptions options) { - this(options, AndroidCurrentDateProvider.getInstance()); + this(options, io.sentry.android.core.internal.util.AndroidCurrentDateProvider.getInstance()); } AndroidEnvelopeCache( diff --git a/sentry-android-core/src/main/java/io/sentry/android/core/internal/util/AndroidCurrentDateProvider.java b/sentry-android-core/src/main/java/io/sentry/android/core/internal/util/AndroidCurrentDateProvider.java index 0d1714260c7..b801b9731c3 100644 --- a/sentry-android-core/src/main/java/io/sentry/android/core/internal/util/AndroidCurrentDateProvider.java +++ b/sentry-android-core/src/main/java/io/sentry/android/core/internal/util/AndroidCurrentDateProvider.java @@ -11,18 +11,15 @@ * call site declaring the interface accepts either, and the two disagree by however long the device * has been suspended. * - *

Superseded by {@link io.sentry.time.MonotonicTicker}, which counts deep sleep and says in its - * name that only differences between its own ticks are meaningful. + * @deprecated use {@link io.sentry.time.MonotonicTicker} to measure an interval. It counts deep + * sleep, and says in its name that only differences between its own ticks are meaningful. */ +@Deprecated @ApiStatus.Internal public final class AndroidCurrentDateProvider implements ICurrentDateProvider { private static final ICurrentDateProvider instance = new AndroidCurrentDateProvider(); - /** - * @deprecated use {@link io.sentry.time.MonotonicTicker} to measure an interval. - */ - @Deprecated public static ICurrentDateProvider getInstance() { return instance; } From f8b256aaffe4dec964fcc4726556e291ffcbef12 Mon Sep 17 00:00:00 2001 From: Nelson Osacky Date: Fri, 11 Sep 2026 17:39:00 +0200 Subject: [PATCH 4/6] changelog --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8a8eea2d9cf..4c523254a55 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -36,7 +36,7 @@ ### Internal -- Deprecate `AndroidCurrentDateProvider.getInstance()` in favor of `MonotonicTicker`, which counts time spent in deep sleep and cannot be confused with the epoch-based `CurrentDateProvider` ([#6103](https://github.com/getsentry/sentry-java/pull/6103)) +- Deprecate `AndroidCurrentDateProvider` in favor of `MonotonicTicker`, which counts time spent in deep sleep and cannot be confused with the epoch-based `CurrentDateProvider` ([#6103](https://github.com/getsentry/sentry-java/pull/6103)) ## 8.56.0 From 906440b46889249315a4d8d6c8822c7fdd50a615 Mon Sep 17 00:00:00 2001 From: Nelson Osacky Date: Fri, 11 Sep 2026 17:46:05 +0200 Subject: [PATCH 5/6] ref(android): Move the deprecation back onto getInstance() (JAVA-728) Deprecating the type required replacing all five imports with fully qualified names, since an import of a deprecated type warns at Java 8 and an import cannot carry a @SuppressWarnings. That churn bought nothing. The constructor is private, so getInstance() is the only way into this class and deprecating it warns every real caller identically. Type-level deprecation would only add a warning for declaring a variable of the concrete type, which nothing does: every holder declares ICurrentDateProvider. Measured the alternatives before reverting. Neither a class-level @SuppressWarnings nor a static import silences the import warning; only a fully qualified name, or a reference from inside the type's own package, avoids it. Co-Authored-By: Claude Opus 5 (1M context) --- .../core/AppComponentsBreadcrumbsIntegration.java | 6 ++---- .../sentry/android/core/ScreenshotEventProcessor.java | 3 ++- .../core/SystemEventsBreadcrumbsIntegration.java | 6 ++---- .../android/core/ViewHierarchyEventProcessor.java | 3 ++- .../android/core/cache/AndroidEnvelopeCache.java | 3 ++- .../internal/util/AndroidCurrentDateProvider.java | 11 ++++++++--- 6 files changed, 18 insertions(+), 14 deletions(-) diff --git a/sentry-android-core/src/main/java/io/sentry/android/core/AppComponentsBreadcrumbsIntegration.java b/sentry-android-core/src/main/java/io/sentry/android/core/AppComponentsBreadcrumbsIntegration.java index 2cd3e8ecd57..e98c0afb2db 100644 --- a/sentry-android-core/src/main/java/io/sentry/android/core/AppComponentsBreadcrumbsIntegration.java +++ b/sentry-android-core/src/main/java/io/sentry/android/core/AppComponentsBreadcrumbsIntegration.java @@ -12,6 +12,7 @@ import io.sentry.Integration; import io.sentry.SentryLevel; import io.sentry.SentryOptions; +import io.sentry.android.core.internal.util.AndroidCurrentDateProvider; import io.sentry.android.core.internal.util.Debouncer; import io.sentry.android.core.internal.util.DeviceOrientations; import io.sentry.protocol.Device; @@ -36,10 +37,7 @@ public final class AppComponentsBreadcrumbsIntegration // TODO: JAVA-729 @SuppressWarnings("deprecation") private final @NotNull Debouncer trimMemoryDebouncer = - new Debouncer( - io.sentry.android.core.internal.util.AndroidCurrentDateProvider.getInstance(), - DEBOUNCE_WAIT_TIME_MS, - 0); + new Debouncer(AndroidCurrentDateProvider.getInstance(), DEBOUNCE_WAIT_TIME_MS, 0); public AppComponentsBreadcrumbsIntegration(final @NotNull Context context) { this.context = diff --git a/sentry-android-core/src/main/java/io/sentry/android/core/ScreenshotEventProcessor.java b/sentry-android-core/src/main/java/io/sentry/android/core/ScreenshotEventProcessor.java index 98634abf44b..8c4b1feef7c 100644 --- a/sentry-android-core/src/main/java/io/sentry/android/core/ScreenshotEventProcessor.java +++ b/sentry-android-core/src/main/java/io/sentry/android/core/ScreenshotEventProcessor.java @@ -12,6 +12,7 @@ import io.sentry.Hint; import io.sentry.SentryEvent; import io.sentry.SentryLevel; +import io.sentry.android.core.internal.util.AndroidCurrentDateProvider; import io.sentry.android.core.internal.util.Debouncer; import io.sentry.android.core.internal.util.ScreenshotUtils; import io.sentry.android.replay.util.MaskRenderer; @@ -57,7 +58,7 @@ public ScreenshotEventProcessor( Objects.requireNonNull(buildInfoProvider, "BuildInfoProvider is required"); this.debouncer = new Debouncer( - io.sentry.android.core.internal.util.AndroidCurrentDateProvider.getInstance(), + AndroidCurrentDateProvider.getInstance(), DEBOUNCE_WAIT_TIME_MS, DEBOUNCE_MAX_EXECUTIONS); diff --git a/sentry-android-core/src/main/java/io/sentry/android/core/SystemEventsBreadcrumbsIntegration.java b/sentry-android-core/src/main/java/io/sentry/android/core/SystemEventsBreadcrumbsIntegration.java index f0f8a619e93..3f45a9a9fb8 100644 --- a/sentry-android-core/src/main/java/io/sentry/android/core/SystemEventsBreadcrumbsIntegration.java +++ b/sentry-android-core/src/main/java/io/sentry/android/core/SystemEventsBreadcrumbsIntegration.java @@ -35,6 +35,7 @@ import io.sentry.Integration; import io.sentry.SentryLevel; import io.sentry.SentryOptions; +import io.sentry.android.core.internal.util.AndroidCurrentDateProvider; import io.sentry.android.core.internal.util.Debouncer; import io.sentry.util.AutoClosableReentrantLock; import io.sentry.util.Objects; @@ -301,10 +302,7 @@ final class SystemEventsBroadcastReceiver extends BroadcastReceiver { // TODO: JAVA-729 @SuppressWarnings("deprecation") private final @NotNull Debouncer batteryChangedDebouncer = - new Debouncer( - io.sentry.android.core.internal.util.AndroidCurrentDateProvider.getInstance(), - DEBOUNCE_WAIT_TIME_MS, - 0); + new Debouncer(AndroidCurrentDateProvider.getInstance(), DEBOUNCE_WAIT_TIME_MS, 0); SystemEventsBroadcastReceiver( final @NotNull IScopes scopes, final @NotNull SentryAndroidOptions options) { diff --git a/sentry-android-core/src/main/java/io/sentry/android/core/ViewHierarchyEventProcessor.java b/sentry-android-core/src/main/java/io/sentry/android/core/ViewHierarchyEventProcessor.java index 2516dfc4c23..6d21edb3d0c 100644 --- a/sentry-android-core/src/main/java/io/sentry/android/core/ViewHierarchyEventProcessor.java +++ b/sentry-android-core/src/main/java/io/sentry/android/core/ViewHierarchyEventProcessor.java @@ -14,6 +14,7 @@ import io.sentry.SentryEvent; import io.sentry.SentryLevel; import io.sentry.android.core.internal.gestures.ViewUtils; +import io.sentry.android.core.internal.util.AndroidCurrentDateProvider; import io.sentry.android.core.internal.util.AndroidThreadChecker; import io.sentry.android.core.internal.util.ClassUtil; import io.sentry.android.core.internal.util.Debouncer; @@ -51,7 +52,7 @@ public ViewHierarchyEventProcessor(final @NotNull SentryAndroidOptions options) this.options = Objects.requireNonNull(options, "SentryAndroidOptions is required"); this.debouncer = new Debouncer( - io.sentry.android.core.internal.util.AndroidCurrentDateProvider.getInstance(), + AndroidCurrentDateProvider.getInstance(), DEBOUNCE_WAIT_TIME_MS, DEBOUNCE_MAX_EXECUTIONS); diff --git a/sentry-android-core/src/main/java/io/sentry/android/core/cache/AndroidEnvelopeCache.java b/sentry-android-core/src/main/java/io/sentry/android/core/cache/AndroidEnvelopeCache.java index 66f503133ce..f001c4947de 100644 --- a/sentry-android-core/src/main/java/io/sentry/android/core/cache/AndroidEnvelopeCache.java +++ b/sentry-android-core/src/main/java/io/sentry/android/core/cache/AndroidEnvelopeCache.java @@ -11,6 +11,7 @@ import io.sentry.android.core.AnrV2Integration; import io.sentry.android.core.SentryAndroidOptions; import io.sentry.android.core.TombstoneIntegration; +import io.sentry.android.core.internal.util.AndroidCurrentDateProvider; import io.sentry.android.core.performance.AppStartMetrics; import io.sentry.android.core.performance.TimeSpan; import io.sentry.cache.EnvelopeCache; @@ -40,7 +41,7 @@ public final class AndroidEnvelopeCache extends EnvelopeCache { // TODO: JAVA-729 @SuppressWarnings("deprecation") public AndroidEnvelopeCache(final @NotNull SentryAndroidOptions options) { - this(options, io.sentry.android.core.internal.util.AndroidCurrentDateProvider.getInstance()); + this(options, AndroidCurrentDateProvider.getInstance()); } AndroidEnvelopeCache( diff --git a/sentry-android-core/src/main/java/io/sentry/android/core/internal/util/AndroidCurrentDateProvider.java b/sentry-android-core/src/main/java/io/sentry/android/core/internal/util/AndroidCurrentDateProvider.java index b801b9731c3..b93beb4f578 100644 --- a/sentry-android-core/src/main/java/io/sentry/android/core/internal/util/AndroidCurrentDateProvider.java +++ b/sentry-android-core/src/main/java/io/sentry/android/core/internal/util/AndroidCurrentDateProvider.java @@ -11,15 +11,20 @@ * call site declaring the interface accepts either, and the two disagree by however long the device * has been suspended. * - * @deprecated use {@link io.sentry.time.MonotonicTicker} to measure an interval. It counts deep - * sleep, and says in its name that only differences between its own ticks are meaningful. + *

Superseded by {@link io.sentry.time.MonotonicTicker}, which counts deep sleep and says in its + * name that only differences between its own ticks are meaningful. The annotation sits on {@link + * #getInstance()}, the only way in, because a deprecated type warns on every import and an import + * cannot carry a {@code @SuppressWarnings}. */ -@Deprecated @ApiStatus.Internal public final class AndroidCurrentDateProvider implements ICurrentDateProvider { private static final ICurrentDateProvider instance = new AndroidCurrentDateProvider(); + /** + * @deprecated use {@link io.sentry.time.MonotonicTicker} to measure an interval. + */ + @Deprecated public static ICurrentDateProvider getInstance() { return instance; } From e3d4b692777ae57cfefc65a73761474d641f129d Mon Sep 17 00:00:00 2001 From: Nelson Osacky Date: Fri, 11 Sep 2026 17:46:05 +0200 Subject: [PATCH 6/6] changelog --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4c523254a55..8a8eea2d9cf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -36,7 +36,7 @@ ### Internal -- Deprecate `AndroidCurrentDateProvider` in favor of `MonotonicTicker`, which counts time spent in deep sleep and cannot be confused with the epoch-based `CurrentDateProvider` ([#6103](https://github.com/getsentry/sentry-java/pull/6103)) +- Deprecate `AndroidCurrentDateProvider.getInstance()` in favor of `MonotonicTicker`, which counts time spent in deep sleep and cannot be confused with the epoch-based `CurrentDateProvider` ([#6103](https://github.com/getsentry/sentry-java/pull/6103)) ## 8.56.0