Android 平台 Overlay 机制
Android overlay 机制允许在不修改 packages 中 apk 的情况下,来自定义
framework 和 package 中的资源文件,实现资源的定制。来达到显示不同的 UI
得目的(如 MIUI)。
以下几类能够通过该机制定义:
(1),Configurations (string, bool, bool-array)
(2),Localization (string, string-array)
(3),UI Appearance (color, drawable, layout, style, theme,
animation)
(4),Raw resources (audio, video, xml)
For detailed introduction on Android application resources, please
refer to:
http://developer.android.com/guide/topics/resources/available-resourc
es.html
1 为产品添加 Overlay 目录
1.1 Product Overlays 与 Device Overlays
有两种不同的 overaly 目录定义,来影响最终的效果:
PRODUCT_PACKAGE_OVERLAYS: used by a particular product
DEVICE_PACKAGE_OVERLAYS: used several products that share a common
device model
如果包含同一资源,那么 PRODUCT_PACKAGE_OVERLAYS 将覆盖
DEVICE_PACKAGE_OVERLAYS 中的, 这两个定义如下:
build/core/package.mk (Line: 93)
1 LOCAL_RESOURCE_DIR := \
2 $(wildcard $(foreach dir, $(PRODUCT_PACKAGE_OVERLAYS), \
3 $(addprefix $(dir)/, $(LOCAL_RESOURCE_DIR)))) \