ITADN

fix: add System.exit(0) to prevent process hang after UiAutomation commands

#60Pull Requestquanru 创建于 2026-04-01
Q
quanrucommented
## Problem After v1.1.0, the `-keyboard` command (and potentially other commands using `UiAutomation`) successfully completes but the `app_process` never exits, causing `adb shell` to hang until timeout. ```bash # Types text correctly, but never returns adb shell "app_process -Djava.class.path=/data/local/tmp/yadb /data/local/tmp com.ysbing.yadb.Main -keyboard '宠物'" ``` ## Root Cause v1.1.0 introduced `setTextByAccessibility()` which uses `UiAutomation` via `LayoutShell`. The `UiAutomation` connection creates internal **non-daemon threads** (binder threads, accessibility event dispatching) that persist even after `LayoutShell.disconnect()` is called. Since `Main.main()` has no `System.exit(0)`, the JVM waits for these non-daemon threads to terminate — which never happens. ## Fix Add `System.exit(0)` at the end of `Main.main()`. This is a common pattern for Android `app_process` CLI tools that use `UiAutomation`. Fixes #59
合并状态:未合并 关闭于 2026-04-01 1 条评论