Search code examples
androidipcparcelableaidl

How to send stream (InputStream / OutputStream) to aidl?


I have a application s works on IPC AIDL process, and i want to share stream between process (My Application and AIDL process) then how to do it. I know we can send only primitive data types and parcelable objects through aidl but my requirement is to send input and output stream to aidl process. how to achieve that.


Solution

  • You can use a ParcelFileDescriptor.createPipe(). See ParcelFileDescriptorUtil from OpenKeychain's API library.

    The calling app uses one ParcelFileDescriptor to read (or write), the other is passed to the receiving app and it uses it to write (or read).