前言
adb shell dumpsys命令用于打印出当前系统信息,也可以在命令后面加指定的查询的名称,还可以查询顶部运行的Activity
正文
查询服务
方式一
adb shell dumpsys > log.txt
输出dumpsys新增到log.txt中,然后找到如下日志,表示启动的服务
Currently running services: DockObserver SurfaceFlinger accessibility account activity alarm android.security.keystore android.service.gatekeeper.IGateKeeperServicexxxxxxxxxx Currently running services:Currently running services: DockObserver SurfaceFlinger accessibility account activity alarm android.security.keystore android.service.gatekeeper.IGateKeeperService 略
打印的信息很多,只要关注自己需要的部分,比如service,Activity等即可。
方式二
adb shell service list
日志输入如下(部分)
Found 133 services: 0 car_service: [android.car.ICar] 1 telecom: [com.android.internal.telecom.ITelecomService] 2 x_car: [android.x.car.ICarStatus] 3 contexthub: [android.hardware.location.IContextHubService] 4 netd_listener: [android.net.metrics.INetdEventListener] 5 connmetrics: [android.net.IIpConnectivityMetrics] 6 bluetooth_manager: [android.bluetooth.IBluetoothManager] 7 imms: [com.android.internal.telephony.IMms] 8 statscompanion: [android.os.IStatsCompanionService] 9 media.camera.proxy: [android.hardware.ICameraServiceProxy] 10 media_projection: [android.media.projection.IMediaProjectionManager] 11 crossprofileapps: [android.content.pm.ICrossProfileApps] 12 launcherapps: [android.content.pm.ILauncherApps] 13 shortcut: [android.content.pm.IShortcutService]
当然,信息还是很多,但我们可以过滤。比如查找media相关的服务
adb shell service list | findstr media # 或 adb shell service list | grep media
grep需要对应环境,如果没有就用findstr
查看顶层Activity
Linux系统
adb shell dumpsys activity | grep "mFocusedActivity"
Window系统
adb shell dumpsys activity | findstr "mFocusedActivity"
查询其他系统信息
# activity信息 adb shell dumpsys activity # cpu信息 adb shell dumpsys cpuinfo # 电池信息 adb shell dumpsys battery # 最后部分可以看到分辨率的信息 adb shell dumpsys window # 查看分辨率 adb shell wm size
参考文章
《》
© 版权声明