You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jun 19, 2025. It is now read-only.
I would like the Android/Java/JNI bindings to support file descriptors. Currently, they only support paths.
I am using Android's SAF (the OS's graphical file picker) to open the model and scorer files. It avoids asking for invasive permissions but returns a file descriptor instead of a path. On Android 10, I could just convert the file descriptor into a path using the expression "/proc/self/fd/" + fd. After updating to Android 11, this fails with a permission denied error. A workaround might be to request for access to the entire internal storage, but this is not ideal for privacy reasons.
I heard that dup works while fopen doesn't. This leads to two possible solutions:
Add another constructor that accepts an int to use as a file descriptor, and pass that all the way into native code
Have the existing constructor detect whether the path starts with /proc/self/fd/, and if it does, use the existing file descriptor instead of opening a file
If you've found a bug, or have a feature request, then please create an issue with the following information: