Allow PRODUCT_PROPERTY_OVERRIDES to override default locale.

Change-Id: I5147d687750a50cfc186e99a9a8c88d3b2eb1692
If PRODUCT_PROPERTY_OVERRIDES has set default locale, buildinfo.sh skips setting them.
http://b/issue?id=2243115
This commit is contained in:
Ying Wang
2010-04-27 15:45:35 -07:00
parent c06243d195
commit 77c882ff88
2 changed files with 20 additions and 5 deletions

View File

@@ -95,6 +95,14 @@ else
BUILD_DISPLAY_ID := $(build_desc)
endif
# Whether there is default locale set in PRODUCT_PROPERTY_OVERRIDES
product_property_override_locale_language := \
$(strip $(patsubst ro.product.locale.language=%,%,\
$(filter ro.product.locale.language=%,$(PRODUCT_PROPERTY_OVERRIDES))))
product_property_overrides_locale_region := \
$(strip $(patsubst ro.product.locale.region=%,%,\
$(filter ro.product.locale.region=%,$(PRODUCT_PROPERTY_OVERRIDES))))
# Selects the first locale in the list given as the argument,
# and splits it into language and region, which each may be
# empty.
@@ -103,12 +111,15 @@ $(subst _, , $(firstword $(1)))
endef
# Selects the first locale in the list given as the argument
# and returns the language (or the region)
# and returns the language (or the region), if it's not set in PRODUCT_PROPERTY_OVERRIDES;
# Return empty string if it's already set in PRODUCT_PROPERTY_OVERRIDES.
define default-locale-language
$(word 2, 2, $(call default-locale, $(1)))
$(if $(product_property_override_locale_language),,\
$(word 1, $(call default-locale, $(1))))
endef
define default-locale-region
$(word 3, 3, $(call default-locale, $(1)))
$(if $(product_property_overrides_locale_region),,\
$(word 2, $(call default-locale, $(1))))
endef
BUILDINFO_SH := build/tools/buildinfo.sh

View File

@@ -25,8 +25,12 @@ if [ -n "$TARGET_CPU_ABI2" ] ; then
echo "ro.product.cpu.abi2=$TARGET_CPU_ABI2"
fi
echo "ro.product.manufacturer=$PRODUCT_MANUFACTURER"
echo "ro.product.locale.language=$PRODUCT_DEFAULT_LANGUAGE"
echo "ro.product.locale.region=$PRODUCT_DEFAULT_REGION"
if [ -n "$PRODUCT_DEFAULT_LANGUAGE" ] ; then
echo "ro.product.locale.language=$PRODUCT_DEFAULT_LANGUAGE"
fi
if [ -n "$PRODUCT_DEFAULT_REGION" ] ; then
echo "ro.product.locale.region=$PRODUCT_DEFAULT_REGION"
fi
echo "ro.wifi.channels=$PRODUCT_DEFAULT_WIFI_CHANNELS"
echo "ro.board.platform=$TARGET_BOARD_PLATFORM"