Android ADB activity和service命令

来源:互联网 发布:守卫剑阁降龙伏虎数据 编辑:程序博客网 时间:2024/05/27 00:46


查看手机各类服务的项目:

adb shell service list;


查看应用的内存使用情况:

adb shell dumpsys meminfo $package_name or $pid    


查看servicecs使用细节

adb shell dumpsys activity services

查看activity使用细节

adb shell dumpsys activity

dumpsys命令可以显示手机中所有应用程序的信息,并且也会给出现在手机的状态。

直接执行adb shell dumpsys会显示以下所有信息。

1
SurfaceFlinger, accessibility, account, activity, alarm, appwidget, audio, backup, battery, batteryinfo, bluetooth, bluetooth_a2dp, clipboard, connectivity, content, cpuinfo, device_policy, devicestoragemonitor, diskstats, dropbox, entropy, hardware, hdmi, 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, sensor, simphonebook, statusbar, telephony.registry, throttle, uimode, usagestats, vibrator, wallpaper, wifi, window

dumpsys的参数可以跟以上信息的名字。例如:

adb shell dumpsys activity 显示activity相关的信息

adb shell dumpsys statusbar 显示状态栏相关的信息

adb shell dumpsys meminfo $package_name or $pid 使用程序的包名或者进程id显示内存信息

可以通过这个命令实现很多有用的小应用,比如内存信息相关的,状态栏的通知都是哪个应用谈出来的等等。

我通过这个命令写了一个小应用”找出状态栏广告的主人“。普通通知很容易辨认是哪个应用的,广告就不好辨认了。

其实应用就相当于一条shell命令:

adb shell dumpsys statusbar | grep notification=Notification

这条命令可以找出状态栏通知的包名,进而找到是哪个应用。

这个点子来自:http://www.maxhis.info/archives/731

只是我把它做成了手机上应用。需要注意的是这个应用需要root权限才能执行!

还有很多可以做的,找住对你有用的吧!


1 0