clipboard icon indicating copy to clipboard operation
clipboard copied to clipboard

java.lang.IllegalStateException: beginBroadcast() called while already in a broadcast

Open marqroldan opened this issue 4 years ago • 1 comments

I don't think this is fixable (or maybe there's a way around it), but I'm just opening na issue here in case someone looks, and possible isolated on emulators only

Similar stuff I found over the internet: https://commonsware.com/blog/2013/08/08/developer-psa-please-fix-your-clipboard-handling.html

Platforms

Android

Versions

  • Android: API 29
  • react-native: 0.63.4

Description

java.lang.IllegalStateException: beginBroadcast() called while already in a broadcast

When triggering a copy, it crashes, and restarts the emulator (haven't tested on a physical device)

java.lang.IllegalStateException: beginBroadcast() called while already in a broadcast

*** FATAL EXCEPTION IN SYSTEM PROCESS: Thread-4
java.lang.IllegalStateException: beginBroadcast() called while already in a broadcast
	at android.os.RemoteCallbackList.beginBroadcast(RemoteCallbackList.java:241)
	at com.android.server.clipboard.ClipboardService.setPrimaryClipInternal(ClipboardService.java:583)
	at com.android.server.clipboard.ClipboardService$1.onHostClipboardUpdated(ClipboardService.java:205)
	at com.android.server.clipboard.HostClipboardMonitor.run(ClipboardService.java:125)
	at java.lang.Thread.run(Thread.java:919)

Reproducible Demo

Right now I can only reproduce it when I do Linking towards a browser or when react-native-inappbrowser-reborn is opened because it's the only paths I have available at the moment, but I feel like this happens when any activity other than react native's happen

  1. Keep calling setString(), they work as usual
  2. Go to a browser using Linking.open() or instantiate a browser using react-native-inappbrowser-reborn
  3. Go back to the app and try calling setString, and it should crash

This actually happens regardless if you do setString() first or not, it's always as long as you go to a browser and going back to the app, this also happens if you have a browser opened and attempted to call setString()

It doesn't crash if I go back to the app and close the browser from the multitask view (the square button)

marqroldan avatar Nov 09 '21 09:11 marqroldan

Having this issue with exactly the same environment

MohammadAzimi avatar Apr 10 '22 11:04 MohammadAzimi