android 系统设置ro属性方法

2018-08-13  本文已影响421人  Ed_Lannister

android 系统设置ro属性方法:

是在/build/tools/buildinfo.sh中定义 环境变量
echo "ro.build.version.release=$YOUR_MACRO"

在/build/core/version_defaults.mk中 指定

ifeq "" "$(PLATFOM_HAND_VERSION)"

This is the canonical definition of the platform version,

which is the version that we reveal to the end user.

Update this value when the platform version changes (rather

than overriding it somewhere else). Can be an arbitrary string.

When you add a new PLATFOM_HAND_VERSION,JUST CHANGE THE VERSION NUMBER

HERE.

YOUR_MACRO := YOUR_VALUE
endif

build.prop的生成是由make系统解析build/core/Makefile完成,Makefile中首先定义各种变量,其中就有
PLATFORM_VERSION="$(PLATFORM_VERSION)" \


ifneq ((PRODUCTS.(INTERNAL_PRODUCT).PRODUCT_OEM_PROPERTIES),)
(hide) echo "#" >>@;
echo "# PRODUCT_OEM_PROPERTIES" >> @; \ echo "#" >>@;
(hide)(foreach prop,(PRODUCTS.(INTERNAL_PRODUCT).PRODUCT_OEM_PROPERTIES),
echo "import /oem/oem.prop (prop)" >>@;)
endif
(hide) TARGET_BUILD_TYPE="(TARGET_BUILD_VARIANT)"
TARGET_BUILD_FLAVOR="(TARGET_BUILD_FLAVOR)" \ TARGET_DEVICE="(TARGET_DEVICE)"
PRODUCT_NAME="(TARGET_PRODUCT)" \ PRODUCT_BRAND="(PRODUCT_BRAND)"
PRODUCT_DEFAULT_LOCALE="(call get-default-product-locale,(PRODUCT_LOCALES))"
PRODUCT_DEFAULT_WIFI_CHANNELS="(PRODUCT_DEFAULT_WIFI_CHANNELS)" \ PRODUCT_MODEL="(PRODUCT_MODEL)"
CUSTOM_INTERNAL_ID="(CUSTOM_INTERNAL_ID)" \ PLATFORM_VERSION_ALL_CODENAMES="(PLATFORM_VERSION_ALL_CODENAMES)"
YOUR_MACRO="$(YOUR_MACRO)" ---------------------add here


Makefile中调用build/tools/buildinfo.sh执行脚本,并输出到build.prop

部分属性最后在 /packages/apps/Settings/src/com/android/settins/DeviceInfoSettings.java 中读取system/build.prop并最终显示在手机屏幕上。

上一篇下一篇

猜你喜欢

热点阅读