Skip to content

🐛 fix(android): recognize device-protected storage paths - #753

Merged
gaborbernat merged 2 commits into
tox-dev:mainfrom
gaborbernat:fix/android-device-protected-storage
Nov 27, 2026
Merged

gaborbernat merged 2 commits into
tox-dev:mainfrom
gaborbernat:fix/android-device-protected-storage

Conversation

@gaborbernat

Copy link
Copy Markdown
Member

platformdirs asks pyjnius for the Android app folder and, when pyjnius is missing, looks for the folder on sys.path. That fallback did not recognize device-protected storage (/data/user_de/<user id>), so an app running Python from there got the Unix backend. 📱 Once this merges, such an app gets its own app directories, and its shared media directories point to its Android user's /storage/emulated/<user id> instead of the /storage/emulated/0 default.

The sys.path discovery now accepts the device-protected user_de root wherever it accepted the credential-protected user root, on internal storage and on adopted volumes under /mnt/expand. The shared storage lookup reads the user ID from either root.

This has not been run on a physical Android device or emulator.

Supersedes #752 by @adityahaa, whose commit is kept unchanged. That fork does not allow maintainer edits, so the review fixes land here on top of it.

@gaborbernat
gaborbernat requested a review from ofek as a code owner November 27, 2026 20:25
@gaborbernat gaborbernat added the bug Something isn't working label Nov 27, 2026
@gaborbernat
gaborbernat merged commit c7d18cd into tox-dev:main Nov 27, 2026
40 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants