New PRODUCT_AAPT_PREF_CONFIG.

To use the new aapt --preferred-configurations option.  For use with Prime
to be able to strip everything but xhdpi density bitmaps selectively,
not stripping when this would result in no data for the resource.

Change-Id: I4e1012929b8f9b0b1e79c06496647f69661ba1f2
This commit is contained in:
Dianne Hackborn 2011-10-14 19:37:57 -07:00
parent 854233e9b2
commit a0f464a8e7
5 changed files with 10 additions and 1 deletions

View file

@ -118,7 +118,7 @@ else
endif
# A change in the list of aapt configs warrants an installclean, too.
aapt_config_list := $(strip $(PRODUCT_AAPT_CONFIG))
aapt_config_list := $(strip $(PRODUCT_AAPT_CONFIG) $(PRODUCT_AAPT_PREF_CONFIG))
current_build_config := \
$(TARGET_PRODUCT)-$(TARGET_BUILD_VARIANT)$(building_sdk)-{$(aapt_config_list)}

View file

@ -1559,6 +1559,7 @@ endef
define add-assets-to-package
$(hide) $(AAPT) package -u $(PRIVATE_AAPT_FLAGS) \
$(addprefix -c , $(PRIVATE_PRODUCT_AAPT_CONFIG)) \
$(addprefix --preferred-configurations , $(PRIVATE_PRODUCT_AAPT_PREF_CONFIG)) \
$(addprefix -M , $(PRIVATE_ANDROID_MANIFEST)) \
$(addprefix -S , $(PRIVATE_RESOURCE_DIR)) \
$(addprefix -A , $(PRIVATE_ASSET_DIR)) \

View file

@ -227,6 +227,7 @@ $(R_file_stamp): $(resource_export_package)
# add-assets-to-package looks at PRODUCT_AAPT_CONFIG, but this target
# can't know anything about PRODUCT. Clear it out just for this target.
$(resource_export_package): PRIVATE_PRODUCT_AAPT_CONFIG :=
$(resource_export_package): PRIVATE_PRODUCT_AAPT_PREF_CONFIG :=
$(resource_export_package): $(all_res_assets) $(full_android_manifest) $(RenderScript_file_stamp) $(AAPT)
@echo "target Export Resources: $(PRIVATE_MODULE) ($@)"
$(create-empty-package)
@ -343,8 +344,10 @@ ifneq ($(TARGET_BUILD_APPS),)
endif
ifeq ($(LOCAL_AAPT_INCLUDE_ALL_RESOURCES),true)
$(LOCAL_BUILT_MODULE): PRIVATE_PRODUCT_AAPT_CONFIG :=
$(LOCAL_BUILT_MODULE): PRIVATE_PRODUCT_AAPT_PREF_CONFIG :=
else
$(LOCAL_BUILT_MODULE): PRIVATE_PRODUCT_AAPT_CONFIG := $(PRODUCT_AAPT_CONFIG)
$(LOCAL_BUILT_MODULE): PRIVATE_PRODUCT_AAPT_PREF_CONFIG := $(PRODUCT_AAPT_PREF_CONFIG)
endif
$(LOCAL_BUILT_MODULE): $(all_res_assets) $(jni_shared_libraries) $(full_android_manifest)
@echo "target Package: $(PRIVATE_MODULE) ($@)"

View file

@ -64,6 +64,7 @@ _product_var_list := \
PRODUCT_MODEL \
PRODUCT_LOCALES \
PRODUCT_AAPT_CONFIG \
PRODUCT_AAPT_PREF_CONFIG \
PRODUCT_PACKAGES \
PRODUCT_DEVICE \
PRODUCT_MANUFACTURER \

View file

@ -228,12 +228,14 @@ endif
# Add PRODUCT_LOCALES to PRODUCT_AAPT_CONFIG
PRODUCT_AAPT_CONFIG := $(strip $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_AAPT_CONFIG))
PRODUCT_AAPT_CONFIG := $(PRODUCT_LOCALES) $(PRODUCT_AAPT_CONFIG)
PRODUCT_AAPT_PREF_CONFIG := $(strip $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_AAPT_PREF_CONFIG))
# Default to medium-density assets.
# (Can be overridden in the device config, e.g.: PRODUCT_AAPT_CONFIG += hdpi)
PRODUCT_AAPT_CONFIG := $(strip \
$(PRODUCT_AAPT_CONFIG) \
$(if $(filter %dpi,$(PRODUCT_AAPT_CONFIG)),,mdpi))
PRODUCT_AAPT_PREF_CONFIG := $(strip $(PRODUCT_AAPT_PREF_CONFIG))
# Everyone gets nodpi assets which are density-independent.
PRODUCT_AAPT_CONFIG += nodpi
@ -242,6 +244,8 @@ PRODUCT_AAPT_CONFIG += nodpi
comma := ,
PRODUCT_AAPT_CONFIG := \
$(subst $(space),$(comma),$(strip $(PRODUCT_AAPT_CONFIG)))
PRODUCT_AAPT_PREF_CONFIG := \
$(subst $(space),$(comma),$(strip $(PRODUCT_AAPT_PREF_CONFIG)))
PRODUCT_BRAND := $(strip $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_BRAND))