欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

adb shell am stack list命令调试查看ActivityManagerService相关属性详解

程序员文章站 2022-06-06 09:22:02
...

hi,学员们大家好,经常在做框架特别是ActivityManagerService模块开发过程中会使用一个命令来查看一些信息辅助我们看到系统目前的Activity的一个情况,主要包括Activity分布的Stack,Task情况。具体效果如下:

[email protected]:~/xiaomi5/frameworks$ adb shell am stack list
Stack id=4 bounds=[0,0][1080,1920] displayId=0 userId=0
 configuration={1.0 ?mcc?mnc [zh_CN] ldltr sw360dp w360dp h616dp 480dpi nrml long port finger -keyb/v/h -nav/h winConfig={ mBounds=Rect(0, 0 - 1080, 1920) mAppBounds=Rect(0, 0 - 1080, 1920) mWindowingMode=fullscreen mDisplayWindowingMode=fullscreen mActivityType=standard mAlwaysOnTop=undefined mRotation=ROTATION_0} s.12}
  taskId=231: com.android.dialer/com.android.dialer.main.impl.MainActivity bounds=[0,0][1080,1920] userId=0 visible=true topActivity=ComponentInfo{com.android.dialer/com.android.dialer.main.impl.MainActivity}

Stack id=0 bounds=[0,0][1080,1920] displayId=0 userId=0
 configuration={1.0 ?mcc?mnc [zh_CN] ldltr sw360dp w360dp h616dp 480dpi nrml long port finger -keyb/v/h -nav/h winConfig={ mBounds=Rect(0, 0 - 1080, 1920) mAppBounds=Rect(0, 0 - 1080, 1920) mWindowingMode=fullscreen mDisplayWindowingMode=fullscreen mActivityType=home mAlwaysOnTop=undefined mRotation=ROTATION_0} s.12}
  taskId=228: com.android.launcher3/com.android.launcher3.lineage.LineageLauncher bounds=[0,0][1080,1920] userId=0 visible=false topActivity=ComponentInfo{com.android.launcher3/com.android.launcher3.lineage.LineageLauncher}

Stack id=3 bounds=[0,0][1080,1920] displayId=0 userId=0
 configuration={1.0 ?mcc?mnc [zh_CN] ldltr sw360dp w360dp h616dp 480dpi nrml long port finger -keyb/v/h -nav/h winConfig={ mBounds=Rect(0, 0 - 1080, 1920) mAppBounds=Rect(0, 0 - 1080, 1920) mWindowingMode=fullscreen mDisplayWindowingMode=fullscreen mActivityType=standard mAlwaysOnTop=undefined mRotation=ROTATION_0} s.12}
  taskId=230: com.android.messaging/com.android.messaging.ui.conversationlist.ConversationListActivity bounds=[0,0][1080,1920] userId=0 visible=false topActivity=ComponentInfo{com.android.messaging/com.android.messaging.ui.conversationlist.ConversationListActivity}

Stack id=1 bounds=[0,0][1080,1920] displayId=0 userId=0
 configuration={1.0 ?mcc?mnc [zh_CN] ldltr sw360dp w360dp h616dp 480dpi nrml long port finger -keyb/v/h -nav/h winConfig={ mBounds=Rect(0, 0 - 1080, 1920) mAppBounds=Rect(0, 0 - 1080, 1920) mWindowingMode=fullscreen mDisplayWindowingMode=fullscreen mActivityType=standard mAlwaysOnTop=undefined mRotation=ROTATION_0} s.12}
  taskId=229: com.android.contacts/com.android.contacts.activities.PeopleActivity bounds=[0,0][1080,1920] userId=0 visible=false topActivity=ComponentInfo{com.android.contacts/com.android.contacts.activities.PeopleActivity}


命令输出可以看出以下信息:
1、当前显示最前端的Activity stack一般是第一个输出的Stack id=4
2、对于的Activiy taskId是 taskId=231: com.android.dialer/com.android.dialer.main.impl.MainActivity 是task底部Activity,也有对应的topActivity=ComponentInfo{com.android.dialer/com.android.dialer.main.impl.MainActivity
3、有Activity Stack的显示的窗口区域bounds=[0,0][1080,1920]

如果需要学习更多framework只是和视频可以b站关注:千里马学框架,购买课程最好加入422901085群里找千里马要优惠和答疑

课程答疑和新课信息:QQ交流群:422901085进行课程讨论,加群主qq享受 优惠
FrameWork入门课视频链接:https://edu.csdn.net/course/detail/30298
FrameWork实战课1视频链接:https://edu.csdn.net/course/detail/30275
FrameWork跨进程通信视频链接:https://edu.csdn.net/course/detail/35911
专题博客系列:
Android 8.1 zygote 启动过程源码
Android Framework实战视频–Zygote的fork进程篇
Android Framework实战视频–SystemServer启动篇
Android Framework实战视频–SystemServer启动FallbackHome篇
Android Framework实战视频–FallbackHome进程启动及Activity启动篇
Android Framework实战视频–FallbackHome结束启动Launcher篇
Android Framework实战视频–BootAnimation的启动源码分析(Android8.1)

Android Framework实战视频–init进程的bootanimation启动源码分析(补充Android 10部分的BootAnimation的启动源码分析)