Create System Application

Solution 1:

Ok, I think that I find sollution from great xda developers: http://forum.xda-developers.com/showthread.php?t=1776095 here is full description how to obtain access to apps signed by platform keys. Do you apply with this approach?
PS it is interesting that users from stack instead of investigating hard problem immediately say that you can not solve it, then reduce novice user's reputation...

Solution 2:

What I should to do to create a system app

There are two types of system apps:

  • Apps installed on the system partition, which can be accomplished by users with root privileges

  • Apps signed by the same signing key that signed the firmware

to obtain rights to use android:sharedUserId="android.uid.system"

That definitely would require your app to be signed by the same signing key that signed the firmware. That's true for any android:sharedUserId.

But some guys edit stock apps, prepare zip file which user can update system apps by recovery.

You are welcome to provide any evidence that what they do somehow involves android:sharedUserId="android.uid.system".

Solution 3:

A system app must be signed with the platform key. This is done by developers deploying an android platform on their own device, or mobile carriers.

If that is your case, the easiest way is to add this to your Android.mk:

LOCAL_CERTIFICATE := platform
LOCAL_PRIVILEGED_MODULE := true

If you add those lines without adding android:sharedUserId="android.uid.system" to your manifest, you will be a platform_app. A system app is more privileged than a platform app. That uses the platform key and runs as the system user.

If you are not the platform vendor, the platform vendor would need to sign your application using their platform key. Some vendors, including my company, will do this for 3rd parties demonstrating a valid reason for doing so.

Without the signature, your application can only be used on rooted devices.

Solution 4:

I did not need to sign my app with the firmware signature! I have a rooted device. Therefore I can grant myself rights to write to certain directories using adb.

I moved my app to /system/priv-app instead of /system/app using those steps: Push my apk to /system/app

Now, I can access system permissions like android.permission.SHUTDOWN