Skip to content
Draft
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Run Screenshot.snap().record() explicitly on the main thread
The library detects when it's already on the UI thread and skips its
own Handler dispatch, so there's no deadlock. Being explicit here makes
it clear that the draw always happens on the main thread, consistent
with the Choreographer frame wait above.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
  • Loading branch information
EmilioBejasa and claude committed Mar 24, 2026
commit 51aeedd0961fa13e7b273cf3b6d6d5d3bf2eba6b
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,9 @@ abstract class BaseStoryScreenshotTest {
}
frameLatch.await(1000, TimeUnit.MILLISECONDS)
val screenshotName = story.id.replace("--", "_")
Screenshot.snap(view).setName(screenshotName).record()
InstrumentationRegistry.getInstrumentation().runOnMainSync {
Screenshot.snap(view).setName(screenshotName).record()
}
Log.d(TAG, "Screenshot captured: $screenshotName")
successCount++
} catch (e: Exception) {
Expand Down
Loading