forked from openkylin/platform_build
Merge "Tighter control of stripping in dex_preopt_odex_install."
This commit is contained in:
commit
ec1fdc8813
|
@ -2784,18 +2784,22 @@ endef
|
|||
# $(3): LOCAL_DEX_PREOPT, if nostripping then leave classes*.dex
|
||||
define dexpreopt-copy-jar
|
||||
$(2): $(1)
|
||||
@echo $(if $(filter nostripping,$(3)),"Copy: $$@","Copy without dex: $$@")
|
||||
@echo "Copy: $$@"
|
||||
$$(copy-file-to-target)
|
||||
$(if $(filter nostripping,$(3)),,$$(call dexpreopt-remove-classes.dex,$$@))
|
||||
endef
|
||||
|
||||
# $(1): the .jar or .apk to remove classes.dex
|
||||
# $(1): the .jar or .apk to remove classes.dex. Note that if all dex files
|
||||
# are uncompressed in the archive, then dexopt will not do a copy of the dex
|
||||
# files and we should not strip.
|
||||
define dexpreopt-remove-classes.dex
|
||||
$(hide) zip --quiet --delete $(1) classes.dex; \
|
||||
$(hide) if (zipinfo $1 '*.dex' 2>/dev/null | grep -v ' stor ' >/dev/null) ; then \
|
||||
zip --quiet --delete $(1) classes.dex; \
|
||||
dex_index=2; \
|
||||
while zip --quiet --delete $(1) classes$${dex_index}.dex > /dev/null; do \
|
||||
let dex_index=dex_index+1; \
|
||||
done
|
||||
done \
|
||||
fi
|
||||
endef
|
||||
|
||||
###########################################################
|
||||
|
|
|
@ -1,6 +1,20 @@
|
|||
# dexpreopt_odex_install.mk is used to define odex creation rules for JARs and APKs
|
||||
# This file depends on variables set in base_rules.mk
|
||||
# Output variables: LOCAL_DEX_PREOPT, built_odex, dexpreopt_boot_jar_module
|
||||
# Output variables: LOCAL_DEX_PREOPT, LOCAL_UNCOMPRESS_DEX, built_odex,
|
||||
# dexpreopt_boot_jar_module
|
||||
|
||||
# We explicitly uncompress APKs of privileged apps, and used by
|
||||
# privileged apps
|
||||
LOCAL_UNCOMPRESS_DEX := false
|
||||
ifneq (true,$(DONT_UNCOMPRESS_PRIV_APPS_DEXS))
|
||||
ifeq (true,$(LOCAL_PRIVILEGED_MODULE))
|
||||
LOCAL_UNCOMPRESS_DEX := true
|
||||
else
|
||||
ifneq (,$(filter $(PRODUCT_LOADED_BY_PRIVILEGED_MODULES), $(LOCAL_MODULE)))
|
||||
LOCAL_UNCOMPRESS_DEX := true
|
||||
endif # PRODUCT_LOADED_BY_PRIVILEGED_MODULES
|
||||
endif # LOCAL_PRIVILEGED_MODULE
|
||||
endif # DONT_UNCOMPRESS_PRIV_APPS_DEXS
|
||||
|
||||
# Setting LOCAL_DEX_PREOPT based on WITH_DEXPREOPT, LOCAL_DEX_PREOPT, etc
|
||||
LOCAL_DEX_PREOPT := $(strip $(LOCAL_DEX_PREOPT))
|
||||
|
@ -46,14 +60,27 @@ endif
|
|||
endif
|
||||
endif
|
||||
|
||||
# if installing into system, and odex are being installed into system_other, don't strip
|
||||
ifeq ($(BOARD_USES_SYSTEM_OTHER_ODEX),true)
|
||||
ifeq ($(LOCAL_DEX_PREOPT),true)
|
||||
|
||||
# Don't strip with dexes we explicitly uncompress (dexopt will not store the dex code).
|
||||
ifeq ($(LOCAL_UNCOMPRESS_DEX),true)
|
||||
LOCAL_DEX_PREOPT := nostripping
|
||||
endif # LOCAL_UNCOMPRESS_DEX
|
||||
|
||||
# system_other isn't there for an OTA, so don't strip
|
||||
# if module is on system, and odex is on system_other.
|
||||
ifeq ($(BOARD_USES_SYSTEM_OTHER_ODEX),true)
|
||||
ifneq ($(call install-on-system-other, $(my_module_path)),)
|
||||
LOCAL_DEX_PREOPT := nostripping
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
endif # install-on-system-other
|
||||
endif # BOARD_USES_SYSTEM_OTHER_ODEX
|
||||
|
||||
# We also don't strip if all dexs are uncompressed (dexopt will not store the dex code),
|
||||
# but that requires to inspect the source file, which is too early at this point (as we
|
||||
# don't know if the source file will actually be used).
|
||||
# See dexpreopt-remove-classes.dex.
|
||||
|
||||
endif # LOCAL_DEX_PREOPT
|
||||
|
||||
built_odex :=
|
||||
built_vdex :=
|
||||
|
|
|
@ -72,10 +72,10 @@ $(common_javalib.jar) : $(built_dex) $(java_resource_sources) | $(ZIPTIME) $(ZIP
|
|||
$(call add-dex-to-package-arg,$@.tmp)
|
||||
$(hide) $(ZIPTIME) $@.tmp
|
||||
$(call commit-change-for-toc,$@)
|
||||
ifneq (,$(filter $(PRODUCT_LOADED_BY_PRIVILEGED_MODULES), $(LOCAL_MODULE)))
|
||||
ifeq (true, $(LOCAL_UNCOMPRESS_DEX))
|
||||
$(uncompress-dexs)
|
||||
$(align-package)
|
||||
endif # PRODUCT_LOADED_BY_PRIVILEGED_MODULES
|
||||
endif # LOCAL_UNCOMPRESS_DEX
|
||||
|
||||
.KATI_RESTAT: $(common_javalib.jar)
|
||||
|
||||
|
|
|
@ -580,7 +580,7 @@ $(LOCAL_BUILT_MODULE) : $(my_res_package) $(AAPT2) | $(ACP)
|
|||
else
|
||||
$(LOCAL_BUILT_MODULE): PRIVATE_RESOURCE_LIST := $(all_res_assets)
|
||||
$(LOCAL_BUILT_MODULE) : $(all_res_assets) $(full_android_manifest) $(AAPT) $(ZIPALIGN)
|
||||
endif
|
||||
endif # LOCAL_USE_AAPT2
|
||||
ifdef LOCAL_COMPRESSED_MODULE
|
||||
$(LOCAL_BUILT_MODULE) : $(MINIGZIP)
|
||||
endif
|
||||
|
@ -605,24 +605,19 @@ ifdef LOCAL_USE_AAPT2
|
|||
$(call add-jar-resources-to-package,$@,$(PRIVATE_FULL_CLASSES_JAR),$(PRIVATE_RESOURCE_INTERMEDIATES_DIR))
|
||||
endif
|
||||
endif # full_classes_jar
|
||||
ifeq (true, $(LOCAL_UNCOMPRESS_DEX))
|
||||
@# No need to align, sign-package below will do it.
|
||||
$(uncompress-dexs)
|
||||
endif
|
||||
ifdef LOCAL_DEX_PREOPT
|
||||
ifneq ($(BUILD_PLATFORM_ZIP),)
|
||||
@# Keep a copy of apk with classes.dex unstripped
|
||||
$(hide) cp -f $@ $(dir $@)package.dex.apk
|
||||
endif # BUILD_PLATFORM_ZIP
|
||||
ifneq (true,$(DONT_UNCOMPRESS_PRIV_APPS_DEXS))
|
||||
ifeq (true,$(LOCAL_PRIVILEGED_MODULE))
|
||||
@# No need to align, sign-package below will do it.
|
||||
$(uncompress-dexs)
|
||||
endif # LOCAL_PRIVILEGED_MODULE
|
||||
endif # DONT_UNCOMPRESS_PRIV_APPS_DEXS
|
||||
ifneq (nostripping,$(LOCAL_DEX_PREOPT))
|
||||
$(call dexpreopt-remove-classes.dex,$@)
|
||||
endif
|
||||
endif
|
||||
ifneq (,$(filter $(PRODUCT_LOADED_BY_PRIVILEGED_MODULES), $(LOCAL_MODULE)))
|
||||
$(uncompress-dexs)
|
||||
endif # PRODUCT_LOADED_BY_PRIVILEGED_MODULES
|
||||
endif # LOCAL_DEX_PREOPT
|
||||
$(sign-package)
|
||||
ifdef LOCAL_COMPRESSED_MODULE
|
||||
$(compress-package)
|
||||
|
@ -646,6 +641,10 @@ $(built_odex): PRIVATE_DEX_FILE := $(built_dex)
|
|||
$(built_odex) : $(dir $(LOCAL_BUILT_MODULE))% : $(built_dex)
|
||||
$(hide) mkdir -p $(dir $@) && rm -f $@
|
||||
$(add-dex-to-package)
|
||||
ifeq (true, $(LOCAL_UNCOMPRESS_DEX))
|
||||
$(uncompress-dexs)
|
||||
$(align-package)
|
||||
endif
|
||||
$(hide) mv $@ $@.input
|
||||
$(call dexpreopt-one-file,$@.input,$@)
|
||||
$(hide) rm $@.input
|
||||
|
|
|
@ -390,15 +390,9 @@ endif
|
|||
$(built_module) : $(my_prebuilt_src_file) | $(ZIPALIGN) $(SIGNAPK_JAR)
|
||||
$(transform-prebuilt-to-target)
|
||||
$(uncompress-shared-libs)
|
||||
ifneq (true,$(DONT_UNCOMPRESS_PRIV_APPS_DEXS))
|
||||
ifeq (true,$(LOCAL_PRIVILEGED_MODULE))
|
||||
ifeq (true, $(LOCAL_UNCOMPRESS_DEX))
|
||||
$(uncompress-dexs)
|
||||
else
|
||||
ifneq (,$(filter $(PRODUCT_LOADED_BY_PRIVILEGED_MODULES), $(LOCAL_MODULE)))
|
||||
$(uncompress-dexs)
|
||||
endif # PRODUCT_LOADED_BY_PRIVILEGED_MODULES
|
||||
endif # LOCAL_PRIVILEGED_MODULE
|
||||
endif # DONT_UNCOMPRESS_PRIV_APPS_DEXS
|
||||
endif # LOCAL_UNCOMPRESS_DEX
|
||||
ifdef LOCAL_DEX_PREOPT
|
||||
ifneq ($(BUILD_PLATFORM_ZIP),)
|
||||
@# Keep a copy of apk with classes.dex unstripped
|
||||
|
|
Loading…
Reference in New Issue