Support prebuilt apk source selection based on PRODUCT_AAPT_PREF_CONFIG

Two new LOCAL variables are added to support dpi-specific prebuilt apk
selection:
- LOCAL_DPI_VARIANTS: specify a list of dpis the module provides with
  specific prebuilt.
  Example: LOCAL_DPI_VARIANTS := xxhdpi xhdpi hdpi mdpi
- LOCAL_DPI_FILE_STEM: specify the dpi-specific source file name
  pattern.
  Example: LOCAL_DPI_FILE_STEM := MyApp-%.apk
  "%" will be substitued by $(PRODUCT_AAPT_PREF_CONFIG) in the core
  build system.
  If you don't set up LOCAL_DPI_FILE_STEM, the default is
  $(LOCAL_MODULE)_%.apk.

The build system searches $(PRODUCT_AAPT_PREF_CONFIG) in a prebuilt apk
module's $(LOCAL_DPI_VARIANTS). If not found, use whatever
$(LOCAL_SRC_FILES) as the source file; Otherwise use $(LOCAL_DPI_FILE_STEM)
to construct the dpi-specific apk's source file name, and use whatever
directory name of $(LOCAL_SRC_FILES).

Bug: 18388705
Change-Id: I63cae73f1b6f880302142abc476b3ce1fb5500b5
This commit is contained in:
Ying Wang 2014-11-17 16:56:04 -08:00
parent 1b879e3c26
commit 43f7a3226a
2 changed files with 15 additions and 0 deletions

View File

@ -158,6 +158,8 @@ LOCAL_MODULE_TARGET_ARCH_WARN:=
LOCAL_MODULE_UNSUPPORTED_TARGET_ARCH:=
LOCAL_MODULE_UNSUPPORTED_TARGET_ARCH_WARN:=
LOCAL_MODULE_HOST_ARCH:=
LOCAL_DPI_VARIANTS:=
LOCAL_DPI_FILE_STEM:=
# arch specific variables
LOCAL_SRC_FILES_$(TARGET_ARCH):=

View File

@ -114,6 +114,19 @@ endif # LOCAL_STRIP_MODULE not true
ifeq ($(LOCAL_MODULE_CLASS),APPS)
PACKAGES.$(LOCAL_MODULE).OVERRIDES := $(strip $(LOCAL_OVERRIDES_PACKAGES))
# Select dpi-specific source
ifdef LOCAL_DPI_VARIANTS
my_dpi := $(filter $(LOCAL_DPI_VARIANTS),$(PRODUCT_AAPT_PREF_CONFIG))
ifdef my_dpi
ifdef LOCAL_DPI_FILE_STEM
my_prebuilt_dpi_file_stem := $(LOCAL_DPI_FILE_STEM)
else
my_prebuilt_dpi_file_stem := $(LOCAL_MODULE)_%.apk
endif
my_prebuilt_src_file := $(dir $(my_prebuilt_src_file))$(subst %,$(my_dpi),$(my_prebuilt_dpi_file_stem))
endif # my_dpi
endif # LOCAL_DPI_VARIANTS
rs_compatibility_jni_libs :=
include $(BUILD_SYSTEM)/install_jni_libs.mk