adb获取activity信息
16lz
2021-12-22
获取activity栈
adb shell dumpsys activity activities
结果如下:
➜ ~ adb shell dumpsys activity activitiesACTIVITY MANAGER ACTIVITIES (dumpsys activity activities)Display #0 (activities from top to bottom): Stack #306: type=standard mode=fullscreen isSleeping=false mBounds=Rect(0, 0 - 0, 0) Task id #3552 mBounds=Rect(0, 0 - 0, 0) mMinWidth=-1 mMinHeight=-1 mLastNonFullscreenBounds=null * TaskRecord{c26bd56 #3552 A=com.tomes.sharefile U=0 StackId=306 sz=1} userId=0 effectiveUid=u0a402 mCallingUid=u0a74 mUserSetupComplete=true mCallingPackage=com.huawei.android.launcher affinity=com.tomes.sharefile intent={act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=com.tomes.sharefile/.MainActivity} mActivityComponent=com.tomes.sharefile/.MainActivity autoRemoveRecents=false isPersistable=true numFullscreen=1 activityType=1 rootWasReset=true mNeverRelinquishIdentity=true mReuseTask=false mLockTaskAuth=LOCK_TASK_AUTH_PINNABLE Activities=[ActivityRecord{c260ac6 u0 com.tomes.sharefile/.MainActivity t3552}] askedCompatMode=false inRecents=true isAvailable=true mRootProcess=ProcessRecord{c4c1a99 28059:com.tomes.sharefile/u0a402} stackId=306 hasBeenVisible=true mResizeMode=RESIZE_MODE_RESIZEABLE_VIA_SDK_VERSION mSupportsPictureInPicture=false isResizeable=true lastActiveTime=176778686 (inactive for 101s) * Hist #0: ActivityRecord{c260ac6 u0 com.tomes.sharefile/.MainActivity t3552} packageName=com.tomes.sharefile processName=com.tomes.sharefile launchedFromUid=10074 launchedFromPackage=com.huawei.android.launcher userId=0 app=ProcessRecord{c4c1a99 28059:com.tomes.sharefile/u0a402} Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=com.tomes.sharefile/.MainActivity bnds=[43,734][295,1038] } frontOfTask=true task=TaskRecord{c26bd56 #3552 A=com.tomes.sharefile U=0 StackId=306 sz=1} taskAffinity=com.tomes.sharefile mActivityComponent=com.tomes.sharefile/.MainActivity baseDir=/data/app/com.tomes.sharefile-3XLG3xLwK0jwktqbbfo-Ng==/base.apk dataDir=/data/user/0/com.tomes.sharefile stateNotNeeded=false componentSpecified=true mActivityType=standard compat={480dpi} labelRes=0x7f0b0027 icon=0x7f0a0000 theme=0x7f0c0005 mLastReportedConfigurations: mGlobalConfig={1.0 ?mcc?mnc [zh_CN_#Hans] ldltr sw360dp w360dp h714dp 480dpi nrml long hdr port finger -keyb/v/h -nav/h winConfig={ mBounds=Rect(0, 0 - 1080, 2340) mAppBounds=Rect(0, 81 - 1080, 2224) mWindowingMode=fullscreen mDisplayWindowingMode=fullscreen mActivityType=undefined mAlwaysOnTop=undefined mRotation=ROTATION_0} suim:1 s.8} mOverrideConfig={1.0 ?mcc?mnc [zh_CN_#Hans] ldltr sw360dp w360dp h714dp 480dpi nrml long hdr port finger -keyb/v/h -nav/h winConfig={ mBounds=Rect(0, 0 - 1080, 2340) mAppBounds=Rect(0, 81 - 1080, 2224) mWindowingMode=fullscreen mDisplayWindowingMode=fullscreen mActivityType=standard mAlwaysOnTop=undefined mRotation=ROTATION_0} suim:1 s.1} CurrentConfiguration={1.0 ?mcc?mnc [zh_CN_#Hans] ldltr sw360dp w360dp h714dp 480dpi nrml long hdr port finger -keyb/v/h -nav/h winConfig={ mBounds=Rect(0, 0 - 1080, 2340) mAppBounds=Rect(0, 81 - 1080, 2224) mWindowingMode=fullscreen mDisplayWindowingMode=fullscreen mActivityType=standard mAlwaysOnTop=undefined mRotation=ROTATION_0} suim:1 s.1} taskDescription: label="null" icon=null iconResource=0 iconFilename=null primaryColor=ff008577 backgroundColor=fffafafa statusBarColor=ff00574b navigationBarColor=fefcfcfb launchFailed=false launchCount=1 lastLaunchTime=-2m45s589ms haveState=false icicle=null state=RESUMED stopped=false delayedResume=false finishing=false keysPaused=false inHistory=true visible=true sleeping=false idle=true mStartingWindowState=STARTING_WINDOW_SHOWN fullscreen=true noDisplay=false immersive=false launchMode=0 frozenBeforeDestroy=false forceNewConfig=false mActivityType=standard nowVisible=true lastVisibleTime=-2m45s179ms resizeMode=RESIZE_MODE_RESIZEABLE_VIA_SDK_VERSION mLastReportedMultiWindowMode=false mLastReportedPictureInPictureMode=false Running activities (most recent first): TaskRecord{c26bd56 #3552 A=com.tomes.sharefile U=0 StackId=306 sz=1} Run #0: ActivityRecord{c260ac6 u0 com.tomes.sharefile/.MainActivity t3552} mResumedActivity: ActivityRecord{c260ac6 u0 com.tomes.sharefile/.MainActivity t3552} Stack #0: type=home mode=fullscreen isSleeping=false mBounds=Rect(0, 0 - 0, 0) Task id #1 mBounds=Rect(0, 0 - 0, 0) mMinWidth=-1 mMinHeight=-1 mLastNonFullscreenBounds=null * TaskRecord{c156ae7 #1 A=com.huawei.android.launcher U=0 StackId=0 sz=1} userId=0 effectiveUid=u0a74 mCallingUid=0 mUserSetupComplete=true mCallingPackage=null affinity=com.huawei.android.launcher intent={act=android.intent.action.MAIN cat=[android.intent.category.HOME] flg=0x10000300 cmp=com.huawei.android.launcher/.unihome.UniHomeLauncher} mActivityComponent=com.huawei.android.launcher/.unihome.UniHomeLauncher autoRemoveRecents=false isPersistable=true numFullscreen=1 activityType=2 rootWasReset=false mNeverRelinquishIdentity=true mReuseTask=false mLockTaskAuth=LOCK_TASK_AUTH_PINNABLE Activities=[ActivityRecord{c248648 u0 com.huawei.android.launcher/.unihome.UniHomeLauncher t1}] askedCompatMode=false inRecents=true isAvailable=true mRootProcess=ProcessRecord{bfaf609 2371:com.huawei.android.launcher/u0a74} stackId=0 hasBeenVisible=true mResizeMode=RESIZE_MODE_RESIZEABLE mSupportsPictureInPicture=false isResizeable=true lastActiveTime=176714950 (inactive for 165s) * Hist #0: ActivityRecord{c248648 u0 com.huawei.android.launcher/.unihome.UniHomeLauncher t1} packageName=com.huawei.android.launcher processName=com.huawei.android.launcher launchedFromUid=0 launchedFromPackage=null userId=0 app=ProcessRecord{bfaf609 2371:com.huawei.android.launcher/u0a74} Intent { act=android.intent.action.MAIN cat=[android.intent.category.HOME] flg=0x10000300 cmp=com.huawei.android.launcher/.unihome.UniHomeLauncher } frontOfTask=true task=TaskRecord{c156ae7 #1 A=com.huawei.android.launcher U=0 StackId=0 sz=1} taskAffinity=com.huawei.android.launcher mActivityComponent=com.huawei.android.launcher/.unihome.UniHomeLauncher baseDir=/system/app/HwLauncher6/HwLauncher6.apk dataDir=/data/user_de/0/com.huawei.android.launcher stateNotNeeded=true componentSpecified=false mActivityType=home compat={480dpi} labelRes=0x7f080081 icon=0x7f02011b theme=0x2060013 mLastReportedConfigurations: mGlobalConfig={1.0 ?mcc?mnc [zh_CN_#Hans] ldltr sw360dp w360dp h714dp 480dpi nrml long hdr port finger -keyb/v/h -nav/h winConfig={ mBounds=Rect(0, 0 - 1080, 2340) mAppBounds=Rect(0, 81 - 1080, 2224) mWindowingMode=fullscreen mDisplayWindowingMode=fullscreen mActivityType=undefined mAlwaysOnTop=undefined mRotation=ROTATION_0} suim:1 s.8} mOverrideConfig={1.0 ?mcc?mnc [zh_CN_#Hans] ldltr sw360dp w360dp h714dp 480dpi nrml long hdr port finger -keyb/v/h -nav/h winConfig={ mBounds=Rect(0, 0 - 1080, 2340) mAppBounds=Rect(0, 81 - 1080, 2224) mWindowingMode=fullscreen mDisplayWindowingMode=fullscreen mActivityType=home mAlwaysOnTop=undefined mRotation=ROTATION_0} suim:1 s.4} CurrentConfiguration={1.0 ?mcc?mnc [zh_CN_#Hans] ldltr sw360dp w360dp h714dp 480dpi nrml long hdr port finger -keyb/v/h -nav/h winConfig={ mBounds=Rect(0, 0 - 1080, 2340) mAppBounds=Rect(0, 81 - 1080, 2224) mWindowingMode=fullscreen mDisplayWindowingMode=fullscreen mActivityType=home mAlwaysOnTop=undefined mRotation=ROTATION_0} suim:1 s.4} RequestedOverrideConfiguration={0.0 ?mcc?mnc ?localeList ?layoutDir ?swdp ?wdp ?hdp ?density ?lsize ?long ?ldr ?wideColorGamut ?orien ?uimode ?night ?touch ?keyb/?/? ?nav/? winConfig={ mBounds=Rect(0, 0 - 0, 0) mAppBounds=null mWindowingMode=undefined mDisplayWindowingMode=undefined mActivityType=home mAlwaysOnTop=undefined mRotation=undefined}} launchFailed=false launchCount=0 lastLaunchTime=-1d13h4m45s738ms haveState=true icicle=Bundle[mParcelledData.dataSize=8984] state=STOPPED stopped=true delayedResume=false finishing=false keysPaused=false inHistory=true visible=false sleeping=false idle=true mStartingWindowState=STARTING_WINDOW_NOT_SHOWN fullscreen=true noDisplay=false immersive=false launchMode=2 frozenBeforeDestroy=false forceNewConfig=false mActivityType=home nowVisible=false lastVisibleTime=-2m57s443ms connections=com.android.server.wm.ActivityServiceConnectionsHolder@c24ac6d resizeMode=RESIZE_MODE_RESIZEABLE mLastReportedMultiWindowMode=false mLastReportedPictureInPictureMode=false Running activities (most recent first): TaskRecord{c156ae7 #1 A=com.huawei.android.launcher U=0 StackId=0 sz=1} Run #0: ActivityRecord{c248648 u0 com.huawei.android.launcher/.unihome.UniHomeLauncher t1} mLastPausedActivity: ActivityRecord{c248648 u0 com.huawei.android.launcher/.unihome.UniHomeLauncher t1} ResumedActivity:ActivityRecord{c260ac6 u0 com.tomes.sharefile/.MainActivity t3552} ResumedActivity: ActivityRecord{c260ac6 u0 com.tomes.sharefile/.MainActivity t3552}ActivityStackSupervisor state: topDisplayFocusedStack=ActivityStack{c1a994e stackId=306 type=standard mode=fullscreen visible=true translucent=false, 1 tasks} displayId=0 stacks=2 mHomeStack=ActivityStack{c04fa09 stackId=0 type=home mode=fullscreen visible=false translucent=true, 1 tasks} mPreferredTopFocusableStack=ActivityStack{c1a994e stackId=306 type=standard mode=fullscreen visible=true translucent=false, 1 tasks} mLastFocusedStack=ActivityStack{c1a994e stackId=306 type=standard mode=fullscreen visible=true translucent=false, 1 tasks} mCurTaskIdForUser={0=3552} mUserStackInFront={} isHomeRecentsComponent=true KeyguardController: mKeyguardShowing=false mAodShowing=false mKeyguardGoingAway=false Occluded=false DismissingKeyguardActivity=null at display=0 mDismissalRequested=false mVisibilityTransactionDepth=0 LockTaskController mLockTaskModeState=NONE mLockTaskModeTasks= mLockTaskPackages (userId:packages)= u0:[]
获取正在活动的activity栈
adb shell dumpsys activity activities | sed -En -e '/Running activities/,/Run #0/p'
运行结果如下:
➜ ~ adb shell dumpsys activity activities | sed -En -e '/Running activities/,/Run #0/p' Running activities (most recent first): TaskRecord{c26bd56 #3552 A=com.tomes.sharefile U=0 StackId=306 sz=1} Run #0: ActivityRecord{c260ac6 u0 com.tomes.sharefile/.MainActivity t3552} Running activities (most recent first): TaskRecord{c156ae7 #1 A=com.huawei.android.launcher U=0 StackId=0 sz=1} Run #0: ActivityRecord{c248648 u0 com.huawei.android.launcher/.unihome.UniHomeLauncher t1}
获取当前显示在顶层的activity
adb shell dumpsys window | grep mFocusedApp
运行结果如下:
➜ ~ adb shell dumpsys window | grep mFocusedApp mFocusedApp=AppWindowToken{c2654d1 token=Token{c491bc6 ActivityRecord{c260ac6 u0 com.tomes.sharefile/.MainActivity t3552}}} mFocusedApp=Token{c491bc6 ActivityRecord{c260ac6 u0 com.tomes.sharefile/.MainActivity t3552}}
更多相关文章
- Android动态刷新listview中的数据
- Android实现一个选择器-recycleview滚动中第一个item位置的获取
- android获取指定路径下目录文件
- android获取位置权限,手机状态权限,存储权限
- Android如何获取屏幕分辨率的例子
- Android(安卓)获取Web地址栏参数
- Android(安卓)WebView获取cookie
- android 截获键盘事件
- Android(安卓)如何获取系统字体大小