Android dumpsys 命令解析

来源:互联网 发布:淘宝举报管理在哪里 编辑:程序博客网 时间:2024/06/06 00:43

Android 有一个很有意思,也很有用的命令:dumpsys,它可以 取出一些系统信息。虽然它只是在命令行里显示,但是有一些技术点应该被采用、充实。如果你想得到所有的Android系统信息,包括第三方应用的信息,那么如下命令,你必不可少:

adb shell dumpsys

你也可以用 filters 来运行这些服务:

1 SurfaceFlinger

2 accessibility

3 account

4 activity

5 alarm

6 appwidget

7 audio

8 backup

9 battery

10 batteryinfo

11 bluetooth

12 bluetooth_a2dp

13 clipboard

14 connectivity

15 content

16 cpuinfo

17 device_policy

18 devicestoragemonitor

19 diskstats

20 dropbox

21 entropy

22 ethernet

23 hardware

24 input_method

25 iphonesubinfo

26 isms

27 keybar

28 location

29 media.audio_flinger

30 media.audio_policy

31 media.camera

32 media.player

33 meminfo

34 mount

35 netstat

36 network_management

37 notification

38 package

39 permission

40 phone

41 power

42 search

43 sensorservice

44 simphonebook

45 statusbar

46 telephony.registry

47 throttle

48 uimode

49 usagestats

50 vibrator

51 wallpaper

52 wifi

53 window

举例:

adb shell dumpsys wifi

adb shell dumpsys cpuinfo

I suggest you try other items on the list above and be creative using all the power of Unix pipes. Example, to get all memory allocated by each process you can do something like:

adb shell dumpsys meminfo | grep "allocated:" | awk '{total = total + $5}END{print total}'
0 0