Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

几个守护进程稳定性提升方案 #576

Closed
2 tasks
mingyuan-xia opened this issue Jul 15, 2020 · 4 comments
Closed
2 tasks

几个守护进程稳定性提升方案 #576

mingyuan-xia opened this issue Jul 15, 2020 · 4 comments
Assignees

Comments

@mingyuan-xia
Copy link
Member

大量调试结果
正常情况,应该是 am instrument 启动 com.github.uiautomator app,am instrument 进入listen状态。
通常,uiautomator server服务不可用就会出发 POST :7912/uiautomator, 然后启动 am instrument 进行恢复,这个方案对以下两种情况有效:

  • 异常情况1:用户误手工打开了 app,使得该进程非 am instrument 启动,没有nano http server
  • 异常情况2:app/http server假死或者是crash
    但是有一个bug, am instrument启动后会force stop现有的app进程(从而解决异常情况1),然后等待app重新拉起,而atxagent并没有拉起,见:
    https://github.com/openatx/atx-agent/blob/master/main.go#L691
    可能只能等很久watchdog重新拉起才真正使得 am instrument 能进入listen
    这里要注意 am startservice am start-foreground-service 都没用,因为此时app进程已经被kill,不能启动一个没有活进程的Service,所以这里需要启动Activity am start com.github.uiautomator/.MainActivity

还发现一种情况,由于多次尝试恢复,每次都会启动一个 am instrument 等在那边

  • 异常情况3:有多个 am instrument 启动命令
    这会导致之后app一死再启动(手工或者其他方式),之前等着的am instrument 会一个个被唤醒,有些会shortMsg=Process crashed. 导致混乱
    解决方案:atxagent service这里在keeper启动进程前 check,把以前的am instrument 全部杀掉

uiautomator-server那边能调好的我们都弄了,atxagent那边需要你弄 @codeskyblue

@codeskyblue
Copy link
Member

@mingyuan-xia mingyuan-xia pinned this issue Jun 14, 2021
@zytwell
Copy link

zytwell commented Jan 4, 2022

重启uiautomator2后,被测页面也重新加载还原。但是页面元素会有一些识别不到了,这个有什么好的解决方案吗?@codeskyblue

@XDSwang
Copy link

XDSwang commented Aug 30, 2023

现在的安卓13版本,uiautomator会被关闭需要手动点击才能唤醒起触摸相关的服务

@codeskyblue
Copy link
Member

现在不需要atx-agent了。APK也不需要守护了。改成了app_process启动的方案

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants