Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How does the Android source overlays work?

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

like image 742
Bjarke Freund-Hansen Avatar asked Mar 17 '11 14:03

Bjarke Freund-Hansen


People also ask

What is Android resource overlay?

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.

What is Android AOSP overlay?

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)

What is Android settings overlay?

Screen overlay is a feature of modern Android smartphones and tablets that allows compatible applications to appear on top of others.


2 Answers

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.

like image 90
Yury Avatar answered Sep 22 '22 09:09

Yury


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.

like image 29
justfortherec Avatar answered Sep 19 '22 09:09

justfortherec