Skip to content

Fix download progress bar stuck at 0% (adb pull is silent when piped) - #33

Open
kapshytar wants to merge 1 commit into
Aldeshov:masterfrom
kapshytar:fix/download-progress-bar
Open

Fix download progress bar stuck at 0% (adb pull is silent when piped)#33
kapshytar wants to merge 1 commit into
Aldeshov:masterfrom
kapshytar:fix/download-progress-bar

Conversation

@kapshytar

Copy link
Copy Markdown

Problem

When downloading a file (external adb mode), the progress popup stays at "Waiting... 0%" for the entire transfer and only jumps to done at the very end.

Root cause

UpDownHelper.call parses adb's [ N%] progress lines — but adb pull only prints that progress to a TTY. When its stdout is piped (as CommonProcess does), adb stays completely silent until the transfer finishes and just prints the final … 1 file pulled … X MB/s summary. So the percentage parser never receives anything and the bar never moves.

You can confirm it:

$ adb pull /sdcard/big.bin /tmp/ | cat
/sdcard/big.bin: 1 file pulled, 0 skipped. 21.4 MB/s (...)   # no % lines at all

Fix

In android_adb.FileRepository.download, derive progress from the local side instead of relying on adb's (absent) output:

  1. Query the remote file size once up front via stat (space-safe through shlex.join).
  2. While adb pull runs, poll the size of the file being written locally on a background thread and emit progress_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:

[5, 13, 21, 28, 36, 45, 53, 61, 70, 80, 88, 98, 100]

instead of nothing. No change to the python-adb (adb-shell) path, which already reports progress.

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.
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

Successfully merging this pull request may close these issues.

1 participant