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

手动Init时com.github.uiautomator报WindowManagerEventInjector is not supported #943

Closed
luofengwang opened this issue Mar 19, 2024 · 2 comments

Comments

@luofengwang
Copy link

测试代码:
if uiautomator_package in pkglist or uiautomator_test_package in pkglist:
os.system("adb -s " + device + " shell /data/local/tmp/atx-agent server --stop")
os.system("adb -s " + device + " shell rm /data/local/tmp/atx-agent")
os.system("adb -s " + device + " uninstall " + uiautomator_package)
os.system("adb -s " + device + " uninstall " + uiautomator_test_package)
time.sleep(1)
os.system("adb -s " + device + " install -r -t -g " + sys.path[0] + "\uiautomator\" + "app-uiautomator.apk")
os.system("adb -s " + device + " install -r -t -g " + sys.path[0] + "\uiautomator\" + "app-uiautomator-test.apk")
os.system("adb -s " + device + " push " + sys.path[0] + "\uiautomator\" + "atx-agent " + "/data/local/tmp/")
os.system("adb -s " + device + " shell chmod 755 /data/local/tmp/atx-agent")
os.system("adb -s " + device + " shell /data/local/tmp/atx-agent server -d")
time.sleep(1)

执行后报错日志:
03-19 16:22:00.170 13826 13826 E AndroidRuntime: FATAL EXCEPTION: main
logcat.txt

03-19 16:22:00.170 13826 13826 E AndroidRuntime: java.lang.UnsupportedOperationException: WindowManagerEventInjector is not supported
03-19 16:22:00.170 13826 13826 E AndroidRuntime: at com.github.uiautomator.compat.InputManagerWrapper$WindowManagerEventInjector.(InputManagerWrapper.java:100)
03-19 16:22:00.170 13826 13826 E AndroidRuntime: at com.github.uiautomator.compat.InputManagerWrapper.(InputManagerWrapper.java:22)
03-19 16:22:00.170 13826 13826 E AndroidRuntime: at com.github.uiautomator.MinitouchAgent.(MinitouchAgent.java:236)
03-19 16:22:00.170 13826 13826 E AndroidRuntime: at com.github.uiautomator.Console.listenAndServe(Console.java:84)
03-19 16:22:00.170 13826 13826 E AndroidRuntime: at com.github.uiautomator.Console.main(Console.java:70)
03-19 16:22:00.170 13826 13826 E AndroidRuntime: at com.android.internal.os.RuntimeInit.nativeFinishInit(Native Method)
03-19 16:22:00.170 13826 13826 E AndroidRuntime: at com.android.internal.os.RuntimeInit.main(RuntimeInit.java:401)

总结:
因为执行脚本时偶现ui apk被杀后自启失败,故增加了卸载重新init操作;采用手动Init操作时,先卸载UI相关环境后再安装ui环境时出现WindowManagerEventInjector is not supported。查找资料发现WindowManagerEventInjector 在Android 12后已经不支持相关方法了,是不是需要对异常代码行进行修复或规避。

感谢大佬们抽空处理!

  • 手机型号:TCL 50 XE 5G
  • uiautomator2的版本号:2.16.25
  • 手机截图:-
  • 相关日志(Python控制台错误信息, adb logcat完整信息, atxagent.log日志):
    atx-agent.log
    atx-agent.daemon.log
    logcat.txt
@luofengwang luofengwang changed the title 收到Init时com.github.uiautomator报WindowManagerEventInjector is not supported 手动Init时com.github.uiautomator报WindowManagerEventInjector is not supported Mar 19, 2024
@codeskyblue
Copy link
Member

MinitouchAgent 在最新的版本已经不调用了

@codeskyblue
Copy link
Member

相关代码已移除

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

No branches or pull requests

2 participants