android开发笔记之adb shell dumpsys

这里写图片描述

  • 列出dumpsys所有支持命令
adb shell dumpsys | grep -i "DUMP OF SERVICE"
android@tesdt-Precision-T1700:~/Desktop$ adb shell dumpsys | grep -i "DUMP OF SERVICE"
DUMP OF SERVICE AAL:
DUMP OF SERVICE DmAgent:
DUMP OF SERVICE DockObserver:
DUMP OF SERVICE GoogleOtaBinder:
DUMP OF SERVICE GpuAppSpectatorService:
DUMP OF SERVICE GuiExtService:
DUMP OF SERVICE NvRAMAgent:
DUMP OF SERVICE PPLAgent:
DUMP OF SERVICE PQ:
DUMP OF SERVICE SurfaceFlinger:
DUMP OF SERVICE accessibility:
DUMP OF SERVICE account:
DUMP OF SERVICE activity:
DUMP OF SERVICE alarm:
DUMP OF SERVICE android.hardware.fingerprint.IFingerprintDaemon:
DUMP OF SERVICE android.security.keystore:
DUMP OF SERVICE anrmanager:
DUMP OF SERVICE appops:
DUMP OF SERVICE appwidget:
DUMP OF SERVICE assetatlas:
DUMP OF SERVICE audio:
DUMP OF SERVICE audioprofile:
DUMP OF SERVICE backup:
DUMP OF SERVICE battery:
DUMP OF SERVICE batteryproperties:
DUMP OF SERVICE batterystats:
DUMP OF SERVICE bluetooth_manager:
DUMP OF SERVICE carrier_config:
DUMP OF SERVICE clipboard:
DUMP OF SERVICE commontime_management:
DUMP OF SERVICE connectivity:
DUMP OF SERVICE consumer_ir:
DUMP OF SERVICE content:
DUMP OF SERVICE country_detector:
DUMP OF SERVICE cpuinfo:
DUMP OF SERVICE dbinfo:
DUMP OF SERVICE device_policy:
DUMP OF SERVICE deviceidle:
DUMP OF SERVICE devicestoragemonitor:
DUMP OF SERVICE diskstats:
DUMP OF SERVICE display:
DUMP OF SERVICE dreams:
DUMP OF SERVICE drm.drmManager:
DUMP OF SERVICE dropbox:
DUMP OF SERVICE ethernet:
DUMP OF SERVICE fingerprint:
DUMP OF SERVICE gfxinfo:
DUMP OF SERVICE graphicsstats:
DUMP OF SERVICE imms:
DUMP OF SERVICE input:
DUMP OF SERVICE input_method:
DUMP OF SERVICE iphonesubinfo:
DUMP OF SERVICE isms:
DUMP OF SERVICE isub:
DUMP OF SERVICE jobscheduler:
DUMP OF SERVICE launcherapps:
DUMP OF SERVICE location:
DUMP OF SERVICE lock_settings:
DUMP OF SERVICE media.VTS:
DUMP OF SERVICE media.audio_flinger:
DUMP OF SERVICE media.audio_policy:
DUMP OF SERVICE media.camera:
DUMP OF SERVICE media.camera.proxy:
DUMP OF SERVICE media.mmsdk:
DUMP OF SERVICE media.player:
DUMP OF SERVICE media.radio:
DUMP OF SERVICE media.resource_manager:
DUMP OF SERVICE media.sound_trigger_hw:
DUMP OF SERVICE media_projection:
DUMP OF SERVICE media_router:
DUMP OF SERVICE media_session:
DUMP OF SERVICE meminfo:
DUMP OF SERVICE memory_dumper:
DUMP OF SERVICE mobile:
DUMP OF SERVICE mount:
DUMP OF SERVICE mtk-perfservice:
DUMP OF SERVICE mtk.codecservice:
DUMP OF SERVICE netpolicy:
DUMP OF SERVICE netstats:
DUMP OF SERVICE network_management:
DUMP OF SERVICE network_score:
DUMP OF SERVICE notification:
DUMP OF SERVICE package:
DUMP OF SERVICE permission:
DUMP OF SERVICE persistent_data_block:
DUMP OF SERVICE phone:
DUMP OF SERVICE phoneEx:
DUMP OF SERVICE power:
DUMP OF SERVICE print:
DUMP OF SERVICE processinfo:
DUMP OF SERVICE procstats:
DUMP OF SERVICE program_binary:
DUMP OF SERVICE recovery:
DUMP OF SERVICE restrictions:
DUMP OF SERVICE rttmanager:
DUMP OF SERVICE samplingprofiler:
DUMP OF SERVICE scheduling_policy:
DUMP OF SERVICE search:
DUMP OF SERVICE search_engine:
DUMP OF SERVICE sensorservice:
DUMP OF SERVICE serial:
DUMP OF SERVICE servicediscovery:
DUMP OF SERVICE simphonebook:
DUMP OF SERVICE statusbar:
DUMP OF SERVICE telecom:
DUMP OF SERVICE telephony.registry:
DUMP OF SERVICE textservices:
DUMP OF SERVICE trust:
DUMP OF SERVICE uimode:
DUMP OF SERVICE updatelock:
DUMP OF SERVICE usagestats:
DUMP OF SERVICE usb:
DUMP OF SERVICE user:
DUMP OF SERVICE vibrator:
DUMP OF SERVICE voiceinteraction:
DUMP OF SERVICE wallpaper:
DUMP OF SERVICE webviewupdate:
DUMP OF SERVICE wifi:
DUMP OF SERVICE wifip2p:
DUMP OF SERVICE wifiscanner:
DUMP OF SERVICE window:
  • 查看手机分辨率:
    第一种方法:
adb shell dumpsys window displays
android@tesdt-Precision-T1700:~/Desktop$ adb shell dumpsys window displays
Dump time : 2016108日 下午10:29:22
WINDOW MANAGER DISPLAY CONTENTS (dumpsys window displays)
  Display: mDisplayId=0
    init=720x1280 320dpi cur=720x1280 app=720x1184 rng=720x672-1196x1136
    deferred=false layoutNeeded=false

第二种方法:

adb shell dumpsys window | grep init
android@tesdt-Precision-T1700:~/Desktop$ adb shell dumpsys window | grep init
    init=720x1280 320dpi cur=720x1280 app=720x1184 rng=720x672-1196x1136

其实这二种方法都是依赖对手机所有的window信息的查看:

adb shell dumpsys window

我们可以查看当前手机所有的windows详细信息:

adb shell dumpsys window windows
  • 查看当前所有的activity
adb shell dumpsys activity activities > activities.txt
adb shell dumpsys activity
  • 查看当前是那个activity
adb shell dumpsys activity | grep -i foc
android@tesdt-Precision-T1700:~/Desktop$ adb shell dumpsys activity | grep -i foc
  * ContentProviderRecord{3256fca u0 com.google.android.gms/.ads.adinfo.AdvertisingInfoContentProvider}
  mFocusedActivity: ActivityRecord{7f917de u0 zxzs.ppgj/.ui.activity.WelComeActivity t529}
  mFocusedStack=ActivityStack{d77cf31 stackId=2, 1 tasks} mLastFocusedStack=ActivityStack{d77cf31 stackId=2, 1 tasks}
  • 查看电池的状态信息:
adb shell dumpsys battery
android@tesdt-Precision-T1700:~/Desktop$ adb shell dumpsys battery
Current Battery Service state:
  AC powered: false
  USB powered: true
  Wireless powered: false
  status: 2
  status: 1
  health: 2
  present: true
  present: false
  level: 46
  level: 50
  scale: 100
  voltage: 3862
  temperature: 350
  technology: Li-ion

查看壁纸的信息:

adb shell dumpsys wallpaper
adb shell dumpsys wallpaper
Current Wallpaper Service state:
 User 0:
  mWidth=720 mHeight=1280
  mPadding=Rect(0, 0 - 0, 0)
  mName=
  mWallpaperComponent=ComponentInfo{com.android.systemui/com.android.systemui.ImageWallpaper}
  Wallpaper connection com.android.server.wallpaper.WallpaperManagerService$WallpaperConnection@c594aea:
    mToken=android.os.Binder@1f92bb6
    mService=android.service.wallpaper.IWallpaperService$Stub$Proxy@7f9ec44
    mEngine=android.service.wallpaper.IWallpaperEngine$Stub$Proxy@bfe812d
    mLastDiedTime=-1311618
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

hfreeman2008

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值