Search code examples
androidsystemandroid-source

Adding a new app to AOSP


I have been able to build AOSP. However, I'm trying to add this app to AOSP and build it with mm ghetto-unlock but I am getting errors that symbols cannot be found and @Override methods aren't overriding anything. I'm fairly certain the problem is that the app isn't binding with the right libraries or APIs but I'm not sure what I'm doing wrong. Any help would be greatly appreciated.


Solution

  • First make sure you have these libraries: libs/sc-light-jdk15on-1.47.0.2.jar libs/scprov-jdk15on-1.47.0.2.jar

    The Override problem is that the AOSP master branch has changed TrustAgentService's method "onSetTrustAgentFeaturesEnabled" to "onConfigure", comparing with lollipop release branch.(lollipop, master)

    So modify GhettoTrustAgent.java as bellow, it should build with no error.

    import android.os.PersistableBundle;
    import java.util.List;
    
    ......
    
    //@Override
    //public boolean onSetTrustAgentFeaturesEnabled(Bundle options) {
    //    Log.v(TAG, "Policy options received: " + options.getStringArrayList(KEY_FEATURES));
    //
    //    return true; // inform DPM that we support it
    //}
    
    @Override
    public boolean onConfigure(List<PersistableBundle> options) {
        return true; // inform DPM that we support it
    }
    
    ......
    

    enter image description here

    To make it a system app and pack it in the system.img.

    1. Android.mk, change these two lines as this:

      enter image description here

    2. Create a new file named proguard.flags, and its content:

      enter image description here

    3. Modify the layout file, all android:text should be localized, like this android:text="@string/string_name"

    4. Modify [aosp_root]/build/target/product/full_base.mk, add your package name there:

      enter image description here

    That's all. Now build it with mm/mmm, it should be installed in system/app, and it should be packed in the system.img when running a full build with make.