Wednesday, January 18, 2012

sign your apk with platform key for using shared system id

you can find the key in your AOSP code.

normally you can find here AOSP_HOME/build/target/product/security

execute this command in that dir.

$ openssl pkcs8 -inform DER -nocrypt -in platform.pk8 -out platform.pem
$ openssl pkcs12 -export -in platform.x509.pem -inkey platform.pem -out platform.p12 -password pass:android -name androiddebugkey
$ /usr/lib/jvm/java-6-sun/bin/keytool -importkeystore -deststorepass android -destkeystore platform.jks -srcstoretype PKCS12 -srcstorepass android -srckeystore platform.p12
then you can get platform.jks file can be used on eclipse.

copy platform.jks to your key dir.

and open eclipse -> window -> preferences -> Android -> build

then your application is signed with platform key and system user id application can be ran.

remember, your Androidmanifest.xml need "android:sharedUserId="android.uid.system"

debug and modify android core app ( like settings ) on eclipse, window

First of all, you need compiled AOSP( which API Level you want to use.

In my case, i'm using API 15 and vbox_x86 Env.

in your AOSP_HOME

@bgpark:ics$ . build/
@bgpark:ics$ lunch vbox_x86-eng
@bgpark:ics$ make -j12

I think you already know this one.

Select Add Library by right mouse click

and make user library with System Library check option.

add some jar files.
for example, we need 2 shared jar for Settings project.

add guava_intermediates\classes.jar by add External jar and change reference order.

now you can build without any problems.

You will need this article for run your core app with appropriate authority.