adb shell dumpsys related commands in Android

Many times, we will also use adb shell dumpsys related commands from time to time, such as:
view the relevant information of the Activity (enter the package name to view the Activity information of the specific package name):

adb shell dumpsys activity [包名]

View battery related information (enter the package name to view the battery information of the specific package name):

adb shell dumpsys batterystats [包名]

View Location related information:

adb shell dumpsys location

However, the meaning of it may not be known to many people, and I am one of them.
write picture description here

In fact, the adb shell dumpsys command is used to print out the current system information (more precisely, the dumpsys command, because adb shell is only to enter the shell kernel of the mobile phone or emulator, so that it can execute the dumpsys command), you can follow the command Add the specified service name (such as activity, location), if not, the information of all services in the device will be printed out by default.
The service name that can be added after adb shell dumpsys can be obtained by adb shell dumpsysor adb shell service listmethod. 1. The output information of
adb shell dumpsys
The beginning part is all running services, as follows:

Currently running services:
  DmAgent
  DockObserver
  GuiExtService
  IIccPhoneBookMz
  NvRAMAgent
  PPLAgent
  SurfaceFlinger
  access_control
  accessibility
  account
  activity
  alarm
  alphame_server
  android.security.keystore
  anrmanager
  appops
  appwidget
  audio
  backup
  battery
  batteryproperties
  batterystats
  bluetooth_manager
  clipboard
  commontime_management
  connectivity
  consumer_ir
  content
  country_detector
  cpuinfo
  dbinfo
  device_control
  device_policy
  device_states
  devicestoragemonitor
  diskstats
  display
  dreams
  drm.drmManager
  dropbox
  entropy
  fingerprint
  fingerprints_service
  flyme_error_report_manager
  flyme_novccusagestats
  flyme_packagemanager
  flyme_permission
  flyme_splitmode
  flyme_statusbar
  flyme_theme_service
  flyme_wallpaper
  gesture_manager
  gfxinfo
  hardware
  hips_service
  imms
  input
  input_method
  iphonesubinfo
  isms
  isub
  jobscheduler
  launcherapps
  location
  lock_settings
  media.audio_flinger
  media.audio_policy
  media.camera
  media.mmsdk
  media.player
  media.sound_trigger_hw
  media_projection
  media_router
  media_session
  meizu.camera
  meminfo
  memory_dumper
  mobile
  mount
  move_window
  mtk-perfservice
  mtk.codecservice
  netpolicy
  netstats
  network_management
  network_score
  networkmanagement_service_flyme
  notification
  package
  permission
  phone
  phoneEx
  phone_ext
  power
  pppoe
  print
  procstats
  program_binary
  recovery
  restrictions
  rttmanager
  samba_client
  samba_server
  samplingprofiler
  scheduling_policy
  search
  search_engine
  sensorservice
  serial
  servicediscovery
  simphonebook
  sip
  statusbar
  telecom
  telephony.registry
  textservices
  trust
  uimode
  updatelock
  usagestats
  usb
  user
  vibrator
  voiceinteraction
  wallpaper
  webviewupdate
  wifi
  wifip2p
  wifiscanner
  window


2. The output of adb shell service list is as follows:

Found 130 services:
0   flyme_novccusagestats: [android.nonvccUsageStats.INonVccStatsInterfaces]
1   sip: [android.net.sip.ISipService]
2   telecom: [com.android.internal.telecom.ITelecomService]
3   phone_ext: [android.telephony.ITelephonyExt]
4   phoneEx: [com.mediatek.internal.telephony.ITelephonyEx]
5   phone: [com.android.internal.telephony.ITelephony]
6   IIccPhoneBookMz: [com.android.internal.telephony.meizu.IIccPhoneBookMz]
7   isms: [com.android.internal.telephony.ISms]
8   iphonesubinfo: [com.android.internal.telephony.IPhoneSubInfo]
9   simphonebook: [com.android.internal.telephony.IIccPhoneBook]
10  fingerprints_service: [com.fingerprints.service.IFingerprintService]
11  isub: [com.android.internal.telephony.ISub]
12  alphame_server: [com.meizu.common.alphame.IAlphaMe]
13  flyme_splitmode: [meizu.splitmode.IFlymeSplitModeService]
14  flyme_packagemanager: [android.content.pm.IFlymePackageManager]
15  flyme_wallpaper: [meizu.wallpaper.IFlymeWallpaper]
16  device_states: [meizu.os.IDeviceStateService]
17  flyme_theme_service: [android.content.res.flymetheme.IFlymeThemeManager]
18  hips_service: [meizu.hips.IFlymeHipsService]
19  flyme_permission: [meizu.security.IFlymePermissionService]
20  device_control: [meizu.os.IDeviceControlService]
21  gesture_manager: [android.view.IGestureManager]
22  access_control: [meizu.security.IAccessControlManager]
23  move_window: [meizu.view.IMoveWindow]
24  imms: [com.android.internal.telephony.IMms]
25  media_projection: [android.media.projection.IMediaProjectionManager]
26  mtk-perfservice: [com.mediatek.perfservice.IPerfService]
27  launcherapps: [android.content.pm.ILauncherApps]
28  fingerprint: [android.service.fingerprint.IFingerprintService]
29  trust: [android.app.trust.ITrustManager]
30  media_router: [android.media.IMediaRouterService]
31  media_session: [android.media.session.ISessionManager]
32  restrictions: [android.content.IRestrictionsManager]
33  print: [android.print.IPrintManager]
34  dreams: [android.service.dreams.IDreamManager]
35  commontime_management: []
36  samplingprofiler: []
37  diskstats: []
38  voiceinteraction: [com.android.internal.app.IVoiceInteractionManagerService]
39  appwidget: [com.android.internal.appwidget.IAppWidgetService]
40  backup: [android.app.backup.IBackupManager]
41  jobscheduler: [android.app.job.IJobScheduler]
42  uimode: [android.app.IUiModeManager]
43  serial: [android.hardware.ISerialManager]
44  usb: [android.hardware.usb.IUsbManager]
45  DockObserver: []
46  audio: [android.media.IAudioService]
47  wallpaper: [android.app.IWallpaperManager]
48  dropbox: [com.android.internal.os.IDropBoxManagerService]
49  search_engine: [com.mediatek.search.ISearchEngineManagerService]
50  search: [android.app.ISearchManager]
51  country_detector: [android.location.ICountryDetector]
52  location: [android.location.ILocationManager]
53  devicestoragemonitor: []
54  notification: [android.app.INotificationManager]
55  updatelock: [android.os.IUpdateLock]
56  servicediscovery: [android.net.nsd.INsdManager]
57  samba_client: [meizu.samba.client.ISambaClientManager]
58  samba_server: [meizu.samba.server.ISambaServerManager]
59  pppoe: [android.net.pppoe.IPppoeManager]
60  connectivity: [android.net.IConnectivityManager]
61  rttmanager: [android.net.wifi.IRttManager]
62  wifiscanner: [android.net.wifi.IWifiScanner]
63  wifi: [android.net.wifi.IWifiManager]
64  wifip2p: [android.net.wifi.p2p.IWifiP2pManager]
65  netpolicy: [android.net.INetworkPolicyManager]
66  netstats: [android.net.INetworkStatsService]
67  network_score: [android.net.INetworkScoreService]
68  textservices: [com.android.internal.textservice.ITextServicesManager]
69  networkmanagement_service_flyme: [android.os.INetworkManagementServiceFlyme]
70  network_management: [android.os.INetworkManagementService]
71  clipboard: [android.content.IClipboard]
72  flyme_statusbar: [meizu.statusbar.IFlymeStatusBarService]
73  statusbar: [com.android.internal.statusbar.IStatusBarService]
74  device_policy: [android.app.admin.IDevicePolicyManager]
75  lock_settings: [com.android.internal.widget.ILockSettings]
76  mount: [IMountService]
77  accessibility: [android.view.accessibility.IAccessibilityManager]
78  input_method: [com.android.internal.view.IInputMethodManager]
79  bluetooth_manager: [android.bluetooth.IBluetoothManager]
80  input: [android.hardware.input.IInputManager]
81  window: [android.view.IWindowManager]
82  alarm: [android.app.IAlarmManager]
83  consumer_ir: [android.hardware.IConsumerIrService]
84  vibrator: [android.os.IVibratorService]
85  mobile: [com.mediatek.common.mom.IMobileManagerService]
86  content: [android.content.IContentService]
87  account: [android.accounts.IAccountManager]
88  entropy: []
89  telephony.registry: [com.android.internal.telephony.ITelephonyRegistry]
90  scheduling_policy: [android.os.ISchedulingPolicyService]
91  webviewupdate: [android.webkit.IWebViewUpdateService]
92  usagestats: [android.app.usage.IUsageStatsManager]
93  battery: []
94  hardware: [android.os.IHardwareService]
95  flyme_error_report_manager: [android.app.IFlymeErrorReportManager]
96  anrmanager: [android.app.IANRManager]
97  permission: [android.os.IPermissionController]
98  cpuinfo: []
99  dbinfo: []
100 gfxinfo: []
101 meminfo: []
102 procstats: [com.android.internal.app.IProcessStats]
103 activity: [android.app.IActivityManager]
104 user: [android.os.IUserManager]
105 package: [android.content.pm.IPackageManager]
106 media.mmsdk: [com.mediatek.mmsdk.IMMSdkService]
107 media.sound_trigger_hw: [android.hardware.ISoundTriggerHwService]
108 media.audio_policy: [android.media.IAudioPolicyService]
109 media.camera: [android.hardware.ICameraService]
110 recovery: [com.mediatek.recovery.IRecoveryManagerService]
111 display: [android.hardware.display.IDisplayManager]
112 power: [android.os.IPowerManager]
113 appops: [com.android.internal.app.IAppOpsService]
114 batterystats: [com.android.internal.app.IBatteryStats]
115 sensorservice: [android.gui.SensorServer]
116 meizu.camera: [meizu.camera.ICameraService]
117 memory_dumper: [android.memory.IMemoryDumper]
118 media.player: [android.media.IMediaPlayerService]
119 SurfaceFlinger: [android.ui.ISurfaceComposer]
120 drm.drmManager: [drm.IDrmManagerService]
121 media.audio_flinger: [android.media.IAudioFlinger]
122 batteryproperties: [android.os.IBatteryPropertiesRegistrar]
123 program_binary: []
124 mtk.codecservice: []
125 GuiExtService: [GuiExtService]
126 android.security.keystore: [android.security.keystore]
127 NvRAMAgent: [NvRAMAgent]
128 DmAgent: []
129 PPLAgent: []

After querying the running system service through the above two methods, you can add the service name after dumpsys to view the specified service information.

// 查看Activity相关信息
adb shell dumpsys activity
// 查看CPU相关信息
adb shell dumpsys cpuinfo
// 查看电池使用信息
adb shell dumpsys battery
//查看Window的相关信息,最后部分可以看到分辨率的信息
adb shell dumpsys window

Some services can accept additional parameters, we can use -h to see help information.

// 查看package这个service的帮助信息
adb shell dumpsys package -h
// 查看activity这个service的帮助信息
adb shell dumpsys activity -h

refer to

The use of adb shell dumpsys

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325840425&siteId=291194637