SharedMemory.FromFileDescriptor(ParcelFileDescriptor) Method

Definition

Creates an instance from existing shared memory passed as ParcelFileDescriptor.

[Android.Runtime.Register("fromFileDescriptor", "(Landroid/os/ParcelFileDescriptor;)Landroid/os/SharedMemory;", "", ApiSince=33)]
public static Android.OS.SharedMemory FromFileDescriptor (Android.OS.ParcelFileDescriptor fd);
[<Android.Runtime.Register("fromFileDescriptor", "(Landroid/os/ParcelFileDescriptor;)Landroid/os/SharedMemory;", "", ApiSince=33)>]
static member FromFileDescriptor : Android.OS.ParcelFileDescriptor -> Android.OS.SharedMemory

Parameters

fd
ParcelFileDescriptor

File descriptor of shared memory passed as ParcelFileDescriptor.

Returns

Attributes

Remarks

Creates an instance from existing shared memory passed as ParcelFileDescriptor.

The fd should be a shared memory created from SharedMemory or ASharedMemory. This can be useful when shared memory is passed as file descriptor through JNI or binder service implemented in cpp.

Note that newly created SharedMemory takes ownership of passed fd and the original fd becomes detached (Check ParcelFileDescriptor#detachFd()). If the caller wants to use the file descriptor after the call, the caller should duplicate the file descriptor (Check ParcelFileDescriptor#dup()) and pass the duped version instead.

Java documentation for android.os.SharedMemory.fromFileDescriptor(android.os.ParcelFileDescriptor).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to