https://stackoverflow.com/questions/10579827/how-do-i-add-apks-in-an-aosp-build
Adding third party APKs to the build is definitely possible.
Also APKs and APPs with source code go to the same place; the package/app
folder.
Adding a new APK to the build
In the AOSP root add the folder:
<aosp root>/package/app/< yourappfolder >
Then inside this folder add:
Android.mk
< yourapp.apk >
The android make file should have the reference to your apk, add this to your Android.mk
:
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE_TAGS := optional
LOCAL_MODULE := < your app folder name >
LOCAL_CERTIFICATE := < desired key >
LOCAL_SRC_FILES := < app apk filename >
LOCAL_MODULE_CLASS := APPS
LOCAL_MODULE_SUFFIX := $(COMMON_ANDROID_PACKAGE_SUFFIX)
include $(BUILD_PREBUILT)
Create an entry in the commons.mk
(usually in build/target/product
) for your apk add the line (check where all the others are)
PRODUCT_PACKAGES += < what you have defined in LOCAL_MODULE, it should be your app folder name >
Compile the AOSP and you have a brand new app installed on the system.
You could also do the following in the target output dir:
<path-to-your-build-dir>/host/linux-x86/bin/simg2img system.img temp.img
mkdir system_root
sudo mount -t ext4 -o loop temp.img system_root
At this point you can make whatever changes you'd like to the files in system_root, i.e. adding apks to system/app etc...
When you're done just go back down to the output dir and do: