dumpsys activity 相关命令解析

相关命令:
adb shell dumpsys activity-------------------AMS所有信息
adb shell dumpsys activity activities--------Activity组件信息
adb shell dumpsys activity services----------Service组件信息
adb shell dumpsys activity providers---------ContentProvider组件信息
adb shell dumpsys activity broadcasts--------BraodcastReceiver信息
adb shell dumpsys activity intents-----------Intent信息
adb shell dumpsys activity processes---------进程信息

1.adb shell dumpsys activity activities
ACTIVITY MANAGER ACTIVITIES (dumpsys activity activities)
其中的一部分:

Stack #3: type=standard mode=fullscreen
isSleeping=false
mBounds=Rect(0, 0 - 0, 0)

Task id #95
mBounds=Rect(0, 0 - 0, 0)
mMinWidth=-1
mMinHeight=-1
mLastNonFullscreenBounds=null
* TaskRecord{7f1098c #95 A=com.royole.gallery U=0 StackId=3 sz=1}
  userId=0 effectiveUid=u0a48 mCallingUid=1000 mUserSetupComplete=true mCallingPackage=com.android.launcher3  //被launcher调用起来的
  affinity=com.royole.gallery
  intent={act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=com.royole.gallery/.customer.home.GalleryActivity}
  mActivityComponent=com.royole.gallery/.customer.home.GalleryActivity
  autoRemoveRecents=false isPersistable=true numFullscreen=1 activityType=1
  rootWasReset=true mNeverRelinquishIdentity=true mReuseTask=false mLockTaskAuth=LOCK_TASK_AUTH_PINNABLE
  Activities=[ActivityRecord{5249c3c u0 com.royole.gallery/.customer.home.GalleryActivity t95}]
  askedCompatMode=false inRecents=true isAvailable=true
  mRootProcess=ProcessRecord{8b3916e 6058:com.royole.gallery/u0a48}
  stackId=3
  hasBeenVisible=true mResizeMode=RESIZE_MODE_RESIZEABLE_VIA_SDK_VERSION mSupportsPictureInPicture=false isResizeable=true lastActiveTime=2030600 (inactive for 11s)
  * Hist #0: ActivityRecord{5249c3c u0 com.royole.gallery/.customer.home.GalleryActivity t95}
      packageName=com.royole.gallery processName=com.royole.gallery
      launchedFromUid=1000 launchedFromPackage=com.android.launcher3 userId=0
      app=ProcessRecord{8b3916e 6058:com.royole.gallery/u0a48}
      Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=com.royole.gallery/.customer.home.GalleryActivity bnds=[907,1050][1200,1298] }
      frontOfTask=true task=TaskRecord{7f1098c #95 A=com.royole.gallery U=0 StackId=3 sz=1}
      taskAffinity=com.royole.gallery
      mActivityComponent=com.royole.gallery/.customer.home.GalleryActivity
      baseDir=/system/priv-app/RyGallery_royole/RyGallery_royole.apk
      dataDir=/data/user/0/com.royole.gallery
      stateNotNeeded=false componentSpecified=true mActivityType=standard
      compat={320dpi always-compat} labelRes=0x7f11004c icon=0x7f0e0003 theme=0x7f120016
      mLastReportedConfigurations:
       mGlobalConfig={ 1.0 ?mcc?mnc [zh_CN] ldltr sw760dp w760dp h738dp 320dpi lrg hdr port finger -keyb/v/h -nav/h winConfig={ mBounds=Rect(0, 0 - 1520, 1620) mAppBounds=Rect(0, 0 - 1520, 1524) mWindowingMode=fullscreen mDisplayWindowingMode=fullscreen mActivityType=undefined mAlwaysOnTop=undefined mRotation=ROTATION_0} s.19}
       mOverrideConfig={ 1.0 ?mcc?mnc [zh_CN] ldltr sw760dp w760dp h738dp 320dpi lrg hdr port finger -keyb/v/h -nav/h winConfig={ mBounds=Rect(0, 0 - 1520, 1620) mAppBounds=Rect(0, 0 - 1520, 1524) mWindowingMode=fullscreen mDisplayWindowingMode=fullscreen mActivityType=standard mAlwaysOnTop=undefined mRotation=ROTATION_0} s.1}
      CurrentConfiguration={ 1.0 ?mcc?mnc [zh_CN] ldltr sw760dp w760dp h738dp 320dpi lrg hdr port finger -keyb/v/h -nav/h winConfig={ mBounds=Rect(0, 0 - 1520, 1620) mAppBounds=Rect(0, 0 - 1520, 1524) mWindowingMode=fullscreen mDisplayWindowingMode=fullscreen mActivityType=standard mAlwaysOnTop=undefined mRotation=ROTATION_0} s.1}
      taskDescription: label="null" icon=null iconResource=0 iconFilename=null primaryColor=ffffffff
       backgroundColor=fffafafa
       statusBarColor=0
       navigationBarColor=0
      launchFailed=false launchCount=0 lastLaunchTime=-12s549ms
      haveState=true icicle=Bundle[mParcelledData.dataSize=3784]
      state=STOPPED stopped=true delayedResume=false finishing=false    //因为visible=false所以state=STOPPED
      keysPaused=false inHistory=true visible=false sleeping=false idle=true mStartingWindowState=STARTING_WINDOW_REMOVED
      fullscreen=true noDisplay=false immersive=false launchMode=0
      frozenBeforeDestroy=false forceNewConfig=false
      mActivityType=standard
       nowVisible=false lastVisibleTime=-12s104ms
      connections={ConnectionRecord{e9ae89c u0 CR com.royole.gallery/.app.BatchService:@3d8a00f}}
      resizeMode=RESIZE_MODE_RESIZEABLE_VIA_SDK_VERSION
      mLastReportedMultiWindowMode=false mLastReportedPictureInPictureMode=false

Running activities (most recent first):
  TaskRecord{7f1098c #95 A=com.royole.gallery U=0 StackId=3 sz=1}
    Run #0: ActivityRecord{5249c3c u0 com.royole.gallery/.customer.home.GalleryActivity t95}

mLastPausedActivity: ActivityRecord{5249c3c u0 com.royole.gallery/.customer.home.GalleryActivity t95}

2.adb shell dumpsys activity broadcasts
ACTIVITY MANAGER BROADCAST STATE (dumpsys activity broadcasts)
打印的信息包括以下几个部分:
Registered Receivers:所有注册的广播接受者
Historical broadcasts [foreground]:前台广播的历史记录
Historical broadcasts [background]:后台广播的历史记录
如一条具体的广播打印信息:

  • ReceiverList{fb3d82f 5084 com.sohu.inputmethod.sogou.oem/10094/u0 remote:1d6160e}
    app=5084:com.sohu.inputmethod.sogou.oem/u0a94 pid=5084 uid=10094 user=0
    Filter #0: BroadcastFilter{ecb8e3c}
    Action: “android.intent.action.PACKAGE_ADDED”
    Scheme: “package”

Historical Broadcast background #13:
BroadcastRecord{4f6d5da u255 android.intent.action.PACKAGE_ADDED} to user 255
Intent { act=android.intent.action.PACKAGE_ADDED dat=package:com.tencent.mm flg=0x4000010 (has extras) }
extras: Bundle[{android.intent.extra.UID=25510150, android.intent.extra.user_handle=255}]
caller=null null pid=843 uid=1000
enqueueClockTime=2020-11-05 10:24:49.014 dispatchClockTime=2020-11-05 10:24:49.678
dispatchTime=-4s132ms (+664ms since enq) finishTime=-4s128ms (+4ms since disp)
resultTo=null resultCode=0 resultData=null

#13: act=android.intent.action.PACKAGE_ADDED dat=package:com.tencent.mm flg=0x4000010 (has extras)
+664ms dispatch +4ms finish
enq=2020-11-05 10:24:49.014 disp=2020-11-05 10:24:49.678 fin=2020-11-05 10:24:49.682
extras: Bundle[{android.intent.extra.UID=25510150, android.intent.extra.user_handle=255}]

3.adb shell dumpsys activity services

//其中的一部分

  • ServiceRecord{b0d6432 u0 com.royole.webappstore/.model.download.service.DownloadService}
    intent={cmp=com.royole.webappstore/.model.download.service.DownloadService}
    packageName=com.royole.webappstore
    processName=com.royole.webappstore
    baseDir=/system/app/WebAppStore_royole/WebAppStore_royole.apk
    dataDir=/data/user/0/com.royole.webappstore
    app=ProcessRecord{80f38ea 3838:com.royole.webappstore/u0a84}
    isForeground=true foregroundId=800 foregroundNoti=Notification(channel=RY_DO_NOT_SHOW_CHANNEL pri=0 contentView=null vibrate=null sound=null defaults=0x0 flags=0x7a color=0x00000000 vis=PRIVATE)
    createTime=-1h29m25s882ms startingBgTimeout=–
    lastActivity=-55m55s133ms restartTime=-1h29m25s882ms createdFromFg=true
    startRequested=true delayedStop=false stopIfKilled=false callStart=true lastStartId=3

常用的基本就是Activity及Broadcast相关的信息,后面的就不一一贴出来了。

猜你喜欢

转载自blog.csdn.net/hanhan1016/article/details/111404585