diff --git a/espresso/CHANGELOG.md b/espresso/CHANGELOG.md index 89a4f06b1..212950801 100644 --- a/espresso/CHANGELOG.md +++ b/espresso/CHANGELOG.md @@ -19,6 +19,7 @@ The following artifacts were released: * Replace now-unnecessary reflection from TestLooperManagerCompat when using Android SDK 36 APIs * Don't suppress AppNotIdleException if dumpThreadStates throws. * Remove Espresso.onIdle tracing +* Downgrade IdlingResourceRegistry potential race condition exception to warning. **New Features** diff --git a/espresso/core/java/androidx/test/espresso/base/IdlingResourceRegistry.java b/espresso/core/java/androidx/test/espresso/base/IdlingResourceRegistry.java index 05f4e9423..8d3e1b672 100644 --- a/espresso/core/java/androidx/test/espresso/base/IdlingResourceRegistry.java +++ b/espresso/core/java/androidx/test/espresso/base/IdlingResourceRegistry.java @@ -547,7 +547,8 @@ private void handleRaceCondition(Message m) { if (is.idle) { // it was a race... i is now idle, everything is fine... } else { - throw new IllegalStateException( + Log.w( + TAG, String.format( Locale.ROOT, "Resource %s isIdleNow() is returning true, but a message indicating that the " diff --git a/espresso/idling_resource/java/androidx/test/espresso/IdlingResource.java b/espresso/idling_resource/java/androidx/test/espresso/IdlingResource.java index 6618a37f5..2cb11f285 100644 --- a/espresso/idling_resource/java/androidx/test/espresso/IdlingResource.java +++ b/espresso/idling_resource/java/androidx/test/espresso/IdlingResource.java @@ -63,10 +63,8 @@ public interface ResourceCallback { /** * Called when the resource goes from busy to idle. * - *
If the idle state is updated on a thread other than the main thread, this method should be - * called before the state is updated to return true. Failing to do so can cause a race - * condition where Espresso throws a consistency error due to observing {@link #isIdleNow()} - * returning true before the callback is invoked. + *
It is recommended to call this method after the idle state is updated to return + * true. */ public void onTransitionToIdle(); }