using SurfaceFlinger for screen capture

794 views
Skip to first unread message

Yadnesh Phadke

unread,
May 8, 2012, 7:01:58 AM5/8/12
to android-...@googlegroups.com
Hi All,

I have built android ICS (Maguro) from source, and experimenting with using the SurfaceFlinger service for capturing current screen shot, on the rooted phone that has the locally built OS. 
I do have the necessary permissions (READ_FRAME_BUFFER and ACCESS_SURFACE_FLINGER) set on the Manifest.  Also using the tag android:sharedUserId="android.uid.system", in the manifest.

I have written java code to get the "surfaceFlinger" system service, and then calling the "transact" function of the remote service with the code "7" for screen capture as seen in "ISurfaceComposer.h". 

I see that the SurfaceFlinger::captureScreen() function is correctly getting called and i do receive the size, format, and fd for the allocated memory, from the reply parcel.  Now when I try to use the data at the file descriptor to create a bitmap (Bitmap.Config.ARGB_8888), it seems to work, but i always get a complete black image. 

Can anyone help to point out what i may be missing here?

Regards,
Yadnesh

Reply all
Reply to author
Forward
0 new messages