Android and permissions: Taking a screenshot

I had to do some screenshots for a presentation on the Android project I’m currently working on and to my surprise I found that searching for “Screenshot” on the Android Marketplace turned up zero results actually related to taking a screenshot.

I thought to myself that I would do a “shake to screenshot” app, but quickly realized that it was too good to be true, that nobody had thought of this. So I decided to investigate…

The only thing I could turn up in the Android documentation had to do with Manifest.permissions (http://developer.android.com/reference/android/Manifest.permission.html) and was only a single line:

READ_FRAME_BUFFER: Allows an application to take screen shots and more generally get access to the frame buffer data

Great! Tell me more..
A Google Groups post (http://groups.google.com/group/android-ndk/browse_thread/thread/9cb5a34e0baae1f0) led me to the idea of trying to read “/dev/graphics/fb0” as a file.

Trying to read the default framebuffer resulted in “file not found”. I then tried adding READ_FRAME_BUFFER to AndroidManifest.xml, but to my disappointment the Dalvik runtime simply refuses to grant this permission – it actually outputs “Not granting permission.. ..”.

It turns out that some permissions will NEVER be granted to non-system applications!

After searching around some more I found this post, that’s really more of a kickoff to a debate about how Android should handle access to potentially “dangerous” API’s http://groups.google.com/group/android-platform/browse_thread/thread/28399bc4c6779458/845833bc442d7ad4?q=READ_FRAME_BUFFER

There are some really interesting points in there. Being able to take screenshots from a background application could lead to password phishing. Other permissions mentioned, such as simulating user input would potentially allow malware to take over the device completely.

Open smopen..
I am quite disappointed at this point. I don’t really care how an app would attain these sorts of permissions (runtime / install time / whatever), but for an OS that brands itself as open, I find it rather unattractive that there are features that simply CANNOT be accessed by third party software. One of the things keeping Windows Mobile in the market right now is unrivaled support for Device Management software, made possible by its completely open nature.

P.s.
I eventually ended up using Dalvik Debug Monitor Service (that’s DDMS for short :)) http://developer.android.com/guide/developing/tools/ddms.html to capture the screens remotely.

Advertisements

Tags: , , , , , , ,

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


%d bloggers like this: