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

你可能感兴趣的:(android开发笔记,android开发笔记)