Lab – System Application

  1. Create an android studio project with simple activity
  2. Design:
    1. add Edittext, button and textview
    2. Change the layout to LinearLayout with vertical orientation 
  3.   Code
    1. Change the superclass to Activity
    2. Implement the button click event – read the text in the edittext control, convert to uppercase and write to the textview control
  4. Build and run on the emulator 

 

Add the application to AOSP 

  •  Create a folder “app” in ~/aosp/device/generic/goldfish
  • Add the following Android.mk file

  • Create a new directory “sysapp” in the folder app for the system application 
  • Copy the files from the android studio project to the new folder:

 

  • Add the following Android.mk file to sysapp folder:

  • Use mm to build the code – remove styles to make it compiled 
  • build the emulator and test your work 

Make Your Application Run with System Privileges

Add coreApp and sharedUserId to the manifest file:

Add the following vars to main Android.mk file:

Build the rom and test your work

Now run the application, connect to the device using adb and run ps -A to see all the processes. You will see application run as system user