在最新的 android 版本中,发送 ACTION_BOOT_COMPLETED 广播的方式似乎有一个非常重要的变化。 在 JB 4.3 中,引导完成广播是并行处理的。在 KK 4.4.2 中,它被串行处理。 这会延迟启动后的服务启动。
由于 Google 的这一更改,我的服务在启动完成后延迟启动。 可以观察到设备变得迟缓并且触摸音频没有播放。所有这些都是因为各自的服务开始晚了。
此外,从日志中我看到第一个在发送后收到 ACTION_BOOT_COMPLETED 的人在 16-19 秒后收到它,而在 JBP 上,接收队列中的第一个人几乎不需要 10 毫秒得到它。
任何知道此更改的人都可以解释为什么要这样做。 这将是一个很大的帮助。
非常感谢!
最佳答案
更改是由@hackbod 进行的,也许她可以阐明原因。
她的签到记录上写着:
Finish issue #10779747: Calendar Storage crash observed...
...while setting up a new user from settings.
We can now delay broadcasts when there are enough background services currently starting (still set to 1 for svelte devices, 3 for normal devices).
Add new intent flag to not allow receivers to abort broadcasts, which I use to fix an issue with the initial BOOT_COMPLETED broadcast not actually requesting pss data at the right time -- it can now be sent as an ordered broadcast without the ability for the receivers to cancel it.
关于android - 在 KITKAT 4.4.2 <ACTION_BOOT_COMPLETED><ActivityManagerService.java> 中串行处理的引导完成广播,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21670405/