diff --git a/buildSrc/src/main/kotlin/otel.android-library-conventions.gradle.kts b/buildSrc/src/main/kotlin/otel.android-library-conventions.gradle.kts index dfe72449d..81976caab 100644 --- a/buildSrc/src/main/kotlin/otel.android-library-conventions.gradle.kts +++ b/buildSrc/src/main/kotlin/otel.android-library-conventions.gradle.kts @@ -20,6 +20,7 @@ android { // A newer version of androidx.appcompat:appcompat than 1.3.1 is available: 1.4.1 [GradleDependency] // we rely on dependabot for dependency updates disable.add("GradleDependency") + disable.add("AndroidGradlePluginVersion") } compileOptions { diff --git a/instrumentation/anr/src/main/java/io/opentelemetry/android/instrumentation/anr/AnrDetectorToggler.java b/instrumentation/anr/src/main/java/io/opentelemetry/android/instrumentation/anr/AnrDetectorToggler.java index b3d3f0188..1370cb01e 100644 --- a/instrumentation/anr/src/main/java/io/opentelemetry/android/instrumentation/anr/AnrDetectorToggler.java +++ b/instrumentation/anr/src/main/java/io/opentelemetry/android/instrumentation/anr/AnrDetectorToggler.java @@ -26,7 +26,7 @@ final class AnrDetectorToggler implements ApplicationStateListener { @Override public void onApplicationForegrounded() { if (future == null) { - future = anrScheduler.scheduleAtFixedRate(anrWatcher, 1, 1, TimeUnit.SECONDS); + future = anrScheduler.scheduleWithFixedDelay(anrWatcher, 1, 1, TimeUnit.SECONDS); } } diff --git a/instrumentation/anr/src/test/java/io/opentelemetry/android/instrumentation/anr/AnrDetectorTest.java b/instrumentation/anr/src/test/java/io/opentelemetry/android/instrumentation/anr/AnrDetectorTest.java index a9b0bf621..17a3206d8 100644 --- a/instrumentation/anr/src/test/java/io/opentelemetry/android/instrumentation/anr/AnrDetectorTest.java +++ b/instrumentation/anr/src/test/java/io/opentelemetry/android/instrumentation/anr/AnrDetectorTest.java @@ -44,7 +44,8 @@ void shouldInstallInstrumentation() { // verify that the ANR scheduler was started verify(scheduler) - .scheduleAtFixedRate(isA(AnrWatcher.class), eq(1L), eq(1L), eq(TimeUnit.SECONDS)); + .scheduleWithFixedDelay( + isA(AnrWatcher.class), eq(1L), eq(1L), eq(TimeUnit.SECONDS)); // verify that an application listener was installed verify(instrumentedApplication) .registerApplicationStateListener(isA(AnrDetectorToggler.class)); diff --git a/instrumentation/anr/src/test/java/io/opentelemetry/android/instrumentation/anr/AnrDetectorTogglerTest.java b/instrumentation/anr/src/test/java/io/opentelemetry/android/instrumentation/anr/AnrDetectorTogglerTest.java index 830224a20..37764733c 100644 --- a/instrumentation/anr/src/test/java/io/opentelemetry/android/instrumentation/anr/AnrDetectorTogglerTest.java +++ b/instrumentation/anr/src/test/java/io/opentelemetry/android/instrumentation/anr/AnrDetectorTogglerTest.java @@ -29,18 +29,18 @@ class AnrDetectorTogglerTest { @Test void testOnApplicationForegrounded() { - doReturn(future).when(scheduler).scheduleAtFixedRate(anrWatcher, 1, 1, TimeUnit.SECONDS); + doReturn(future).when(scheduler).scheduleWithFixedDelay(anrWatcher, 1, 1, TimeUnit.SECONDS); underTest.onApplicationForegrounded(); underTest.onApplicationForegrounded(); underTest.onApplicationForegrounded(); - verify(scheduler, times(1)).scheduleAtFixedRate(anrWatcher, 1, 1, TimeUnit.SECONDS); + verify(scheduler, times(1)).scheduleWithFixedDelay(anrWatcher, 1, 1, TimeUnit.SECONDS); } @Test void testOnApplicationBackgrounded() { - doReturn(future).when(scheduler).scheduleAtFixedRate(anrWatcher, 1, 1, TimeUnit.SECONDS); + doReturn(future).when(scheduler).scheduleWithFixedDelay(anrWatcher, 1, 1, TimeUnit.SECONDS); underTest.onApplicationForegrounded(); diff --git a/instrumentation/slowrendering/src/main/java/io/opentelemetry/android/instrumentation/slowrendering/SlowRenderListener.java b/instrumentation/slowrendering/src/main/java/io/opentelemetry/android/instrumentation/slowrendering/SlowRenderListener.java index d2177e6a8..981684311 100644 --- a/instrumentation/slowrendering/src/main/java/io/opentelemetry/android/instrumentation/slowrendering/SlowRenderListener.java +++ b/instrumentation/slowrendering/src/main/java/io/opentelemetry/android/instrumentation/slowrendering/SlowRenderListener.java @@ -85,7 +85,7 @@ private static Looper startFrameMetricsLoop() { // the returned future is very unlikely to fail @SuppressWarnings("FutureReturnValueIgnored") void start() { - executorService.scheduleAtFixedRate( + executorService.scheduleWithFixedDelay( this::reportSlowRenders, pollInterval.toMillis(), pollInterval.toMillis(), diff --git a/instrumentation/slowrendering/src/test/java/io/opentelemetry/android/instrumentation/slowrendering/SlowRenderListenerTest.java b/instrumentation/slowrendering/src/test/java/io/opentelemetry/android/instrumentation/slowrendering/SlowRenderListenerTest.java index fbdb7c31b..2af93eb16 100644 --- a/instrumentation/slowrendering/src/test/java/io/opentelemetry/android/instrumentation/slowrendering/SlowRenderListenerTest.java +++ b/instrumentation/slowrendering/src/test/java/io/opentelemetry/android/instrumentation/slowrendering/SlowRenderListenerTest.java @@ -147,7 +147,7 @@ public void start() { return null; }) .when(exec) - .scheduleAtFixedRate(any(), eq(1001L), eq(1001L), eq(TimeUnit.MILLISECONDS)); + .scheduleWithFixedDelay(any(), eq(1001L), eq(1001L), eq(TimeUnit.MILLISECONDS)); SlowRenderListener testInstance = new SlowRenderListener(tracer, exec, frameMetricsHandler, Duration.ofMillis(1001));