Fix download progress bar stuck at 0% (adb pull is silent when piped) - #33
Open
kapshytar wants to merge 1 commit into
Open
Fix download progress bar stuck at 0% (adb pull is silent when piped)#33kapshytar wants to merge 1 commit into
kapshytar wants to merge 1 commit into
Conversation
adb pull only prints its [ N%] progress to a TTY; when its output is piped (as the app does) it stays silent until the transfer finishes, so UpDownHelper never received any progress lines and the download bar sat at 'Waiting... 0%' the whole time. Query the remote file size up front (via stat, space-safe through shlex.join) and poll the size of the file being written locally on a background thread, emitting progress to the existing callback. A 60 MB pull now reports 5..100% instead of nothing.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
When downloading a file (external
adbmode), the progress popup stays at "Waiting... 0%" for the entire transfer and only jumps to done at the very end.Root cause
UpDownHelper.callparses adb's[ N%]progress lines — butadb pullonly prints that progress to a TTY. When its stdout is piped (asCommonProcessdoes), adb stays completely silent until the transfer finishes and just prints the final… 1 file pulled … X MB/ssummary. So the percentage parser never receives anything and the bar never moves.You can confirm it:
Fix
In
android_adb.FileRepository.download, derive progress from the local side instead of relying on adb's (absent) output:stat(space-safe throughshlex.join).adb pullruns, poll the size of the file being written locally on a background thread and emitprogress_callback(name, percent).This mirrors the fallback the Flutter client (FileDroid) already uses for the same adb limitation.
Testing
Pulling a 60 MB file now reports streaming progress:
instead of nothing. No change to the python-adb (
adb-shell) path, which already reports progress.