- 获取所用应用
adb shell dumpsys activity
- 获取自己的应用
adb shell dumpsys activity | grep 应用的package
- 获取处于栈顶的activity
adb shell dumpsys activity | grep mFocusedActivity
p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 13.0px Courier; color: #d1e5f3; background-color: #013f4f}span.s1 {font-variant-ligatures: no-common-ligatures}
Run #6: ActivityRecord{bfdfbbd u0 me.imid.swipebacklayout.demo/.DemoActivity t2409}
Run #5: ActivityRecord{119afc68 u0 me.imid.swipebacklayout.demo/.SecondActivity t2410}
上面的Run #6: ActivityRecord{xxx}
, Run #5: ActivityRecord{xxx}
就是当前栈中的Activity信息
补充:
DOC下获取手机应用活动,需要稍稍修改下:
adb shell dumpsys activity 应用的package