【再出发】Android11源码分析:静态广播是如何接收到消息的? - 掘金
我们按照下面思路来分析广播原理
1:所有静态广播Receiver 都是串行处理,(静态广播接收者属于在发送此广播时属于有序广播范畴)
2:动态广播 Receiver按照发送此广播时指定的方式 进行 串行或者并行分发
其中:如果是普通广播:那么通过 并行方式分发
如果是 有序广播(sendOrderxxxx):那么通过 串行方式分发
3:Android系统在处理广播时:动态广播接收者 优先于 静态广播接收者 收到
4:广播分发处理关键类:BroadcastQueue/ BroadcastRecord
292921
03-02 15:54:32.073 379 449 W BroadcastQueue: Timeout of broadcast BroadcastRecord{5b337ab u0 AUTONAVI_STANDARD_BROADCAST_SEND} - receiver=android.os.BinderProxy@186fe08, started 60001ms ago
03-02 15:54:32.073 379 449 W BroadcastQueue: Receiver during timeout: ResolveInfo{a10c9a1 com.iflytek.cutefly.speechclient.hmi/com.iflytek.auto.speechclient.sdk.naviadapter.handle.NaviMessageReceiver m=0x108000}
5: 相关问题
2022-04-25 11:17:00.048 1217 1217 E BroadcastReceiver: BroadcastReceiver trying to return result during a non-ordered broadcast
2022-04-25 11:17:00.048 1217 1217 E BroadcastReceiver: java.lang.RuntimeException: BroadcastReceiver trying to return result during a non-ordered broadcast
2022-04-25 11:17:00.048 1217 1217 E BroadcastReceiver: at android.content.BroadcastReceiver.checkSynchronousHint(BroadcastReceiver.java:785)
2022-04-25 11:17:00.048 1217 1217 E BroadcastReceiver: at android.content.BroadcastReceiver.setResultCode(BroadcastReceiver.java:551)
2022-04-25 11:17:00.048 1217 1217 E BroadcastReceiver: at com.android.providers.remindercalendar.CalendarProviderBroadcastReceiver.onReceive(CalendarProviderBroadcastReceiver.java:36)
2022-04-25 11:17:00.048 1217 1217 E BroadcastReceiver: at android.app.ActivityThread.handleReceiver(ActivityThread.java:2766)
2022-04-25 11:17:00.048 1217 1217 E BroadcastReceiver: at android.app.ActivityThread.-wrap14(ActivityThread.java)
2022-04-25 11:17:00.048 1217 1217 E BroadcastReceiver: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1441)
2022-04-25 11:17:00.048 1217 1217 E BroadcastReceiver: at android.os.Handler.dispatchMessage(Handler.java:102)
2022-04-25 11:17:00.048 1217 1217 E BroadcastReceiver: at android.os.Looper.loop(Looper.java:148)
2022-04-25 11:17:00.048 1217 1217 E BroadcastReceiver: at android.app.ActivityThread.main(ActivityThread.java:5498)
2022-04-25 11:17:00.048 1217 1217 E BroadcastReceiver: at java.lang.reflect.Method.invoke(Native Method)
2022-04-25 11:17:00.048 1217 1217 E BroadcastReceiver: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:730)
2022-04-25 11:17:00.048 1217 1217 E BroadcastReceiver: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:620)