Fix PC-to-Android file transfer progress display using ConPTY#46
Fix PC-to-Android file transfer progress display using ConPTY#46yubingjiaocn wants to merge 1 commit into
Conversation
Problem: ADB suppresses progress output when stderr is not a TTY, causing the progress bar to never update during PC-to-Android file transfers. The original DLL injection approach was incomplete (HookDll.dll was never implemented). Solution: Replace DLL injection with Windows ConPTY (Pseudo Console API) to create a virtual terminal that makes ADB output progress information. Changes: - Rewrite AdbProgressRunner to use ConPTY for terminal emulation - Add fallback to standard Process for systems without ConPTY - Use regex to parse progress directly from output chunks - Add process cancellation support with taskkill and ADB server restart - Add IsCancelled flag to stop multi-file transfer queues - Enable AnyCPU platform target (x64 support) since DLL injection is no longer needed - Refresh Android file list after PC-to-Android copy completes Technical details: - ConPTY requires Windows 10 1809 (build 17763) or later - Uses P/Invoke for CreatePseudoConsole, CreateProcess with EXTENDED_STARTUPINFO_PRESENT flag - Progress regex pattern: [\s*(\d+)%] Tested on Windows 11 with Xiaomi 14. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
134f562 to
9583c5f
Compare
|
Thank you for the commit, however, I already did the PC -> Android copying rewrite myself And I thought about the ConPTY method myself back when I was writing the new copying, however as that would break compatibility with older versions of Windows I decided to instead use the dll injection method |
|
For ConPTY issue, the code already has fallback logic: In The Comparison of the two methods:
What users on older Windows versions will experience:
This is the same behavior as before the ConPTY fix was implemented - the fallback preserves existing functionality for older systems while enabling real-time progress on Windows 10 1809+. |
Summary
This PR fixes the progress bar not updating during PC-to-Android file transfers, and add x64 support.
This PR will close #44 and #43.
Problem
ADB suppresses progress output when stderr is not a TTY, causing the progress bar to remain at 0% during file transfers. The original DLL injection approach in the codebase was incomplete (HookDll.dll was never implemented).
Solution
Replace DLL injection with Windows ConPTY (Pseudo Console API) to create a virtual terminal that makes ADB output progress information.
Changes
Technical Details
[\s*(\d+)%]Testing
Tested on Windows 11 (x64 build) with Xiaomi 14:
Generated with Claude Code