is it possible to share a SurfaceTexture between two processes, for example an Activity and a Service?
I would like to create an Activity with a TextureView, and update its SurfaceTexture from a separate Service.
So far I'm creating a SurfaceTexture with a generated OpenGL texture (through glGenTextures), then I set this surface texture to my TextureView:
mSurfaceTexture = new SurfaceTexture(texture_id);
mTextureView.setSurfaceTexture(mSurfaceTexture);
Displaying the camera preview to this SurfaceTexture on the activity is working fine:
mCamera = Camera.open();
mCamera.setPreviewTexture(mTextureView.getSurfaceTexture());
mCamera.startPreview();
I would like to do the same but from a separate service, passing the texture_id to it, something like:
mCamera = Camera.open();
mCamera.setPreviewTexture(new SurfaceTexture(texture_id));
mCamera.startPreview();
The reason is that I have a separate process calling a private api that needs a SurfaceTexture to stream some content, and this process is accessed through aidl from the application.
Thanks