Skip to content

recording: fix observation on multiple threads in layout/draw is not supported for compose#204

Merged
marandaneto merged 4 commits intomainfrom
fix/thread-compose
Nov 11, 2024
Merged

recording: fix observation on multiple threads in layout/draw is not supported for compose#204
marandaneto merged 4 commits intomainfrom
fix/thread-compose

Conversation

@marandaneto
Copy link
Member

💡 Motivation and Context

Tries to close #203

💚 How did you test it?

Running the sample with compose screen

📝 Checklist

  • I reviewed the submitted code.
  • I added tests to verify the changes.
  • I updated the docs if needed.
  • No breaking change or entry added to the changelog.

return
}
val semanticsNodes = semanticsOwner.getAllSemanticsNodes(true)
val latch = CountDownLatch(1)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

given that this method is only executed when view.isComposeView(), its fine to do thread jumping since its a requirement for compose anyway.

Comment on lines +659 to +660
// await for 1s max
latch.await(1000, TimeUnit.MILLISECONDS)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just an arbitrary value since it is a background thread, awaiting time wont block the screen, the time-sensitive is the part within the main thread block

Copy link
Collaborator

@ioannisj ioannisj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@marandaneto marandaneto merged commit 2d99605 into main Nov 11, 2024
@marandaneto marandaneto deleted the fix/thread-compose branch November 11, 2024 12:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants