[Android Software Development] TheByteSmasher:
8. Editing Local Manifests/Adding APKs

8. Editing Local Manifests/Adding APKs

So, if you've followed this, You've already edited your /home/YourUserName/aokp_jb/.repo/local_manifests/kernel_manifest.xml file. We're going to use this file as our local_manifest.xml. Your default.xml found in the directory platform_manifest is the file that repo uses to sync your local repository. kernel_manifest.xml is a local manifest that adds to your default manifest. We're going to use it to add to and remove from the default manifest. Why is this useful? Well if you want to add something to your build that isn't in AOKP's repository, or replace something that is, you use the local manifest to accomplish this.

Your default.xml defines where on the internets repo can find the base repository (called a remote) for the project you want to add. With some basic deduction, we can see in the following example that the name of the remote is cm and the base repository domain is at https://github.com/:

Understanding how the remote is defined is important because if you want to add projects from a different source, not defined by the default.xml, you'll need to define it in your local manifest. You can name it whatever you want, you'll use that name to call it out in your project path statement.

To add a project that doesn't already exist in default manifest you'd simply add a line to the local manifest (kernel_manifest.xml) like this:

<project path="packages/apps/CMFileManager" name="CyanogenMod/android_packages_apps_CMFileManager" remote="cm" revision="cm-10.1" />

Defined

:

"project path=": this is the local folder the project will sync into/with

"name=": this is the remote location of the repository.

"remote=": this is a call the the remote defined at the head of the manifest.

"revision=": this is the branch of the repository you want.

So in this case:

We are downloading the server repository "android_packages_apps_CMFileManager" from "https://github.com/CyanogenMod/" from the "cm-10.1" branch into our local repository ~/aokp_jb/packages/apps/CMFileManager. GET IT?

So now, whenever we perform a repo sync from the root folder, ~/aokp_jb/packages/apps/CMFileManager will be updated with new commits from CyanogenMod's repository. Cool, huh?

That won't create an app in the build by itself, but it gets us much closer!

In order to tell the AOKP build that you want to build in that app, you need to add it to ~/aokp_jb/build/target/product/core.mk. In this case you add the name of the app "CMFileManager" to the list of Apps in core.mk

abcc \
apache-xml \
atrace \
bouncycastle \
bu \
cacerts \
CMFileManager \
com.android.location.provider \
com.android.location.provider.xml \
core \

So all we did was add it, plus a space and a back-slash. That's it! Now if we build, CMFileManager will be an available app!

But what if you want to replace an existing app with one from a different repository? You first must remove the AOKP project path, then add the new one as shown above. For this example, we'll say that AOSPs calendar app is different from AOKPs and we want to use AOSPs version. So in kernel_manifest.xml we'll do the following:

<remove-project name="platform/packages/apps/Calendar" />
<project path="packages/apps/Calendar" name="platform/packages/apps/Calendar" remote="aosp" revision="jb-mr1.1-release" />

See, we removed the standard one, then called out the one we wanted. Since this app has the same name, there is no need to modify any other files. Play with it... See what you can do.

Some applications require other "hooks" like a way to access their settings like CMs LockClock or Chronus. You need to add additional strings and xml settings to create a settings menu in ROM Control.

=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*

Adding APKs

.

Sometimes it's not possible to build an app in from a repository. In this case, we'll use the APK itself!

OK, This is a little trickier..

First you need a copy of the APK you want to install during the build. Do I need to tell you not to install paid versions unless the ROM is solely for you???

Then copy the APK into ~/aokp_jb/vendor/aokp/prebuilt/common/app

Now we need to modify 2 Files to incorporate the APK into the Build.

The first is ~/aokp_jb/vendor/aokp/prebuilt/Android.mk

You'll need to add the following code (For this example, we'll assume we are adding the DashClock APK):

include $(CLEAR_VARS)
LOCAL_MODULE := DashClock
LOCAL_MODULE_OWNER := aokp
LOCAL_SRC_FILES := common/app/$(LOCAL_MODULE).apk
LOCAL_MODULE_TAGS := optional
LOCAL_MODULE_SUFFIX := .apk
LOCAL_MODULE_CLASS := APPS
LOCAL_CERTIFICATE := PRESIGNED
include $(BUILD_PREBUILT)

The next file to edit is ~/aokp_jb/vendor/aokp/configs/common.mk

Here you just need to add DashClock in the same format as the other APKs like this:

PRODUCT_PACKAGES += \
AOKPtips \
AppWidgetPicker \
DashClock \
LatinImeDictionaryPack \
Microbes \
NovaLauncher \
PerformanceControl \
ROMControl \
Superuser \
su \
SwagPapers \
Torch \
UnicornPorn

That's it. Now when you build you'll see that the APKs you added are built in and annotated as pre-signed!