0

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.

Tushar Purohit
  • 524
  • 7
  • 25

2 Answers2

3

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).

cketti
  • 1,277
  • 11
  • 15
1

You cannot send a stream directly via AIDL.

You could need to wrap your data stream in a ContentProvider, as that supports streaming. Then, pass a Uri pointing to your provider and its stream via AIDL.

Depending on what the stream is coming from, you might be able to get a ParcelFileDescriptor for the underlying data, and that can be passed via AIDL.

CommonsWare
  • 986,068
  • 189
  • 2,389
  • 2,491