Android App sharedUserId=”android.uid.system”

I want to get screen pixels information, while we can not get it directly from /dev/graphics/fb0 when we use nexus 4/galaxy s4 Android 4.3.  I googled it seems the file is abandoned, the screen is not render from that file, even I get root permission, I still can not read data, all returned value is 0.

So I want to know how the screenshot gets the photo. The analysis is read from  The Surface.screenshot() is the key function. So I write the code according to

In the implement process, there are several problems that cost me some time to solve.

1. There is no Surface.screenshot(), in the latest android source code, the function is changed to SurfaceControl.screenshot(). If use the old, eclipse will tell there is no function. Actually, the first one in early android version is hidden api, the latter is hidden class. The hidden api and internal api used in eclipse:

2. If we run the app, it will give null results. That may caused by the hidden class. Although it goes through eclipse, it is not actually works. We need add system permission to the app.   a.) Add android:sharedUserId=”android.uid.system”  in manifest attribute AndroidManifest.xml.
To make sure it works. There are two ways as listed in I took first which works. The key is that it is ROM related, you need to compile your app in the same Android source code that compile your custom ROM.
b.) In,add LOCAL_CERTIFICATE := platform
c.) Move your app folder to Android source code  /packages/apps/yourApp
d.) Run . build/  then cd yourApp folder Run mm
e.) After compile, it shows the .apk path, then you can install it from adb
adb install -r testscreenshotactivity.apk  use -r if you reinstall the app, if not, just ignore -r.

If your ROM is not same with your android source code, the installation may not success, otherwise, it shows SUCCESS on your terminal.


This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

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

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

Google photo

You are commenting using your Google 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 )

Connecting to %s