Skip to content

Add full stat capabilities, fixed utimens and managing old or exotic Android OSes#79

Open
Vahlblue wants to merge 9 commits into
spion:masterfrom
Vahlblue:master
Open

Add full stat capabilities, fixed utimens and managing old or exotic Android OSes#79
Vahlblue wants to merge 9 commits into
spion:masterfrom
Vahlblue:master

Conversation

@Vahlblue

Copy link
Copy Markdown

Hello,
Here is a PR that implements all stat attributes for adb_getattr and fixes my last PR #76 utimens for all cases.

It handles :

  • Exotic and old coreutils installed with dynamic detection and switching for the best available.
  • From Android 4.1 to the latest (some features are limited on some versions).
  • Automatic fallback to ls with added seconds and timezone support if stat does not work
  • Caching stat output to avoid calling stat each time
  • Handling of timezone (old Android without anytime zones, different timezone between the computer and the Android device and summer time)

Tested on :

  • Samsung Fold 7 (Android 16)
  • OnePlus 9 (Android 14)
  • LG G6 (Android 9)
  • Inside AVD : Android from 4.1 (no images older available directly inside AVD) to 9

For those devices I tested that a touch and a stat always output the same information and that other features are working.
I used my modification to sync to the second all my files of all my devices to be able to sync on my NAS.

To be noted : from Android 6 to 8 utimens cannot work due to a bug in the old toybox coreutils (details in the code comments). They is no workaround possible. The only way is a rooted device and busybox for example installed which will be automatically chosen by the detections capabilities.

Since it comes at a cost of performance (all file must be individually stated) we could imagine some solutions :

  • User option to fallback to the incomplete ls output.
  • Maintain a adb shell session continuously.
  • Trying to stat all files in one line when exploring a folder.

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