On systems like android, there are cases in which a process name can correspond to a package name (e.g. com.test.app), which is not an executable path, but instead a bundle id. In other cases, the names can correspond to special system processes whose executable path is not available (e.g. [intr_syncd]) or even kernel threads (e.g. [kworker/6:3]). So far ProcessInfo has been assuming that the process name is an executable path and for cases without executable path, no process name has been shown when invoking platform process list.
Now I'm adding a display_name field whose sole purpose is be the name to be shown when dumping ProcessInfo in cases like platform process list.
In the specific case of android, the bundle id is Arg0 when /proc/<pid>/exe is unreadable, so we can use it as display_name. For caess like system processes or kernel threads, the name is in /proc/<pid>/stat.
After this change, apk packages, system processes, and kernel threads appear in the process list
PID PARENT USER TRIPLE NAME
1 0 root /init
2 0 root [kthreadd]
3 2 root [ksoftirqd/0]
5 2 root [kworker/0:0H]
...
26176 2 root [irq/145-arm-smm]
26177 2 root [irq/146-arm-smm]
26308 2 root [kworker/2:5]
26598 926 u0_a111 com.samsung.android.app.cocktailbarservice:edgelighting
26758 926 u0_a102 com.samsung.android.messaging
26959 926 u0_a116 com.asurion.android.verizon.vms:DefendServiceVzSecure
30407 926 u0_a13 android.process.acore
31011 926 u0_a54 android.process.media
32209 926 u0_a223 com.facebook.katana
This should return the same value as /proc/<pid>/comm, except that you don't need to do any fancy parsing. Are there any cases where we cannot just read the /comm file ?