SIGN IN SIGN UP
square / leakcanary UNCLAIMED

A memory leak detection library for Android.

0 0 74 Kotlin

Fix LeakActivityTest on API 33+ by disabling notifications during test

When targetSdk >= 33 and notifications are not enabled (fresh emulator),
Notifications.canShowNotification launches RequestPermissionActivity with
FLAG_ACTIVITY_NEW_TASK to request POST_NOTIFICATIONS permission. This
pushes LeakActivity to PAUSED, causing Espresso's onView() to throw
NoActivityResumedException.

The test is validating the heap import flow, not notifications. Setting
showNotifications = false prevents the permission activity from launching
so LeakActivity stays in the RESUMED state for the Espresso assertions.
The tryAndRestoreConfig wrapper already restores the original config.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
P
Pierre-Yves Ricau committed
38deaf55dd4c68a22dde43ee08262f771623f080
Parent: b79e8a9