SharedMemory用来实现共享内存操作很方便,也提供了获取文件描述符的方法,但是是hide的,普通app不能访问,
/**
* Returns the backing {@link FileDescriptor} for this SharedMemory object. The SharedMemory
* instance retains ownership of the FileDescriptor.
*
* This FileDescriptor is interoperable with the ASharedMemory NDK APIs.
*
* @return Returns the FileDescriptor associated with this object.
*
* @hide Exists only for MemoryFile interop
*/
public @NonNull FileDescriptor getFileDescriptor() {
return mFileDescriptor;
}
/**
* Returns the backing native fd int for this SharedMemory object. The SharedMemory
* instance retains ownership of the fd.
*
* This fd is interoperable with the ASharedMemory NDK APIs.
*
* @return Returns the native fd associated with this object, or -1 if it is already closed.
*
* @hide Exposed for native ASharedMemory_dupFromJava()
*/
@U

最低0.47元/天 解锁文章
761

被折叠的 条评论
为什么被折叠?



