3

I'm trying to write an application that performs screen capture on Android 4.0+. I'm aware that you most likely will have to have a rooted phone which is fine.

I've tried grabbing the data from /dev/graphics/fb0. It works, but it only gets the startup screen. (HTC One X) I'm therefore guessing since ICS is rendering fully through acceleration, it after boot does not render to the framebuffer.

While there is limited information around this issue on the web, there have been some suggestions out there. One is to use Android-Screenshot-Library. It does not work (it takes the frame buffer content from /dev/fb0). Other suggestions are for only capturing your own app's screen. I want to capture the screen what the user is doing (this is for research and has no malicious intents.)

So far I'm stuck so any ideas or suggestions are welcome.

Evert
  • 93,428
  • 18
  • 118
  • 189
rrostt
  • 172
  • 1
  • 6

1 Answers1

1

Direct framebuffer access requires device-specific knowledge and often changing the modes of the graphics engine, so is not recommended.

A better answer is to examine what adbd does on your particular version. See

android / platform/system/core / adb/framebuffer_service.c

in AOSP at a tag comparable to your installed Android version (though technically, a vendor build could have adbd impelement the screenshot capability differently).

As of the moment, in master it is running a stand alone executable called 'screencap' which dumps the data to stdout.

You will probably need to run that as a user who is in the graphics group, ie, either root or adb's shell userid.

Chris Stratton
  • 39,853
  • 6
  • 84
  • 117