How does process killing work in android?
I used advanced task killer (many other task killer) to kill processes in my android phone, most of the cases do work, but sometimes I find you kill the process in task killer doesn't mean the process ge开发者_如何学Got really killed, it still works in background, Is there any tool that have more privilege and can see all background processes ?(I think advanced task killer can only see the "user" level processes)
If you don't mind, can you explain me how these task killer applets actually work ?
Here is a wild guess from a novice:
Android sits on top of the linux operating system as shown here. If you connect to your android virtual device (avd) and open the terminal emulator or connect through the ADB, you will find that you have access to various linux commands.
C:\Users\james>adb -e shell
# cd /system/bin
# ls -a -l
...
lrwxr-xr-x root shell 2010-06-30 15:32 insmod -> toolbox
-rwxr-xr-x root shell 18172 2010-06-30 15:32 installd
lrwxr-xr-x root shell 2010-06-30 15:32 ioctl -> toolbox
lrwxr-xr-x root shell 2010-06-30 15:32 ionice -> toolbox
-rwxr-xr-x root shell 10036 2010-06-30 15:33 keystore
-rwxr-xr-x root shell 6520 2010-06-30 15:33 keystore_cli
lrwxr-xr-x root shell 2010-06-30 15:32 kill -> toolbox
Notice that most of the commands are just links to one small program (toolbox).
I can list the running programs with the ps
command but if I try to kill them with the kill
command... it says i do not have permission. You might be able to create a task manager that uses the underlying ps and kill commands in order to do the dirty work for you. You may have to overcome some permission issues though.
I expect you could run the system commands with something like this:
Runtime.getRuntime().exec("ls");
Edit:
I skimmed through this open source task manager but I didn't see how it goes about killing tasks. Maybe someone more experienced can explain it.
You can change the settings under Menu button -> Setting -> Auto Kill Level and Security Level. Auto Kill Level should be set to crazy and Security Level to Low. I'm pretty sure it gets everything. Maybe too much, might want to add some apps to the ignore list. Like the clock app, or else your alarm won't work.
As for how it works internally, I have no idea.
精彩评论