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

        问题log如下:

07-26 17:27:48.620 W/System.err( 1784): java.lang.reflect.InvocationTargetException
07-26 17:27:48.620 W/System.err( 1784): 	at java.lang.reflect.Method.invokeNative(Native Method)
07-26 17:27:48.620 W/System.err( 1784): 	at java.lang.reflect.Method.invoke(Method.java:525)
07-26 17:27:48.620 W/System.err( 1784): 	at com.qinggan.carsignal.service.CarSignalService.allObserversInvoke(CarSignalService.java:1059)
07-26 17:27:48.620 W/System.err( 1784): 	at com.qinggan.carsignal.service.CarSignalService.OnACCStateChanged(CarSignalService.java:1113)
07-26 17:27:48.620 W/System.err( 1784): 	at com.qinggan.carsignal.service.CarSignalService.access$1300(CarSignalService.java:63)
07-26 17:27:48.620 W/System.err( 1784): 	at com.qinggan.carsignal.service.CarSignalService$4.handleMessage(CarSignalService.java:1269)
07-26 17:27:48.620 W/System.err( 1784): 	at android.os.Handler.dispatchMessage(Handler.java:99)
07-26 17:27:48.620 W/System.err( 1784): 	at android.os.Looper.loop(Looper.java:137)
07-26 17:27:48.620 W/System.err( 1784): 	at android.app.ActivityThread.main(ActivityThread.java:5103)
07-26 17:27:48.620 W/System.err( 1784): 	at java.lang.reflect.Method.invokeNative(Native Method)
07-26 17:27:48.620 W/System.err( 1784): 	at java.lang.reflect.Method.invoke(Method.java:525)
07-26 17:27:48.620 W/System.err( 1784): 	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
07-26 17:27:48.620 W/System.err( 1784): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
07-26 17:27:48.620 W/System.err( 1784): 	at de.robv.android.xposed.XposedBridge.main(XposedBridge.java:134)
07-26 17:27:48.620 D/dalvikvm( 1599): GC_CONCURRENT freed 399K, 23% free 3015K/3868K, paused 2ms+2ms, total 23ms
07-26 17:27:48.620 W/System.err( 1784): 	at dalvik.system.NativeStart.main(Native Method)
07-26 17:27:48.620 W/System.err( 1784): Caused by: java.lang.IllegalStateException: beginBroadcast() called while already in a broadcast
07-26 17:27:48.620 W/System.err( 1784): 	at android.os.Parcel.readException(Parcel.java:1439)
07-26 17:27:48.620 W/System.err( 1784): 	at android.os.Parcel.readException(Parcel.java:1385)
07-26 17:27:48.620 W/System.err( 1784): 	at com.qinggan.carsignal.ICarSignalServiceCallBack$Stub$Proxy.onACCStateChanged(ICarSignalServiceCallBack.java:311)
【问题原因】:利用Binder机制跨进程进行接口调用,实现接口的远程service采用注册-分发的方式通知所有注册的process。在所有注册的process中,有一个process将接口阻塞,导致后续Process只要调用该接口,就会产生该问题。

【解决办法】:采用多线程方式,将接口的阻塞式调用改未非阻塞式,避免影像其它process的调用。


你可能感兴趣的:(Android)