Wednesday, April 19, 2017

Why do we need a rooted phone to capture screenshots on older versions of Android?


I realize in order to capture screenshots of my phone, all screenshot applications require I have a rooted phone. Why is this so? Why can't we have a simple screenshot application for Android, just like we have for Windows?



Answer



The answer is rather simple, it's a permissions issue.


Android uses what is called a framebuffer for the video display. The framebuffer is located at /dev/graphics/fb0. this "file", which is basically a stream that the device writes to when changes in the user interface occur, contains ~2 frames of the screen display.


The permissions on the framebuffer file is rw- rw- ---. Note that the last "group" has 3 "-"'s. That basically means that if you are not the owner (which is root) you do not have permission to even read from that file.



If there was a system installed application, that could take screenshots, it would have permission to read from the framebuffer. Which, I believe, is how the Motorola Xoom is able to take screenshots. It has an application installed on the device, as a system app.


Reading the framebuffer, for a developer, is actually simple, if they have access to read it.


No comments:

Post a Comment

samsung galaxy s 2 - Cannot restore Kies backup after firmware upgrade

I backed up my Samsung Galaxy S2 on Kies before updating to Ice Cream Sandwich. After the upgrade I tried to restore, but the restore fails ...