adb shell dumpsys的使用

该命令用于打印出当前系统信息,默认打印出设备中所有service的信息,可以在命令后面加指定的service name.

有两种方法可以查看service list:

1. adb shell dumpsys

输出信息的开始部分就是所有运行的service,如下:

Currently running services:

SurfaceFlinger:
accessibility:
account:
activity:
alarm:
appwidget:
audio:
backup:
battery:
batteryinfo:
clipboard:
connectivity:
content:
cpuinfo:
device_policy:
devicestoragemonitor:
diskstats:
dropbox:
entropy:
hardware:
input_method:
iphonesubinfo:
isms:
location:
media.audio_flinger:
media.audio_policy:
media.camera:
media.player:
meminfo:
mount:
netstat:
network_management:
notification:
package:
permission:
phone:
power:
search:
sensorservice:
simphonebook:
statusbar:
telephony.registry:
throttle:
uimode:
usagestats:
 vibrator:
wallpaper:
wifi:
window:

2. adb shell service list

输出结果如下:

Found 49 services:
0       phone: [com.android.internal.telephony.ITelephony]
1       iphonesubinfo: [com.android.internal.telephony.IPhoneSubInfo]
2       simphonebook: [com.android.internal.telephony.IIccPhoneBook]
3       isms: [com.android.internal.telephony.ISms]
4       diskstats: []
5       appwidget: [com.android.internal.appwidget.IAppWidgetService]
6       backup: [android.app.backup.IBackupManager]
7       uimode: [android.app.IUiModeManager]
8       audio: [android.media.IAudioService]
9       wallpaper: [android.app.IWallpaperManager]
10      dropbox: [com.android.internal.os.IDropBoxManagerService]
11      search: [android.app.ISearchManager]
12      location: [android.location.ILocationManager]
13      devicestoragemonitor: []
14      notification: [android.app.INotificationManager]
15      mount: [IMountService]
16      accessibility: [android.view.accessibility.IAccessibilityManager]
17      throttle: [android.net.IThrottleManager]
18      connectivity: [android.net.IConnectivityManager]
19      wifi: [android.net.wifi.IWifiManager]
20      network_management: [android.os.INetworkManagementService]
21      netstat: [android.os.INetStatService]
22      input_method: [com.android.internal.view.IInputMethodManager]
23      clipboard: [android.text.IClipboard]
24      statusbar: [com.android.internal.statusbar.IStatusBarService]
25      device_policy: [android.app.admin.IDevicePolicyManager]
26      window: [android.view.IWindowManager]
27      alarm: [android.app.IAlarmManager]
28      vibrator: [android.os.IVibratorService]
29      hardware: [android.os.IHardwareService]
30      battery: []
31      content: [android.content.IContentService]
32      account: [android.accounts.IAccountManager]
33      permission: [android.os.IPermissionController]
34      cpuinfo: []
35      meminfo: []
36      activity: [android.app.IActivityManager]
37      package: [android.content.pm.IPackageManager]
38      telephony.registry: [com.android.internal.telephony.ITelephonyRegistry]
39      usagestats: [com.android.internal.app.IUsageStats]
40      batteryinfo: [com.android.internal.app.IBatteryStats]
41      power: [android.os.IPowerManager]
42      entropy: []
43      sensorservice: [android.gui.SensorServer]
44      SurfaceFlinger: [android.ui.ISurfaceComposer]
45      media.audio_policy: [android.media.IAudioPolicyService]
46      media.camera: [android.hardware.ICameraService]
47      media.player: [android.media.IMediaPlayerService]
48      media.audio_flinger: [android.media.IAudioFlinger]

查询到运行的system service后,就可以在dumpsys后面加上service的名字,查看指定的service信息。

adb shell dumpsys activity

adb shell dumpsys cpuinfo

adb shell dumpsys battery

adb shell dumpsys window(最后部分可以看到分辨率的信息)

有些service能够接收额外的参数,我们可以使用-h查看帮助信息。

adb shell dumpsys package -h

adb shell dumpsys activity -h

你可能感兴趣的:(adb shell dumpsys的使用)