-
Couldn't load subscription status.
- Fork 1.5k
Closed
Labels
Description
大量调试结果
正常情况,应该是 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 startserviceam start-foreground-service都没用,因为此时app进程已经被kill,不能启动一个没有活进程的Service,所以这里需要启动Activityam 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
- https://github.com/openatx/atx-agent/blob/master/main.go#L691 onStart里
am start com.github.uiautomator/.MainActivity - cmdctrl里面,keeper启动前杀掉其他的
am instrument
Appetizer里面暂时workaround了