利用adb查看当前设备的所有activity信息
adb shell #dumpsys activity activities
显示信息如下
ACTIVITY MANAGER ACTIVITIES (dumpsys activity activities) Main stack: * TaskRecord{430c7458 #29 A com.baidu.bpit.dushenghuo U 0} numActivities=10 rootWasReset=false userId=0 affinity=com.baidu.bpit.dushenghuo intent={act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10000000 pkg=com.baidu.bpit.dushenghuo cmp=com.baidu.bpit.dushenghuo/.ui.LoadingActivity} realActivity=com.baidu.bpit.dushenghuo/.ui.LoadingActivity askedCompatMode=false lastThumbnail=null lastDescription=null lastActiveTime=51171528 (inactive for 45s) * Hist #13: ActivityRecord{42dccea8 com.baidu.bpit.dushenghuo/.ui.MainActivity} packageName=com.baidu.bpit.dushenghuo processName=com.baidu.bpit.dushenghuo launchedFromUid=10140 userId=0 app=ProcessRecord{4488e5d8 21122:com.baidu.bpit.dushenghuo/u0a140} Intent { cmp=com.baidu.bpit.dushenghuo/.ui.MainActivity (has extras) } frontOfTask=false task=TaskRecord{430c7458 #29 A com.baidu.bpit.dushenghuo U 0} taskAffinity=com.baidu.bpit.dushenghuo realActivity=com.baidu.bpit.dushenghuo/.ui.MainActivity baseDir=/data/app/com.baidu.bpit.dushenghuo-2.apk dataDir=/data/data/com.baidu.bpit.dushenghuo stateNotNeeded=false componentSpecified=true isHomeActivity=false compat={320dpi} labelRes=0x7f080032 icon=0x7f02001c theme=0x7f0c0000 config={1 0 1.0 0mcc0mnc zhCN sw360dp w360dp h615dp nrml long port finger -keyb/v/h -nav/h s.6} launchFailed=false haveState=false icicle=null state=RESUMED stopped=false delayedResume=false finishing=false keysPaused=false inHistory=true visible=true sleeping=false idle=true fullscreen=true noDisplay=false immersive=false launchMode=0 frozenBeforeDestroy=false thumbnailNeeded=false forceNewConfig=false thumbHolder=TaskRecord{430c7458 #29 A com.baidu.bpit.dushenghuo U 0} waitingVisible=true nowVisible=true lastVisibleTime=-1m55s820ms windowMode=normal, * Hist #12: ActivityRecord{42db7de0 com.baidu.bpit.dushenghuo/.ui.MealCard} packageName=com.baidu.bpit.dushenghuo processName=com.baidu.bpit.dushenghuo launchedFromUid=10140 userId=0 app=ProcessRecord{4488e5d8 21122:com.baidu.bpit.dushenghuo/u0a140} Intent { cmp=com.baidu.bpit.dushenghuo/.ui.MealCard } frontOfTask=false task=TaskRecord{430c7458 #29 A com.baidu.bpit.dushenghuo U 0} taskAffinity=com.baidu.bpit.dushenghuo realActivity=com.baidu.bpit.dushenghuo/.ui.MealCard baseDir=/data/app/com.baidu.bpit.dushenghuo-2.apk dataDir=/data/data/com.baidu.bpit.dushenghuo stateNotNeeded=false componentSpecified=true isHomeActivity=false compat={320dpi} labelRes=0x7f080032 icon=0x7f02001c theme=0x7f0c0000 config={1 0 1.0 0mcc0mnc zhCN sw360dp w360dp h615dp nrml long port finger -keyb/v/h -nav/h s.6} launchFailed=false haveState=true icicle=Bundle[mParcelledData.dataSize=668] state=STOPPED stopped=true delayedResume=false finishing=false keysPaused=false inHistory=true visible=false sleeping=false idle=true fullscreen=true noDisplay=false immersive=false launchMode=0 frozenBeforeDestroy=false thumbnailNeeded=false forceNewConfig=false thumbHolder=TaskRecord{430c7458 #29 A com.baidu.bpit.dushenghuo U 0} waitingVisible=false nowVisible=false lastVisibleTime=-2m8s85ms windowMode=normal, * Hist #11: ActivityRecord{44703068 com.baidu.bpit.dushenghuo/.ui.MainActivity} packageName=com.baidu.bpit.dushenghuo processName=com.baidu.bpit.dushenghuo launchedFromUid=10140 userId=0 app=ProcessRecord{4488e5d8 21122:com.baidu.bpit.dushenghuo/u0a140} Intent { cmp=com.baidu.bpit.dushenghuo/.ui.MainActivity (has extras) } frontOfTask=false task=TaskRecord{430c7458 #29 A com.baidu.bpit.dushenghuo U 0} taskAffinity=com.baidu.bpit.dushenghuo realActivity=com.baidu.bpit.dushenghuo/.ui.MainActivity baseDir=/data/app/com.baidu.bpit.dushenghuo-2.apk dataDir=/data/data/com.baidu.bpit.dushenghuo stateNotNeeded=false componentSpecified=true isHomeActivity=false compat={320dpi} labelRes=0x7f080032 icon=0x7f02001c theme=0x7f0c0000 config={1 0 1.0 0mcc0mnc zhCN sw360dp w360dp h615dp nrml long port finger -keyb/v/h -nav/h s.6} launchFailed=false haveState=true icicle=Bundle[mParcelledData.dataSize=1036] state=STOPPED stopped=true delayedResume=false finishing=false keysPaused=false inHistory=true visible=false sleeping=false idle=true fullscreen=true noDisplay=false immersive=false launchMode=0 frozenBeforeDestroy=false thumbnailNeeded=false forceNewConfig=false thumbHolder=TaskRecord{430c7458 #29 A com.baidu.bpit.dushenghuo U 0} waitingVisible=false nowVisible=false lastVisibleTime=-2m30s187ms windowMode=normal, * Hist #10: ActivityRecord{44775da0 com.baidu.bpit.dushenghuo/.ui.MainActivity} packageName=com.baidu.bpit.dushenghuo processName=com.baidu.bpit.dushenghuo launchedFromUid=10140 userId=0 app=ProcessRecord{4488e5d8 21122:com.baidu.bpit.dushenghuo/u0a140} Intent { cmp=com.baidu.bpit.dushenghuo/.ui.MainActivity (has extras) } frontOfTask=false task=TaskRecord{430c7458 #29 A com.baidu.bpit.dushenghuo U 0} taskAffinity=com.baidu.bpit.dushenghuo realActivity=com.baidu.bpit.dushenghuo/.ui.MainActivity baseDir=/data/app/com.baidu.bpit.dushenghuo-2.apk dataDir=/data/data/com.baidu.bpit.dushenghuo stateNotNeeded=false componentSpecified=true isHomeActivity=false compat={320dpi} labelRes=0x7f080032 icon=0x7f02001c theme=0x7f0c0000 config={1 0 1.0 0mcc0mnc zhCN sw360dp w360dp h615dp nrml long port finger -keyb/v/h -nav/h s.6} launchFailed=false haveState=true icicle=Bundle[mParcelledData.dataSize=1036] state=STOPPED stopped=true delayedResume=false finishing=false keysPaused=false inHistory=true visible=false sleeping=false idle=true fullscreen=true noDisplay=false immersive=false launchMode=0 frozenBeforeDestroy=false thumbnailNeeded=false forceNewConfig=false thumbHolder=TaskRecord{430c7458 #29 A com.baidu.bpit.dushenghuo U 0} waitingVisible=false nowVisible=false lastVisibleTime=-3m46s20ms windowMode=normal, * Hist #9: ActivityRecord{436d4000 com.baidu.bpit.dushenghuo/.ui.MainActivity} packageName=com.baidu.bpit.dushenghuo processName=com.baidu.bpit.dushenghuo launchedFromUid=10140 userId=0 app=ProcessRecord{4488e5d8 21122:com.baidu.bpit.dushenghuo/u0a140} Intent { cmp=com.baidu.bpit.dushenghuo/.ui.MainActivity (has extras) } frontOfTask=false task=TaskRecord{430c7458 #29 A com.baidu.bpit.dushenghuo U 0} taskAffinity=com.baidu.bpit.dushenghuo realActivity=com.baidu.bpit.dushenghuo/.ui.MainActivity baseDir=/data/app/com.baidu.bpit.dushenghuo-2.apk dataDir=/data/data/com.baidu.bpit.dushenghuo stateNotNeeded=false componentSpecified=true isHomeActivity=false compat={320dpi} labelRes=0x7f080032 icon=0x7f02001c theme=0x7f0c0000 config={1 0 1.0 0mcc0mnc zhCN sw360dp w360dp h615dp nrml long port finger -keyb/v/h -nav/h s.6} launchFailed=false haveState=true icicle=Bundle[mParcelledData.dataSize=1036] state=STOPPED stopped=true delayedResume=false finishing=false keysPaused=false inHistory=true visible=false sleeping=false idle=true fullscreen=true noDisplay=false immersive=false launchMode=0 frozenBeforeDestroy=false thumbnailNeeded=false forceNewConfig=false thumbHolder=TaskRecord{430c7458 #29 A com.baidu.bpit.dushenghuo U 0} waitingVisible=false nowVisible=false lastVisibleTime=-4m7s407ms windowMode=normal, * Hist #8: ActivityRecord{4289e7a8 com.baidu.bpit.dushenghuo/.ui.MainActivity} packageName=com.baidu.bpit.dushenghuo processName=com.baidu.bpit.dushenghuo launchedFromUid=10140 userId=0 app=ProcessRecord{4488e5d8 21122:com.baidu.bpit.dushenghuo/u0a140} Intent { cmp=com.baidu.bpit.dushenghuo/.ui.MainActivity (has extras) } frontOfTask=false task=TaskRecord{430c7458 #29 A com.baidu.bpit.dushenghuo U 0} taskAffinity=com.baidu.bpit.dushenghuo realActivity=com.baidu.bpit.dushenghuo/.ui.MainActivity baseDir=/data/app/com.baidu.bpit.dushenghuo-2.apk dataDir=/data/data/com.baidu.bpit.dushenghuo stateNotNeeded=false componentSpecified=true isHomeActivity=false compat={320dpi} labelRes=0x7f080032 icon=0x7f02001c theme=0x7f0c0000 config={1 0 1.0 0mcc0mnc zhCN sw360dp w360dp h615dp nrml long port finger -keyb/v/h -nav/h s.6} launchFailed=false haveState=true icicle=Bundle[mParcelledData.dataSize=1036] state=STOPPED stopped=true delayedResume=false finishing=false keysPaused=false inHistory=true visible=false sleeping=false idle=true fullscreen=true noDisplay=false immersive=false launchMode=0 frozenBeforeDestroy=false thumbnailNeeded=false forceNewConfig=false thumbHolder=TaskRecord{430c7458 #29 A com.baidu.bpit.dushenghuo U 0} waitingVisible=false nowVisible=false lastVisibleTime=-4m18s368ms windowMode=normal, * Hist #7: ActivityRecord{4281b168 com.baidu.bpit.dushenghuo/.ui.MainActivity} packageName=com.baidu.bpit.dushenghuo processName=com.baidu.bpit.dushenghuo launchedFromUid=10140 userId=0 app=ProcessRecord{4488e5d8 21122:com.baidu.bpit.dushenghuo/u0a140} Intent { cmp=com.baidu.bpit.dushenghuo/.ui.MainActivity (has extras) } frontOfTask=false task=TaskRecord{430c7458 #29 A com.baidu.bpit.dushenghuo U 0} taskAffinity=com.baidu.bpit.dushenghuo realActivity=com.baidu.bpit.dushenghuo/.ui.MainActivity baseDir=/data/app/com.baidu.bpit.dushenghuo-2.apk dataDir=/data/data/com.baidu.bpit.dushenghuo stateNotNeeded=false componentSpecified=true isHomeActivity=false compat={320dpi} labelRes=0x7f080032 icon=0x7f02001c theme=0x7f0c0000 config={1 0 1.0 0mcc0mnc zhCN sw360dp w360dp h615dp nrml long port finger -keyb/v/h -nav/h s.6} launchFailed=false haveState=true icicle=Bundle[mParcelledData.dataSize=1036] state=STOPPED stopped=true delayedResume=false finishing=false keysPaused=false inHistory=true visible=false sleeping=false idle=true fullscreen=true noDisplay=false immersive=false launchMode=0 frozenBeforeDestroy=false thumbnailNeeded=false forceNewConfig=false thumbHolder=TaskRecord{430c7458 #29 A com.baidu.bpit.dushenghuo U 0} waitingVisible=false nowVisible=false lastVisibleTime=-4m48s70ms windowMode=normal, * Hist #6: ActivityRecord{4270ef78 com.baidu.bpit.dushenghuo/.ui.MainActivity} packageName=com.baidu.bpit.dushenghuo processName=com.baidu.bpit.dushenghuo launchedFromUid=10140 userId=0 app=ProcessRecord{4488e5d8 21122:com.baidu.bpit.dushenghuo/u0a140} Intent { cmp=com.baidu.bpit.dushenghuo/.ui.MainActivity (has extras) } frontOfTask=false task=TaskRecord{430c7458 #29 A com.baidu.bpit.dushenghuo U 0} taskAffinity=com.baidu.bpit.dushenghuo realActivity=com.baidu.bpit.dushenghuo/.ui.MainActivity baseDir=/data/app/com.baidu.bpit.dushenghuo-2.apk dataDir=/data/data/com.baidu.bpit.dushenghuo stateNotNeeded=false componentSpecified=true isHomeActivity=false compat={320dpi} labelRes=0x7f080032 icon=0x7f02001c theme=0x7f0c0000 config={1 0 1.0 0mcc0mnc zhCN sw360dp w360dp h615dp nrml long port finger -keyb/v/h -nav/h s.6} launchFailed=false haveState=true icicle=Bundle[mParcelledData.dataSize=1036] state=STOPPED stopped=true delayedResume=false finishing=false keysPaused=false inHistory=true visible=false sleeping=false idle=true fullscreen=true noDisplay=false immersive=false launchMode=0 frozenBeforeDestroy=false thumbnailNeeded=false forceNewConfig=false thumbHolder=TaskRecord{430c7458 #29 A com.baidu.bpit.dushenghuo U 0} waitingVisible=false nowVisible=false lastVisibleTime=-5m2s139ms windowMode=normal, * Hist #5: ActivityRecord{44674d80 com.baidu.bpit.dushenghuo/.ui.MainActivity} packageName=com.baidu.bpit.dushenghuo processName=com.baidu.bpit.dushenghuo launchedFromUid=10140 userId=0 app=ProcessRecord{4488e5d8 21122:com.baidu.bpit.dushenghuo/u0a140} Intent { cmp=com.baidu.bpit.dushenghuo/.ui.MainActivity (has extras) } frontOfTask=false task=TaskRecord{430c7458 #29 A com.baidu.bpit.dushenghuo U 0} taskAffinity=com.baidu.bpit.dushenghuo realActivity=com.baidu.bpit.dushenghuo/.ui.MainActivity baseDir=/data/app/com.baidu.bpit.dushenghuo-2.apk dataDir=/data/data/com.baidu.bpit.dushenghuo stateNotNeeded=false componentSpecified=true isHomeActivity=false compat={320dpi} labelRes=0x7f080032 icon=0x7f02001c theme=0x7f0c0000 config={1 0 1.0 0mcc0mnc zh_CN sw360dp w360dp h615dp nrml long port finger -keyb/v/h -nav/h s.6} launchFailed=false haveState=true icicle=Bundle[mParcelledData.dataSize=1036] state=STOPPED stopped=true delayedResume=false finishing=false keysPaused=false inHistory=true visible=false sleeping=false idle=true fullscreen=true noDisplay=false immersive=false launchMode=0 frozenBeforeDestroy=false thumbnailNeeded=false forceNewConfig=false thumbHolder=TaskRecord{430c7458 #29 A com.baidu.bpit.dushenghuo U 0} waitingVisible=false nowVisible=false lastVisibleTime=-5m40s597ms windowMode=normal,
从显示的信息中我们可以获取当前系统有哪些程序在跑,分别启动了几个activity,activity的启动信息(Intent参数,flag等),此乃调试必备神器。