In the android source in the device/sample
folder there is a folder called overlays
. You see the same overlay folder in e.g. the cyanogen mods.
What is this overlay folder? How does it work? What is it used for? Where can I read more about it?
Thanks in advance
A runtime resource overlay (RRO) is a package that changes the resource values of a target package at runtime. For example, an app installed on the system image might change its behavior based upon the value of a resource.
Overlay Mechanism. The Android overlay mechanism allows the framework and package resources to be customized without changing the base packages. The customizable resourses fall into the following categories: Configurations (string, bool, bool-array) Localization (string, string-array)
Screen overlay is a feature of modern Android smartphones and tablets that allows compatible applications to appear on top of others.
For instance, imagine that you want to modify some files in Android source for your device (for instance, you want to add additional string to Launcher resources). It is not recommended to modify the actual sources of Android.
Instead of this you create overlay that mimics the actual filesystem path layout of Android and put there your changed file. In case of string in Laucher, you create directories that corresponds to the path: packages/apps/Launcher2/res/values
and put there modified strings.xml
Thus, when you build your device this file will be substituted.
Overlays are a way to customize resource files and do not work for source files.
Replacement works on string granularity. That means, that for strings that do not exist in the overlay file, the corresponding string from the original is used.
From the brief documentation:
The Android build system uses resource overlays to customize a product at build time. Resource overlays specify resource files that are applied on top of the defaults. To use resource overlays, modify the project buildfile to set PRODUCT_PACKAGE_OVERLAYS to a path relative to your top-level directory. That path becomes a shadow root searched along with the current root when the build system searches for resources.
The most commonly customized settings are contained in the file frameworks/base/core/res/res/config.xml.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With