My service always getting Waited long enough for: ServiceRecord error in Kitkat

匿名 (未验证) 提交于 2019-12-03 02:05:01

问题:

I have a background service which is running in kitkat always throwing Waited long enough for: ServiceRecord message in the logcat. But in the previous versions of android my app is running smoothly without any issues.

also Sometimes my service is automatically killed in the Kitkat.

回答1:

This is caused by "Serialize running of background services" modification for ActivityServices.

Implement #10744011: Serialize running of background services Added some code to the activity manager to keep track of services that are launching and limit the number that can be launched concurrently. This only comes into play under specific circumstances: when the service launch is a background request (so timing is not important) and its process is not already running at a high priority.

In this case, we have a list of services that are currently launching and when that gets too big we start delaying the launch of future services until currently launching ones are finished.

There are some important tuning parameters for this: how many background services we allow to launch concurrently (currently 1 on low-ram devices, 3 on other devices), and how long we wait for a background service to run before consider it to be a more long-running service and go on to the next pending launch (currently set to 15 seconds).

https://github.com/android/platform_frameworks_base/commit/9210bc85545f31973c957b5179e6a82d05f473c6



标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!