Use the final APK for dexpreopt when it's not stripped.

The final APK may contain compressed or uncompressed dex files,
and this affects dex2oat compilation.

Test: build sailfish, test that SystemUI.vdex and Settings.vdex
don't have the dex code.

Change-Id: Ic032f61ed67dcdf342f6eaef71d805b89d6fc99a
This commit is contained in:
Nicolas Geoffray
2018-12-07 00:19:57 +00:00
parent 4681fc3803
commit d80f9c0d32

View File

@@ -67,9 +67,18 @@ ifneq ($(BUILD_PLATFORM_ZIP),)
endif
ifdef LOCAL_DEX_PREOPT
ifdef LOCAL_STRIP_DEX
# If we have stripped the final APK, use the original jar generated by soong.
$(built_odex): $(LOCAL_SOONG_DEX_JAR)
$(call dexpreopt-one-file,$<,$@)
$(eval $(call dexpreopt-copy-jar,$(LOCAL_PREBUILT_MODULE_FILE),$(LOCAL_BUILT_MODULE),$(LOCAL_STRIP_DEX)))
else
# If we haven't stripped, use the final APK for dexpreopt, as this may affect how the dex
# code is compiled.
$(built_odex): $(LOCAL_PREBUILT_MODULE_FILE)
$(call dexpreopt-one-file,$<,$@)
$(eval $(call dexpreopt-copy-jar,$(LOCAL_PREBUILT_MODULE_FILE),$(LOCAL_BUILT_MODULE),$(LOCAL_STRIP_DEX)))
endif # LOCAL_STRIP_DEX
else
$(eval $(call copy-one-file,$(LOCAL_PREBUILT_MODULE_FILE),$(LOCAL_BUILT_MODULE)))
endif