I want to have a shared memory block (an ashmem region) that's mapped and accessed from native code. I also want this block to be used by several applications. I also want it to work on SDK level 7 (Android 2.1)
There are two routes. I can create an ashmem region in native code; but then the question is - how do I pass an integer file descriptor to another process? You can marshal FileDescriptor objects via a Parcel, but there's no way to construct one around a raw FD. There's also ParcelFileDescriptor which supports constructing around and retrieving integer FD's, but the relevant methods are only supported in SDK level 12 or even higher.
Alternatively, I can create a MemoryFile. There's a fugly way to pass it around in Parcels. But how do I retrieve a file descriptor from it so that native code has something to mmap()?