DEV Community

Adding Custom Vendor Packages to Android Source Code: A Complete Guide

To integrate custom vendor packages into the Android source code, create a directory structure under vendor/oem/packages/applications with subdirectories for Android.bp, packages.mk, permissions, and prebuilts. The Android.bp file defines how applications should be built and installed, with different configurations for basic launcher applications, simple system extension applications, and privileged applications with permissions. The packages.mk file defines which packages should be included in the build, listing the packages to be included in the PRODUCT_PACKAGES variable. For applications requiring privileged permissions, create a permission XML file and reference it in the required field in the Android.bp configuration. To integrate the custom vendor packages into the Android build system, include the packages.mk file in the device's product configuration, such as handheld_product.mk or qssi.mk. Ensure APKs are properly signed before adding them to the prebuilts directory, and set privileged: true in the Android.bp configuration for privileged applications. Use system_ext_specific: true for apps that should be installed in the system_ext partition, and the overrides array to replace existing system applications. The exact integration path may vary depending on the device tree and BSP configuration, so consult the device's documentation for the most appropriate location to include custom packages. By following these steps, you can properly integrate custom vendor packages into your Android source code.
favicon
dev.to
dev.to