简体   繁体   中英

How to change source code in aosp and add our own application on it

I have just downloaded Froyo source code to modify that but i don't understand where to start. I want to know the location of several system apps, including Settings in android source code. I want to add my own working Android app in Froyo source so it will start as system app. How should I proceed? Thanks in advance.

If you have ever downloaded Froyo source code, please share the folder structure.

I know that there were several system apps like Settings were there in android source code but where are they?

Actually those system application resides under packages/apps/ folder.

I would recommend two ways of adding your own app to AOSP.

First one is like amsurana told, ie just go through about how the system applications are implemented. If you download any application from net, just add that source folder under packages/apps/ and create Android.mk. For creating Android.mk, just refer other system application's Android.mk. Because, some application use native code some won't.

Second method is, If your application is specific to device, add your source code into /device/{vendor}/{board}/. Make sure that Android.mk under /device/{vendor}/{board}/ have the following line

include $(call all-makefiles-under,$(LOCAL_PATH))

Hope it helps!!!

I would recommend you to refer to the book "Android Systems Development How-to" by Earlence Fernandes. There you'll find some receipts how to change Android internals.

I would recommend looking at existing System apps like Gallery, Phone, Launcher, etc.

Create a similar folder structure to the existing apps and check out Android.mk file under that app.

This should give you a pointer in creating System app and this shall be part of System image which is generated by make command.

As an addition to the others, there is also a good practice to add your application not in packages/apps , but in vendor/{your_vendor}/packages/apps , or as an option to {your_dir_name}/packages/apps (in case you are not a vendor). After that, you'll need to define your Android.mk file and, if you want your app be system, you should make it explicitly:

 LOCAL_PATH := $(call my-dir)
 include $(CLEAR_VARS)

 # Build all java files in the java subdirectory
 LOCAL_SRC_FILES := $(call all-subdir-java-files)

 # Name of the APK
 LOCAL_PACKAGE_NAME := SuperApplication

 # To put your APK to /system/priv-app    
 LOCAL_PRIVILEGED_MODULE := true
 # Tell it to build an APK
 include $(BUILD_PACKAGE)

I would suggest several ways to start to explore the AOSP source code:

Read a source code of a launcher

There is an exact application, which I would suggest to have a look at.

Launcher is interesting application for both reading sources and modifying it. Several well known custom launchers are based on the AOSP Launcher application.

You can find it in packages/apps/Launcher3 .

Read sources of other applications

As it was suggested by the others, a good way to create your app is to look at the other applications. Other apps, as Dialer application, Contacts, Camera etc can be found in packages/apps , and some services, used by these applications (Telephony and Telecomm, used by Dialer app) can be found in packages/services .

Explore the SystemUI

Another interesting part of AOSP is a SystemUI application. It contains a statusbar and navugation bar, there can be found quick settings, which can be added and much much more interesting things, fun to modify.

You can find it in frameworks/base/packages/SystemUI .

Hope it helps someone.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM