How to get the list of Android system\'s All running process including System launched processes?
I tried to get the list using below code:
ActivityManager
By calling an API from ActivityManager
, you're only getting the applications which registered with it - that is, UI activities - and not all the processes. Those you see with a non-reverse DNS name, but a path (e.g. /system/bin/*
) are native daemons, started by init
, and left out of the ActivityManager
.
One way around this is to get the list of processes directly from /proc
(just like toolbox's ps
does it). This requires iterating programmatically over the directories there, (i.e. /proc/[0-9]*
), and pruning out the kernel threads. Kernel threads are those with a PPID
of 2, so they're easy. Native daemons will have a PPID
of 1. Applications will have a PPID
of Zygote.
Reference: NewAndroidBook.com