鸿蒙 鸿蒙系统下,使用 adb 命令获取当前页面的 activity

搬家好烦 · 2022年03月03日 · 最后由 Time 回复于 2022年03月03日 · 3593 次阅读

安卓系统获取 APP 当前 activity 命令一般使用:
adb shell dumpsys window windows | findstr "Current "
adb shell dumpsys activity | findstr "mFocusedActivity"
或者通过 adb shell activity activities 获取后再分析

鸿蒙系统下会发现原有命令输入后无法获取预期的 activity,个人发现如下命令可以获取:
adb shell dumpsys activity activities | findstr "mLastResumedActivity"

需要的小伙伴可以尝试下,如果有其他实用命令,欢迎大家回复

共收到 2 条回复 时间 点赞

adb shell dumpsys window displays | grep mCurrentFocus
一般上面这个都可以,但遇到过一次特殊场景的发现获取不到。
改为了下面这种:
adb shell dumpsys window displays | grep mTopFullscreenOpaqueWindowState

adb shell dumpsys window | findstr mCurrentFocus 荣耀手机 鸿蒙 2.0 可用 一般我都是用这个命令

需要 登录 后方可回复, 如果你还没有账号请点击这里 注册