问题
I did run ps
command in shell on my phone. The question is how can I differentiate processes related to applications which I executed as a normal phone user such as Google Play, Adobe Reader and etc.?
As I noticed some processes are run by user names in format app_xxx
and as childs of process zygote
however there are plenty of them which include background services and system services. Are there any method to make a short-list of them like the list my phone displays when i press app list button (currently it shows only 6 apps with thumbnails in running applications list)?
here is the output of ps
in adb shell:
USER PID PPID VSIZE RSS WCHAN PC NAME
root 1 0 416 272 ffffffff 00000000 S /init
root 2 0 0 0 ffffffff 00000000 S kthreadd
root 3 2 0 0 ffffffff 00000000 S ksoftirqd/0
root 6 2 0 0 ffffffff 00000000 S migration/0
root 7 2 0 0 ffffffff 00000000 S watchdog/0
root 12 2 0 0 ffffffff 00000000 S khelper
root 13 2 0 0 ffffffff 00000000 S pm
root 14 2 0 0 ffffffff 00000000 S suspend
root 15 2 0 0 ffffffff 00000000 S sync_system_wor
root 16 2 0 0 ffffffff 00000000 S sync_supers
root 17 2 0 0 ffffffff 00000000 S bdi-default
root 18 2 0 0 ffffffff 00000000 S kblockd
root 19 2 0 0 ffffffff 00000000 S irq/217-tegra-o
root 20 2 0 0 ffffffff 00000000 S khubd
root 21 2 0 0 ffffffff 00000000 S irq/118-tps6586
root 22 2 0 0 ffffffff 00000000 S kmmcd
root 23 2 0 0 ffffffff 00000000 S kconservative
root 24 2 0 0 ffffffff 00000000 S cpu-tegra
root 25 2 0 0 ffffffff 00000000 S khungtaskd
root 26 2 0 0 ffffffff 00000000 S kswapd0
root 27 2 0 0 ffffffff 00000000 S fsnotify_mark
root 28 2 0 0 ffffffff 00000000 S aio
root 29 2 0 0 ffffffff 00000000 S crypto
root 180 2 0 0 ffffffff 00000000 S tegradc.0
root 181 2 0 0 ffffffff 00000000 S tegradc.0
root 182 2 0 0 ffffffff 00000000 S nvhdcp1
root 183 2 0 0 ffffffff 00000000 S tegradc.1
root 184 2 0 0 ffffffff 00000000 S tegradc.1
root 185 2 0 0 ffffffff 00000000 S lcd_bl
root 186 2 0 0 ffffffff 00000000 S smdpdpd
root 187 2 0 0 ffffffff 00000000 S tegra-kbc
root 188 2 0 0 ffffffff 00000000 S irq/220-sec_tou
root 189 2 0 0 ffffffff 00000000 S bh1721fvc_wq
root 190 2 0 0 ffffffff 00000000 S ak8975c_wq
root 191 2 0 0 ffffffff 00000000 S kxtf9_wq
root 192 2 0 0 ffffffff 00000000 S kstriped
root 193 2 0 0 ffffffff 00000000 S kondemand
root 194 2 0 0 ffffffff 00000000 S kinteractiveup
root 199 2 0 0 ffffffff 00000000 S usbhid_resumer
root 200 2 0 0 ffffffff 00000000 S binder
root 202 2 0 0 ffffffff 00000000 S wm8994
root 203 2 0 0 ffffffff 00000000 S l2cap
root 204 2 0 0 ffffffff 00000000 S krfcommd
root 205 2 0 0 ffffffff 00000000 S sec_jack_wq
root 206 2 0 0 ffffffff 00000000 S irq/371-sec_hea
root 207 2 0 0 ffffffff 00000000 S mmcqd
root 208 2 0 0 ffffffff 00000000 S p3_TA_workqueue
root 209 1 344 172 ffffffff 00000000 S /sbin/ueventd
root 210 2 0 0 ffffffff 00000000 S jbd2/mmcblk0p4-
root 211 2 0 0 ffffffff 00000000 S ext4-dio-unwrit
root 212 2 0 0 ffffffff 00000000 S jbd2/mmcblk0p5-
root 213 2 0 0 ffffffff 00000000 S ext4-dio-unwrit
root 215 2 0 0 ffffffff 00000000 S jbd2/mmcblk0p8-
root 216 2 0 0 ffffffff 00000000 S ext4-dio-unwrit
root 217 2 0 0 ffffffff 00000000 S jbd2/mmcblk0p1-
root 218 2 0 0 ffffffff 00000000 S ext4-dio-unwrit
system 219 1 864 272 ffffffff 00000000 S /system/bin/servicemanage
r
root 220 1 4564 740 ffffffff 00000000 S /system/bin/vold
root 222 1 5256 900 ffffffff 00000000 S /system/bin/netd
system 224 1 35660 22828 ffffffff 00000000 S /system/bin/surfaceflinge
r
root 225 1 468560 22484 ffffffff 00000000 S zygote
drm 226 1 13236 1392 ffffffff 00000000 S /system/bin/drmserver
media 227 1 47792 6756 ffffffff 00000000 S /system/bin/mediaserver
bluetooth 228 1 1356 312 ffffffff 00000000 S /system/bin/dbus-daemon
root 229 1 916 380 ffffffff 00000000 S /system/bin/installd
keystore 230 1 1804 400 ffffffff 00000000 S /system/bin/keystore
system 231 1 5324 712 ffffffff 00000000 S /system/bin/tvoutserver
gps 232 1 16720 1808 ffffffff 00000000 S /system/bin/gpsd
radio 233 1 10552 1432 ffffffff 00000000 S /system/bin/rild
system 234 1 8452 756 ffffffff 00000000 S /system/bin/drexe
system 235 1 1108 304 ffffffff 00000000 S /system/bin/npsmobex
media_rw 236 1 1652 1088 ffffffff 00000000 S /system/bin/sdcard
shell 237 1 804 388 ffffffff 00000000 S /system/bin/sh
shell 238 1 3456 180 ffffffff 00000000 S /sbin/adbd
shell 254 1 776 244 c00e3e00 aff0c1fc S /system/bin/immvibed
root 255 2 0 0 ffffffff 00000000 S irq/182-3d
root 257 2 0 0 ffffffff 00000000 S smdctld
root 265 2 0 0 ffffffff 00000000 S irq/178-2d_0
root 275 2 0 0 ffffffff 00000000 S flush-179:0
root 277 2 0 0 ffffffff 00000000 S irq/184-disp0
root 286 2 0 0 ffffffff 00000000 S irq/261-accesso
root 287 2 0 0 ffffffff 00000000 S irq/309-dock_de
system 290 225 589008 63864 ffffffff 00000000 S system_server
system 337 225 512444 41632 ffffffff 00000000 S com.android.systemui
app_92 346 225 500512 27356 ffffffff 00000000 S com.samsung.sec.android.i
nputmethod.axt9
radio 353 225 499624 23640 ffffffff 00000000 S com.android.phone
app_47 356 225 478476 19100 ffffffff 00000000 S com.sec.pcw.device
app_62 358 225 507484 75304 ffffffff 00000000 S com.android.launcher
app_48 387 225 607984 28188 ffffffff 00000000 S com.google.process.gapps
app_15 436 225 493320 26488 ffffffff 00000000 S android.process.acore
app_238 622 1 481576 19872 ffffffff 00000000 S me.onemobile.android
app_85 1342 225 481256 20568 ffffffff 00000000 S com.android.providers.cal
endar
app_75 1627 225 516084 23844 ffffffff 00000000 S com.android.email
root 1740 2 0 0 ffffffff 00000000 S iscan_sysioc
root 1741 2 0 0 ffffffff 00000000 S pno_sysioc
root 1742 2 0 0 ffffffff 00000000 S dhd_watchdog
root 1743 2 0 0 ffffffff 00000000 S dhd_dpc
root 1744 2 0 0 ffffffff 00000000 S dhd_sysioc
root 1745 2 0 0 ffffffff 00000000 S ksdioirqd/mmc1
wifi 1754 1 2624 960 ffffffff 00000000 S /system/bin/wpa_supplican
t
dhcp 3813 1 948 392 ffffffff 00000000 S /system/bin/dhcpcd
app_384 4132 1 748 284 ffffffff 00000000 S sys-log
app_134 4527 225 481000 24828 ffffffff 00000000 S com.noshufou.android.su
app_60 4567 225 505932 28672 ffffffff 00000000 S com.google.android.apps.m
aps
root 5249 2 0 0 ffffffff 00000000 S kworker/u:0
root 5282 1 732 268 ffffffff 00000000 S /system/bin/debuggerd
app_325 5551 225 492004 31712 ffffffff 00000000 S com.yahoo.mobile.client.a
ndroid.mail:com.yahoo.snp.service
app_15 6132 225 479488 20612 ffffffff 00000000 S com.sec.android.widgetapp
.programmonitorwidget
app_71 6140 225 481412 22540 ffffffff 00000000 S com.android.sec.gallery3d
app_391 6173 225 485068 26780 ffffffff 00000000 S com.farsitel.bazaar
app_14 6712 225 503704 33236 ffffffff 00000000 S com.android.vending
system 6737 225 480416 21316 ffffffff 00000000 S com.android.settings
app_42 6744 225 480480 20860 ffffffff 00000000 S com.svox.pico
app_68 6751 225 478624 21080 ffffffff 00000000 S com.google.android.partne
rsetup
app_330 6758 225 488644 22708 ffffffff 00000000 S com.yoyogames.runner
app_318 6765 225 487060 27132 ffffffff 00000000 S net.jhoobin.jhub
app_310 6776 225 480464 23548 ffffffff 00000000 S com.appslib.vending
app_240 6789 225 483284 24576 ffffffff 00000000 S cm.aptoide.pt
app_277 6800 225 481236 24140 ffffffff 00000000 S com.ada.market
app_384 6813 225 484576 24296 ffffffff 00000000 S com.dewmobile.kuaiya
app_380 6823 225 486928 27244 ffffffff 00000000 S com.estrongs.android.pop
app_67 6858 225 482568 23560 ffffffff 00000000 S com.google.android.google
quicksearchbox
root 6998 2 0 0 ffffffff 00000000 S kworker/u:1
app_34 7049 225 479424 21936 ffffffff 00000000 S com.sec.android.app.samsu
ngapps.una2
app_60 7102 225 500324 25060 ffffffff 00000000 S com.google.android.apps.m
aps:FriendService
app_60 7415 225 508912 28592 ffffffff 00000000 S com.google.android.apps.m
aps:GoogleLocationService
root 7450 2 0 0 ffffffff 00000000 S kworker/0:2
app_138 7608 225 492292 26584 ffffffff 00000000 S com.speaktoit.assistant
app_16 7635 225 484192 21172 ffffffff 00000000 S android.tts
app_48 7642 225 485668 22416 ffffffff 00000000 S com.google.android.gsf.lo
gin
app_29 7654 225 484888 30400 ffffffff 00000000 S android.process.media
root 7681 2 0 0 ffffffff 00000000 S kworker/0:0
app_406 7695 225 493492 29852 ffffffff 00000000 S apt.eve.dynamicanalysis
system 7712 225 480960 21292 ffffffff 00000000 S com.sec.android.app.facto
rytest
app_28 7719 225 480540 20592 ffffffff 00000000 S com.sec.phone
app_381 7738 225 490688 25820 ffffffff 00000000 S com.lenovo.anyshare.gps
app_204 7760 225 494564 29104 ffffffff 00000000 S com.rebelvox.voxer
system 7783 225 489804 23492 ffffffff 00000000 S com.android.MtpApplicatio
n
app_60 7791 225 496424 27336 ffffffff 00000000 S com.google.android.apps.m
aps:LocationFriendService
app_91 7809 225 479584 21468 ffffffff 00000000 S com.sec.android.provider.
badge
root 7816 2 0 0 ffffffff 00000000 S kworker/0:1
root 7818 2 0 0 ffffffff 00000000 S kworker/u:2
root 7819 2 0 0 ffffffff 00000000 S flush-0:18
root 7821 2 0 0 ffffffff 00000000 S kworker/u:3
root 7823 2 0 0 ffffffff 00000000 S kworker/u:4
root 7824 2 0 0 ffffffff 00000000 S kworker/u:5
root 7825 2 0 0 ffffffff 00000000 S kworker/u:6
root 7826 2 0 0 ffffffff 00000000 S kworker/u:7
root 7827 2 0 0 ffffffff 00000000 S kworker/u:8
root 7828 2 0 0 ffffffff 00000000 S kworker/u:9
root 7829 2 0 0 ffffffff 00000000 S kworker/u:10
root 7830 2 0 0 ffffffff 00000000 S kworker/u:11
root 7831 2 0 0 ffffffff 00000000 S kworker/u:12
root 7934 2 0 0 ffffffff 00000000 S migration/1
root 7935 2 0 0 ffffffff 00000000 S kworker/1:1
root 7936 2 0 0 ffffffff 00000000 S ksoftirqd/1
root 7937 2 0 0 ffffffff 00000000 S watchdog/1
root 7938 2 0 0 ffffffff 00000000 S kworker/1:0
app_116 7941 225 528836 58192 ffffffff 00000000 S com.facebook.katana
root 7953 2 0 0 ffffffff 00000000 S kworker/1:2
app_10 7962 225 556924 30200 ffffffff 00000000 S com.google.android.youtub
e
shell 8011 238 804 408 c003738c aff0bc54 S /system/bin/sh
shell 8015 8011 960 340 00000000 aff0b238 R ps
回答1:
Filtering by "app_*" is definitely a step in right direction. Next, you want to filter out system apps: see How do I check if an app is a non-system app in Android?
Note that definition of system vs. non-system apps is vague: e.g. Facebook may be preinstalled or not, depending on the goodwill of the manufacturer (and provider).
Also note that some apps may run more than one process.
来源:https://stackoverflow.com/questions/31246218/android-differntiate-running-apps-from-other-processes-in-android