1、命令:adb shell dumpsys activity activities
adb shell dumpsys activity activities作用:主要用于获取当前窗口系统的详细状态信息。
在命令行输入命令后,显示如下信息:
C:\Users\batytao>adb shell dumpsys activity activities ACTIVITY MANAGER ACTIVITIES (dumpsys activity activities) Display #0 (activities from top to bottom): * Task{545b61 #7395 type=standard A=10250:com.tencent.mm U=0 displayId=0 mode=fullscreen sz=1 U=0 visible=true visibleRequested=true mode=fullscreen translucent=false sz=1} mLastPausedActivity: ActivityRecord{be7b8ba u0 com.tencent.mm/.ui.LauncherUI t7395 d0} isBubbleTask=false mLastNonFullscreenBounds=Rect(285, 717 - 795, 1797) isSleeping=false topResumedActivity=ActivityRecord{be7b8ba u0 com.tencent.mm/.ui.LauncherUI t7395 d0} * Hist #0: ActivityRecord{be7b8ba u0 com.tencent.mm/.ui.LauncherUI t7395 d0} packageName=com.tencent.mm processName=com.tencent.mm launchedFromUid=10143 launchedFromPackage=com.bbk.launcher2 launchedFromFeature=null userId=0 app=ProcessRecord{65ff9ef 11489:com.tencent.mm/u0a250} Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x30200000 cmp=com.tencent.mm/.ui.LauncherUI bnds=[555,1415][771,1667] } rootOfTask=true task=Task{545b61 #7395 type=standard A=10250:com.tencent.mm U=0 displayId=0 mode=fullscreen sz=1} taskAffinity=10250:com.tencent.mm mActivityComponent=com.tencent.mm/.ui.LauncherUI baseDir=/data/app/~~jiazHqi9_0Vc-owHdBf8hg==/com.tencent.mm-zQY-tIT9Gnt_F6mKHJla4w==/base.apk dataDir=/data/user/0/com.tencent.mm stateNotNeeded=false componentSpecified=true mActivityType=standard compat={480dpi} theme=0x7f1102ab输入命令:adb shell dumpsys activity activities | findstr topResumedActivity。显示当前手机顶层打开的app和界面
C:\Users\batytao>adb shell dumpsys activity activities | findstr topResumedActivity topResumedActivity=ActivityRecord{be7b8ba u0 com.tencent.mm/.ui.LauncherUI t7395 d0}adb shell dumpsys activity activities | findstr mFocusedWindow
mLastPausedActivity 最后暂停活动的
mResumedActivity 恢复活动的
mActivityComponent
mFocusedWindow 当前聚焦窗口
topResumedActivity 当前顶部恢复活动的界面