How to Sign Android App with Platform Signature

1
java -jar signapk.jar platform.x509.pem platform.pk8 unsigned.apk signed.apk

signapk.jar can be found under <root-of-android-source-tree>/out/host/<your-host>/framework/
platform.x509.pem and platform.pk8 can be found under <root-of-android-source-tree>/build/target/product/security/

Grant an App the System Uid (Optional)

In the AndroidManifest.xml of your application: in the <manifest> tag, add the attribute android:sharedUserId="android.uid.system".

Reference

How to sign Android app with system signature?