Share the surface between different apps with AIDL in Android

33 Views Asked by At

I wanted to drawRect after sending the Surface from App A to B, so I tried using AIDL. I checked the SurfaceFlinger because nothing was drawn. When I drew from App A, the surface was not compressed, and the SurfaceView and Flag(usage) were the same as 0x933. However, when I sent it from A to B through aidl, it was compressed and the flag(usage) was 0x4000000000000b00.

I can get the SurfaceControl used by A and make a new Surface, but I want to simply get the Surface and use it. Please let me know if there is a way. Thank you.

1

There are 1 best solutions below

0
임완택 On

First of all, my problem was that I overlooked the part that delivers the Surface to the Native Window. I annotated the part that delivers the Surface to the Native Window and modified it to deliver the Surface. Still, I got an error saying "already connected to another API?" and this part was resolved by doing canvasLock(null), not canvasHardwareLock().