adb dumpsys 活动 | grep -i run 不列出正在运行的活动。它显示以下输出,
m11q:/ $ dumpsys activity | grep -i run
service_reset_run_duration=60000
-> 13014:com.sec.spp.push:remoteRuna/u0a63 s1/1 u0/0 +9m54s749ms * ServiceRecord{d42721f u0 com.sec.spp.push/com.sec.spp.runa.service.RunaService}
app=ProcessRecord{331c940 13014:com.sec.spp.push:remoteRuna/u0a63}
process=com.sec.spp.push:remoteRuna System server and oomAdj runtimes (ms) in recent battery sessions (most recent first): System server total oomAdj runtimes (us) since boot: ACTIVITY MANAGER RUNNING PROCESSES (dumpsys activity processes)
run cpu over +3m7s564ms used 0 (0%)
Proc #37: svcb b/ /SVC --- t: 0 13014:com.sec.spp.push:remoteRuna/u0a63 (started-services)
run cpu over +3m7s564ms used 0 (0%)
run cpu over +3m7s564ms used 0 (0%)
run cpu over +3m7s564ms used 0 (0%)
run cpu over +3m7s564ms used 0 (0%)
run cpu over +3m7s564ms used 0 (0%)
proc=ProcessRecord{331c940 13014:com.sec.spp.push:remoteRuna/u0a63}
#20: svcb SVC --- 13014:com.sec.spp.push:remoteRuna/u0a63
Proc #37: svcb b/ /SVC --- t: 0 13014:com.sec.spp.push:remoteRuna/u0a63 (started-services)
User #0: state=RUNNING_UNLOCKED mMaxRunningUsers:4
MinimizeContainerServiceBinder Running=false
SmartPopupViewServiceBinder Running=false isRemoteAppDisplayRunning=false m11q:/ $
我想要这个输出
whyred:/ $ dumpsys activity | grep -i run
service_reset_run_duration=60000
* ContentProviderRecord{5286ee9 u0 com.android.settings/.cloud.push.RunningCompatibilityProvider}
authority=com.android.settings.cloud.compatibility.running
Running activities (most recent first):
Run #1: ActivityRecord{2aaf621 u0 com.idreams.project.onlinesatta/.ActivityWebView t1105}
Run #0: ActivityRecord{6ad0faa u0 com.idreams.project.onlinesatta/.ActivityDashboard t1105}
Running activities (most recent first):
Run #0: ActivityRecord{d66f9fa u0 com.teslacoilsw.launcher/.NovaLauncher t529}
Running activities (most recent first):
Run #0: ActivityRecord{5bd6d49 u0 com.android.systemui/.recents.RecentsActivity t3}
Running activities (most recent first):
Run #1: ActivityRecord{f699f1e u0 com.idreams.project.onlinesatta/.ActivityDashboard t1105}
Run #0: ActivityRecord{80cf218 u0 com.idreams.project.onlinesatta/.ActivityDashboard t1105}
Running activities (most recent first):
Run #0: ActivityRecord{d66f9fa u0 com.teslacoilsw.launcher/.NovaLauncher t529}
Running activities (most recent first):
Run #0: ActivityRecord{5bd6d49 u0 com.android.systemui/.recents.RecentsActivity t3}
ACTIVITY MANAGER RUNNING PROCESSES (dumpsys activity processes)
User #0: state=RUNNING_UNLOCKED
User #999: state=RUNNING_UNLOCKED
whyred:/ $
问题出在设备上,它之前工作正常,但在我更新它之后,它向我显示了这些输出。
当我运行 $ adb shell dumpsys 活动 | grep -i run 在 Pixel 8 Api 30 模拟器上,得到了你在第一个输出中得到的结果,比如“run cpu over +3m7s564msused 0 (0%)”。
当我运行adb shell dumpsys活动活动而不使用grep时,仅恢复并集中活动。没有获得正在运行的活动。
当我运行 adb shell dumpsys 活动 活动 | grep -i run 使用 grep,在我的提示中没有任何内容。因为 run 没有任何内容。
但是当我运行相同的命令时 adb shell dumpsys 活动 活动 | grep -i run 在真实设备上得到低于输出。
所以使用adb shell dumpsys Activity 活动 | grep -i run 命令和设备也是问题。尝试在不同的设备上运行,或者如果您最近更新了 android studio,请创建新的模拟器并在其上运行。
我发现
adb shell dumpsys activity activities
命令只能工作 grep 没有找到 run
文本。我观察了 adb shell dumpsys activity activities
输出,发现其中存在 Hist
文本。所以我最终创建了一个命令来提供堆栈跟踪。请找到下面的命令
adb shell dumpsys activity activities | grep -isw Hist