1# Set up rules to build dpi-specific apk, with whatever else from the base apk. 2# Input variable: my_dpi, and all other variables set up in package_internal.mk. 3# 4 5dpi_apk_name := $(LOCAL_MODULE)_$(my_dpi) 6dpi_intermediate := $(call intermediates-dir-for,APPS,$(dpi_apk_name)) 7built_dpi_apk := $(dpi_intermediate)/package.apk 8 9# Set up all the target-specific variables. 10$(built_dpi_apk): PRIVATE_MODULE := $(dpi_apk_name) 11$(built_dpi_apk): PRIVATE_AAPT_FLAGS := $(LOCAL_AAPT_FLAGS) $(PRODUCT_AAPT_FLAGS) $($(LOCAL_PACKAGE_NAME)_aapt_flags_$(my_dpi)) 12# Clear PRIVATE_PRODUCT_AAPT_CONFIG to include everything by default. 13$(built_dpi_apk): PRIVATE_PRODUCT_AAPT_CONFIG := 14$(built_dpi_apk): PRIVATE_PRODUCT_AAPT_PREF_CONFIG := $(my_dpi) 15$(built_dpi_apk): PRIVATE_ANDROID_MANIFEST := $(full_android_manifest) 16$(built_dpi_apk): PRIVATE_RESOURCE_DIR := $(LOCAL_RESOURCE_DIR) 17$(built_dpi_apk): PRIVATE_ASSET_DIR := $(LOCAL_ASSET_DIR) 18$(built_dpi_apk): PRIVATE_AAPT_INCLUDES := $(all_library_res_package_exports) 19ifneq (,$(filter-out current system_current, $(LOCAL_SDK_VERSION))) 20$(built_dpi_apk): PRIVATE_DEFAULT_APP_TARGET_SDK := $(LOCAL_SDK_VERSION) 21else 22$(built_dpi_apk): PRIVATE_DEFAULT_APP_TARGET_SDK := $(DEFAULT_APP_TARGET_SDK) 23endif 24$(built_dpi_apk): PRIVATE_MANIFEST_PACKAGE_NAME := $(LOCAL_MANIFEST_PACKAGE_NAME) 25$(built_dpi_apk): PRIVATE_MANIFEST_INSTRUMENTATION_FOR := $(LOCAL_INSTRUMENTATION_FOR) 26$(built_dpi_apk): PRIVATE_JNI_SHARED_LIBRARIES := $(jni_shared_libraries_with_abis) 27$(built_dpi_apk): PRIVATE_JNI_SHARED_LIBRARIES_ABI := $(jni_shared_libraries_abis) 28$(built_dpi_apk): PRIVATE_PRIVATE_KEY := $(private_key) 29$(built_dpi_apk): PRIVATE_CERTIFICATE := $(certificate) 30$(built_dpi_apk): PRIVATE_ADDITIONAL_CERTIFICATES := $(foreach c,\ 31 $(LOCAL_ADDITIONAL_CERTIFICATES), $(c).x509.pem $(c).pk8) 32 33$(built_dpi_apk): PRIVATE_SOURCE_ARCHIVE := 34ifneq ($(full_classes_jar),) 35$(built_dpi_apk): PRIVATE_DEX_FILE := $(built_dex) 36ifndef LOCAL_JACK_ENABLED 37# Use the jarjar processed arhive as the initial package file. 38$(built_dpi_apk): PRIVATE_SOURCE_ARCHIVE := $(full_classes_jarjar_jar) 39else 40$(built_dpi_apk): PRIVATE_JACK_INTERMEDIATES_DIR := $(intermediates.COMMON)/jack-rsc 41endif # LOCAL_JACK_ENABLED 42$(built_dpi_apk): $(built_dex) 43else 44$(built_dpi_apk): PRIVATE_DEX_FILE := 45endif # full_classes_jar 46 47# Set up dependenncies and the build recipe. 48$(built_dpi_apk) : $(R_file_stamp) 49$(built_dpi_apk) : $(all_library_res_package_export_deps) 50$(built_dpi_apk) : $(private_key) $(certificate) $(SIGNAPK_JAR) 51$(built_dpi_apk) : $(AAPT) | $(ZIPALIGN) 52$(built_dpi_apk) : $(all_res_assets) $(jni_shared_libraries) $(full_android_manifest) 53 @echo "target Package: $(PRIVATE_MODULE) ($@)" 54 $(if $(PRIVATE_SOURCE_ARCHIVE),\ 55 $(call initialize-package-file,$(PRIVATE_SOURCE_ARCHIVE),$@),\ 56 $(create-empty-package)) 57 $(add-assets-to-package) 58ifneq ($(jni_shared_libraries),) 59 $(add-jni-shared-libs-to-package) 60endif 61ifeq ($(full_classes_jar),) 62# We don't build jar, need to add the Java resources here. 63 $(if $(PRIVATE_EXTRA_JAR_ARGS),$(call add-java-resources-to,$@)) 64else 65 $(add-dex-to-package) 66ifdef LOCAL_JACK_ENABLED 67 $(add-carried-jack-resources) 68endif 69endif 70 $(sign-package) 71 $(align-package) 72 73# Set up global variables to register this apk to the higher-level dependency graph. 74ALL_MODULES += $(dpi_apk_name) 75ALL_MODULES.$(dpi_apk_name).CLASS := APPS 76ALL_MODULES.$(dpi_apk_name).BUILT := $(built_dpi_apk) 77PACKAGES := $(PACKAGES) $(dpi_apk_name) 78PACKAGES.$(dpi_apk_name).PRIVATE_KEY := $(private_key) 79PACKAGES.$(dpi_apk_name).CERTIFICATE := $(certificate) 80 81# Phony targets used by "apps_only". 82.PHONY: $(dpi_apk_name) 83$(dpi_apk_name) : $(built_dpi_apk) 84