chdir / aria2-android

This repository is obsolete. Much better frontends for aria2 have been written and can be found in F-Droid
GNU General Public License v3.0
66 stars 15 forks source link

Support Android-specific storage facilities #2

Closed Alexander-- closed 4 years ago

Alexander-- commented 8 years ago

As of Android 6.0 there are multiple facilities, meant to improve security of Android storage access. A few especially abhorrent of them are grouped into something, called "SAF", or how it's creators prefer to call it "Storage Access Framework".

Here is a concept behind that abomination:

  1. Prevent developers from accessing certain parts of file system (e.g. external storage)
  2. Subsequently give them a limited "access" by letting Java applications open individual files via proxy (a specialized application-filepicker)
  3. After a couple more OS versions give them more "access" by allowing Java applications to group their files in groups and allow granting/remember permissions for those groups as whole.

All of permissions are stored by Android system in xml files, which have to be carefully managed by apps themselves. Those permissions have nothing to do with actual filesystem permissions (which still prohibit writing to most directories on device). Likewise actual layout of "directories", available via SAF, does not have to correspond to underlying filesystem.

There are no facilities for accessing the "Storage Access Framework" from native applications. The closest thing possible is giving those applications file descriptors, corresponding to individual files. As of Android-O developer preview, it is not possible to obtain file descriptors of directories via SAF (and even if it were, I am not aware of any facilities in LInux, that would make such descriptors useful)

TL; DR: in Android non-Java code has no means to use SAF

It seems, that integrating support for SAF in aria2 is not currently feasible.