1、获取所用应用
adb shell dumpsys activity
2、获取自己的应用
adb shell dumpsys activity | grep com.xxx.xxx.xx
3、获取处于栈顶的activity
adb shell dumpsys activity | grep mFocusedActivity
4、解读堆栈信息:
shell@dior:/ $ dumpsys activity | grep com.hexin.android.bank
dumpsys activity | grep com.hexin.android.bank
* PendingIntentRecord{42b39700 com.hexin.android.bank broadcastIntent}
* PendingIntentRecord{42a1a2c8 com.hexin.android.bank startActivity}
-> 21438:com.hexin.android.bank/u0a99 s1/1 u0/0 +26m22s774ms
* ServiceRecord{4239f548 u0 com.hexin.android.bank/com.hexin.android.pushservice.PushService}
TaskRecord{42f4f138 #88 A=com.hexin.android.bank U=0 sz=3}
Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000
cmp=com.hexin.android.bank/.LogoActivity }
H