Is there a way to get a system file descriptor (socket or file number as int) from an Android FileDescriptor object? I would like to access the file descriptor directly in the JNI code without using any Java wrappers.
Edit: I found getParcelFileDescriptorFD and that FileDescriptor has an int field named "handle", an example of use is in media/jni/android_media_MediaPlayer.cpp, the definition of func is in frameworks/base/core/jni/android_util_Binder.cpp, the field itself is inlibcore/luni/src/main/java/java/io/FileDescriptor.java
But this is not part of the official documentary API. Is there a documented “right” way to do this?
source
share