>
> *The Service can still be killed by Android.*

Any proofs?

not any proofs, but just some discussion is possible:

Read this:

http://developer.android.com/reference/android/content/Context.html#startService%28android.content.Intent%29

>From above, there is a line:

The only time they should be stopped is if the current foreground
application is using so many resources that the service needs to be killed.

This is talking about the OOM killer.

In traditional Linux OOM is initiated from the kernel.   But here in
Android there is a special lowmemorykiller daemon:

https://source.android.com/devices/tech/low-ram.html   (looked out for
lowmemorykiller, the name as it is)

Under Android source code:

frameworks/base/services/core/java/com/android/server/am/ActiveServices.java:
    final void killServicesLocked(ProcessRecord app, boolean allowRestart) {

frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java:
        mServices.killServicesLocked(app, allowRestart);

You can see the caller and the implementer of the function above.   It is
where BIND_ALLOW_OOM_MANAGEMENT parameter are checked, and thus killing the
services is done if necessary.

More info:

http://stackoverflow.com/questions/18972590/the-timing-to-start-android-low-memory-killer

http://forum.xda-developers.com/showthread.php?t=904023

And this is from Linux kernel source code (under drivers/staging/android
means it is still yet to be approved by linux kernel - at that time):

http://www.cs.fsu.edu/~baker/devices/lxr/http/source/linux/drivers/staging/android/lowmemorykiller.txt

http://www.programering.com/a/MjNzADMwATE.html

http://lwn.net/Articles/511731/

http://varun-anand.com/mem_mgmt.html

Regards,
Peter Teoh

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to android-developers+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to