You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
EmojiPopup.Builder.fromRootView() performs a read from the disk on the main thread. This is caused by the builder constructing a RecentEmojiManager in its constructor:
The RecentEmojiManager then creates a shared preferences instance, which then causes the main thread disk read. In our case this causes problems as we are running with strict mode enabled, and we are building our own RecentEmoji instance, so we don't even use the one that gets made in the constructor.
There are a few ways we can address this issue. I think the most straightforward approach would be to modify the EmojiPopup.Builder so that the recentEmoji field is @Nullable then construct a RecentEmojiManager inside the build method if recentEmoji is still null. That way people can set their own emoji managers and manage the threading of any disk reads in whatever way suits them.
All up it seems like a pretty minor change. @vanniktech would you be happy to accept a PR along these lines? I could submit something.
The text was updated successfully, but these errors were encountered:
EmojiPopup.Builder.fromRootView()
performs a read from the disk on the main thread. This is caused by the builder constructing aRecentEmojiManager
in its constructor:Emoji/emoji/src/main/java/com/vanniktech/emoji/EmojiPopup.java
Line 373 in 6d33b3a
The
RecentEmojiManager
then creates a shared preferences instance, which then causes the main thread disk read. In our case this causes problems as we are running with strict mode enabled, and we are building our ownRecentEmoji
instance, so we don't even use the one that gets made in the constructor.There are a few ways we can address this issue. I think the most straightforward approach would be to modify the
EmojiPopup.Builder
so that therecentEmoji
field is@Nullable
then construct aRecentEmojiManager
inside thebuild
method ifrecentEmoji
is still null. That way people can set their own emoji managers and manage the threading of any disk reads in whatever way suits them.All up it seems like a pretty minor change. @vanniktech would you be happy to accept a PR along these lines? I could submit something.
The text was updated successfully, but these errors were encountered: