aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Android.mk1
-rw-r--r--CleanSpec.mk10
-rw-r--r--common/json.mk (renamed from core/json.mk)0
-rw-r--r--core/Makefile160
-rw-r--r--core/OWNERS2
-rw-r--r--core/android_manifest.mk4
-rw-r--r--core/app_certificate_validate.mk12
-rw-r--r--core/binary.mk283
-rw-r--r--core/clear_vars.mk6
-rw-r--r--core/config.mk62
-rw-r--r--core/config_sanitizers.mk7
-rwxr-xr-xcore/construct_context.sh65
-rw-r--r--core/definitions.mk13
-rw-r--r--core/dex_preopt.mk72
-rw-r--r--core/dex_preopt_config.mk205
-rw-r--r--core/dex_preopt_libart.mk116
-rw-r--r--core/dex_preopt_libart_boot.mk8
-rw-r--r--core/dex_preopt_odex_install.mk454
-rw-r--r--core/goma.mk23
-rw-r--r--core/java.mk2
-rw-r--r--core/java_common.mk8
-rw-r--r--core/java_library.mk14
-rw-r--r--core/java_renderscript.mk4
-rw-r--r--core/main.mk15
-rw-r--r--core/package_internal.mk96
-rw-r--r--core/prebuilt_internal.mk48
-rw-r--r--core/product.mk3
-rw-r--r--core/product_config.mk23
-rw-r--r--core/setup_one_odex.mk140
-rw-r--r--core/soong_app_prebuilt.mk37
-rw-r--r--core/soong_config.mk18
-rw-r--r--core/soong_java_prebuilt.mk52
-rw-r--r--core/static_java_library.mk2
-rw-r--r--core/version_defaults.mk11
-rw-r--r--envsetup.sh49
-rw-r--r--target/Android.mk23
-rw-r--r--target/OWNERS1
-rw-r--r--target/board/BoardConfigEmuCommon.mk4
-rw-r--r--target/board/BoardConfigGsiCommon.mk19
-rw-r--r--target/board/generic/BoardConfig.mk5
-rw-r--r--target/board/generic_arm64/BoardConfig.mk6
-rw-r--r--target/board/generic_arm64_a/BoardConfig.mk5
-rw-r--r--target/board/generic_arm64_ab/BoardConfig.mk11
-rw-r--r--target/board/generic_arm_a/BoardConfig.mk8
-rw-r--r--target/board/generic_arm_ab/BoardConfig.mk12
-rw-r--r--target/board/generic_x86_64_a/BoardConfig.mk5
-rw-r--r--target/board/generic_x86_64_ab/BoardConfig.mk11
-rw-r--r--target/board/generic_x86_a/BoardConfig.mk8
-rw-r--r--target/board/generic_x86_ab/BoardConfig.mk12
-rw-r--r--target/board/treble_common.mk69
-rw-r--r--target/board/treble_common_64.mk20
-rw-r--r--target/board/treble_system.prop8
-rw-r--r--target/product/aosp_arm.mk3
-rw-r--r--target/product/aosp_arm64.mk3
-rw-r--r--target/product/aosp_arm64_a.mk2
-rw-r--r--target/product/aosp_arm64_ab.mk2
-rw-r--r--target/product/aosp_arm_a.mk2
-rw-r--r--target/product/aosp_arm_ab.mk2
-rw-r--r--target/product/aosp_x86.mk3
-rw-r--r--target/product/aosp_x86_64.mk3
-rw-r--r--target/product/aosp_x86_64_a.mk2
-rw-r--r--target/product/aosp_x86_64_ab.mk2
-rw-r--r--target/product/aosp_x86_a.mk2
-rw-r--r--target/product/aosp_x86_ab.mk2
-rw-r--r--target/product/base_system.mk19
-rw-r--r--target/product/base_vendor.mk4
-rw-r--r--target/product/go_defaults_common.mk4
-rw-r--r--target/product/gsi/28.txt (renamed from target/product/vndk/28.txt)0
-rw-r--r--target/product/gsi/Android.mk (renamed from target/product/vndk/Android.mk)0
-rw-r--r--target/product/gsi/OWNERS (renamed from target/product/vndk/OWNERS)0
-rw-r--r--target/product/gsi/current.txt (renamed from target/product/vndk/current.txt)4
-rw-r--r--target/product/gsi/init.gsi.rc3
-rw-r--r--target/product/gsi/init.legacy-gsi.rc (renamed from target/product/vndk/init.legacy-gsi.rc)0
-rw-r--r--target/product/gsi/init.vndk-27.rc (renamed from target/product/vndk/init.vndk-27.rc)0
-rw-r--r--target/product/gsi/skip_mount.cfg2
-rw-r--r--target/product/handheld_system.mk23
-rw-r--r--target/product/handheld_vendor.mk24
-rw-r--r--target/product/languages_default.mk105
-rw-r--r--target/product/languages_full.mk97
-rw-r--r--target/product/languages_small.mk24
-rw-r--r--target/product/mainline.mk (renamed from target/board/treble_common_32.mk)8
-rw-r--r--target/product/mainline_arm64.mk47
-rw-r--r--target/product/mainline_system.mk7
-rw-r--r--target/product/media_vendor.mk5
-rw-r--r--target/product/product_launched_with_k.mk2
-rw-r--r--target/product/product_launched_with_l.mk1
-rw-r--r--target/product/runtime_libart.mk1
-rw-r--r--target/product/telephony_system.mk2
-rw-r--r--target/product/telephony_vendor.mk6
-rw-r--r--target/product/treble_common.mk9
-rw-r--r--target/product/vndk/init.gsi.rc2
-rw-r--r--tools/Android.mk23
-rwxr-xr-xtools/buildinfo.sh5
-rw-r--r--tools/droiddoc/Android.mk17
-rw-r--r--tools/fs_config/OWNERS2
-rw-r--r--tools/fs_config/fs_config_generate.c17
-rwxr-xr-xtools/fs_config/fs_config_generator.py44
-rwxr-xr-xtools/releasetools/add_img_to_target_files.py5
-rw-r--r--tools/releasetools/blockimgdiff.py356
-rwxr-xr-xtools/releasetools/build_image.py35
-rwxr-xr-xtools/releasetools/build_super_image.py52
-rw-r--r--tools/releasetools/common.py11
-rw-r--r--tools/releasetools/test_blockimgdiff.py6
-rw-r--r--tools/signapk/Android.bp6
-rw-r--r--tools/signapk/Android.mk26
105 files changed, 1614 insertions, 1670 deletions
diff --git a/Android.mk b/Android.mk
deleted file mode 100644
index 5053e7d64..000000000
--- a/Android.mk
+++ /dev/null
@@ -1 +0,0 @@
1include $(call all-subdir-makefiles)
diff --git a/CleanSpec.mk b/CleanSpec.mk
index 8058d8699..b32868eab 100644
--- a/CleanSpec.mk
+++ b/CleanSpec.mk
@@ -522,6 +522,16 @@ $(call add-clean-step, find $(OUT_DIR)/target/product/mainline_arm64/system -typ
522# Clean up aidegen 522# Clean up aidegen
523$(call add-clean-step, rm -f $(HOST_OUT)/bin/aidegen) 523$(call add-clean-step, rm -f $(HOST_OUT)/bin/aidegen)
524 524
525# Remove perfprofd
526$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/bin/perfprofd)
527
528# Remove incorrectly created directories in the source tree
529$(call add-clean-step, find system/app system/priv-app system/framework system_other -depth -type d -print0 | xargs -0 rmdir)
530$(call add-clean-step, rm -f .d)
531
532# Remove obsolete apps
533$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/app/*)
534
525# ************************************************ 535# ************************************************
526# NEWER CLEAN STEPS MUST BE AT THE END OF THE LIST 536# NEWER CLEAN STEPS MUST BE AT THE END OF THE LIST
527# ************************************************ 537# ************************************************
diff --git a/core/json.mk b/common/json.mk
index ba8ffa73e..ba8ffa73e 100644
--- a/core/json.mk
+++ b/common/json.mk
diff --git a/core/Makefile b/core/Makefile
index c361ef47b..c63e2137e 100644
--- a/core/Makefile
+++ b/core/Makefile
@@ -122,6 +122,33 @@ ndk-docs: $(ndk_doxygen_out)/index.html
122endif 122endif
123 123
124# ----------------------------------------------------------------- 124# -----------------------------------------------------------------
125# generate preview API fingerprint
126api_fingerprint := $(call intermediates-dir-for,PACKAGING,api_fingerprint)/api_fingerprint.txt
127.KATI_READONLY := api_fingerprint
128
129ifeq (REL,$(PLATFORM_VERSION_CODENAME))
130 $(api_fingerprint):
131 echo REL >$@
132else ifneq ($(TARGET_BUILD_APPS),)
133 # TODO: use a prebuilt api_fingerprint.txt from prebuilts/sdk/current.txt once we have one
134 #$(eval $(call copy-one-file,prebuilts/sdk/current/api_fingerprint.txt,$(api_fingerprint)))
135 $(api_fingerprint):
136 echo $(PLATFORM_PREVIEW_SDK_VERSION) >$@
137else ifneq ($(TARGET_BUILD_PDK),)
138 $(eval $(call copy-one-file,$(_pdk_fusion_intermediates)/api_fingerprint.txt,$(api_fingerprint)))
139else
140 ifeq ($(HOST_OS),darwin)
141 $(api_fingerprint): PRIVATE_HASH := md5
142 else
143 $(api_fingerprint): PRIVATE_HASH := md5sum
144 endif
145 $(api_fingerprint): $(sort $(wildcard frameworks/base/api/*current.txt))
146 cat $^ | $(PRIVATE_HASH) | cut -d' ' -f1 >$@
147
148 $(call dist-for-goals,sdk,$(api_fingerprint))
149endif
150
151# -----------------------------------------------------------------
125# property_overrides_split_enabled 152# property_overrides_split_enabled
126property_overrides_split_enabled := 153property_overrides_split_enabled :=
127ifeq ($(BOARD_PROPERTY_OVERRIDES_SPLIT_ENABLED), true) 154ifeq ($(BOARD_PROPERTY_OVERRIDES_SPLIT_ENABLED), true)
@@ -290,7 +317,7 @@ $(intermediate_system_build_prop): PRIVATE_BUILD_DESC := $(build_desc)
290# The string used to uniquely identify the combined build and product; used by the OTA server. 317# The string used to uniquely identify the combined build and product; used by the OTA server.
291ifeq (,$(strip $(BUILD_FINGERPRINT))) 318ifeq (,$(strip $(BUILD_FINGERPRINT)))
292 ifeq ($(strip $(HAS_BUILD_NUMBER)),false) 319 ifeq ($(strip $(HAS_BUILD_NUMBER)),false)
293 BF_BUILD_NUMBER := $(USER)$$($(DATE_FROM_FILE) +%m%d%H%M) 320 BF_BUILD_NUMBER := $(BUILD_USERNAME)$$($(DATE_FROM_FILE) +%m%d%H%M)
294 else 321 else
295 BF_BUILD_NUMBER := $(file <$(BUILD_NUMBER_FILE)) 322 BF_BUILD_NUMBER := $(file <$(BUILD_NUMBER_FILE))
296 endif 323 endif
@@ -368,7 +395,7 @@ system_prop_file := $(TARGET_SYSTEM_PROP)
368else 395else
369system_prop_file := $(wildcard $(TARGET_DEVICE_DIR)/system.prop) 396system_prop_file := $(wildcard $(TARGET_DEVICE_DIR)/system.prop)
370endif 397endif
371$(intermediate_system_build_prop): $(BUILDINFO_SH) $(BUILDINFO_COMMON_SH) $(INTERNAL_BUILD_ID_MAKEFILE) $(BUILD_SYSTEM)/version_defaults.mk $(system_prop_file) $(INSTALLED_ANDROID_INFO_TXT_TARGET) 398$(intermediate_system_build_prop): $(BUILDINFO_SH) $(BUILDINFO_COMMON_SH) $(INTERNAL_BUILD_ID_MAKEFILE) $(BUILD_SYSTEM)/version_defaults.mk $(system_prop_file) $(INSTALLED_ANDROID_INFO_TXT_TARGET) $(api_fingerprint)
372 @echo Target buildinfo: $@ 399 @echo Target buildinfo: $@
373 @mkdir -p $(dir $@) 400 @mkdir -p $(dir $@)
374 $(hide) echo > $@ 401 $(hide) echo > $@
@@ -393,6 +420,8 @@ endif
393 BUILD_ID="$(BUILD_ID)" \ 420 BUILD_ID="$(BUILD_ID)" \
394 BUILD_DISPLAY_ID="$(BUILD_DISPLAY_ID)" \ 421 BUILD_DISPLAY_ID="$(BUILD_DISPLAY_ID)" \
395 DATE="$(DATE_FROM_FILE)" \ 422 DATE="$(DATE_FROM_FILE)" \
423 BUILD_USERNAME="$(BUILD_USERNAME)" \
424 BUILD_HOSTNAME="$(BUILD_HOSTNAME)" \
396 BUILD_NUMBER="$(BUILD_NUMBER_FROM_FILE)" \ 425 BUILD_NUMBER="$(BUILD_NUMBER_FROM_FILE)" \
397 BOARD_BUILD_SYSTEM_ROOT_IMAGE="$(BOARD_BUILD_SYSTEM_ROOT_IMAGE)" \ 426 BOARD_BUILD_SYSTEM_ROOT_IMAGE="$(BOARD_BUILD_SYSTEM_ROOT_IMAGE)" \
398 AB_OTA_UPDATER="$(AB_OTA_UPDATER)" \ 427 AB_OTA_UPDATER="$(AB_OTA_UPDATER)" \
@@ -401,6 +430,7 @@ endif
401 PLATFORM_BASE_OS="$(PLATFORM_BASE_OS)" \ 430 PLATFORM_BASE_OS="$(PLATFORM_BASE_OS)" \
402 PLATFORM_SDK_VERSION="$(PLATFORM_SDK_VERSION)" \ 431 PLATFORM_SDK_VERSION="$(PLATFORM_SDK_VERSION)" \
403 PLATFORM_PREVIEW_SDK_VERSION="$(PLATFORM_PREVIEW_SDK_VERSION)" \ 432 PLATFORM_PREVIEW_SDK_VERSION="$(PLATFORM_PREVIEW_SDK_VERSION)" \
433 PLATFORM_PREVIEW_SDK_FINGERPRINT="$$(cat $(api_fingerprint))" \
404 PLATFORM_VERSION_CODENAME="$(PLATFORM_VERSION_CODENAME)" \ 434 PLATFORM_VERSION_CODENAME="$(PLATFORM_VERSION_CODENAME)" \
405 PLATFORM_VERSION_ALL_CODENAMES="$(PLATFORM_VERSION_ALL_CODENAMES)" \ 435 PLATFORM_VERSION_ALL_CODENAMES="$(PLATFORM_VERSION_ALL_CODENAMES)" \
406 PLATFORM_MIN_SUPPORTED_TARGET_SDK_VERSION="$(PLATFORM_MIN_SUPPORTED_TARGET_SDK_VERSION)" \ 436 PLATFORM_MIN_SUPPORTED_TARGET_SDK_VERSION="$(PLATFORM_MIN_SUPPORTED_TARGET_SDK_VERSION)" \
@@ -1564,43 +1594,74 @@ RECOVERY_ERASING_TEXT_FILE := $(dir $(RECOVERY_INSTALLING_TEXT_FILE))/erasing_te
1564RECOVERY_ERROR_TEXT_FILE := $(dir $(RECOVERY_INSTALLING_TEXT_FILE))/error_text.png 1594RECOVERY_ERROR_TEXT_FILE := $(dir $(RECOVERY_INSTALLING_TEXT_FILE))/error_text.png
1565RECOVERY_NO_COMMAND_TEXT_FILE := $(dir $(RECOVERY_INSTALLING_TEXT_FILE))/no_command_text.png 1595RECOVERY_NO_COMMAND_TEXT_FILE := $(dir $(RECOVERY_INSTALLING_TEXT_FILE))/no_command_text.png
1566 1596
1567generated_recovery_background_text_files := \ 1597RECOVERY_CANCEL_WIPE_DATA_TEXT_FILE := $(dir $(RECOVERY_INSTALLING_TEXT_FILE))/cancel_wipe_data_text.png
1598RECOVERY_FACTORY_DATA_RESET_TEXT_FILE := $(dir $(RECOVERY_INSTALLING_TEXT_FILE))/factory_data_reset_text.png
1599RECOVERY_TRY_AGAIN_TEXT_FILE := $(dir $(RECOVERY_INSTALLING_TEXT_FILE))/try_again_text.png
1600RECOVERY_WIPE_DATA_CONFIRMATION_TEXT_FILE := $(dir $(RECOVERY_INSTALLING_TEXT_FILE))/wipe_data_confirmation_text.png
1601RECOVERY_WIPE_DATA_MENU_HEADER_TEXT_FILE := $(dir $(RECOVERY_INSTALLING_TEXT_FILE))/wipe_data_menu_header_text.png
1602
1603generated_recovery_text_files := \
1568 $(RECOVERY_INSTALLING_TEXT_FILE) \ 1604 $(RECOVERY_INSTALLING_TEXT_FILE) \
1569 $(RECOVERY_INSTALLING_SECURITY_TEXT_FILE) \ 1605 $(RECOVERY_INSTALLING_SECURITY_TEXT_FILE) \
1570 $(RECOVERY_ERASING_TEXT_FILE) \ 1606 $(RECOVERY_ERASING_TEXT_FILE) \
1571 $(RECOVERY_ERROR_TEXT_FILE) \ 1607 $(RECOVERY_ERROR_TEXT_FILE) \
1572 $(RECOVERY_NO_COMMAND_TEXT_FILE) 1608 $(RECOVERY_NO_COMMAND_TEXT_FILE) \
1609 $(RECOVERY_CANCEL_WIPE_DATA_TEXT_FILE) \
1610 $(RECOVERY_FACTORY_DATA_RESET_TEXT_FILE) \
1611 $(RECOVERY_TRY_AGAIN_TEXT_FILE) \
1612 $(RECOVERY_WIPE_DATA_CONFIRMATION_TEXT_FILE) \
1613 $(RECOVERY_WIPE_DATA_MENU_HEADER_TEXT_FILE)
1573 1614
1574resource_dir := $(call include-path-for, recovery)/tools/recovery_l10n/res/ 1615resource_dir := $(call include-path-for, recovery)/tools/recovery_l10n/res/
1575image_generator_jar := $(HOST_OUT_JAVA_LIBRARIES)/RecoveryImageGenerator.jar 1616image_generator_jar := $(HOST_OUT_JAVA_LIBRARIES)/RecoveryImageGenerator.jar
1617zopflipng := $(HOST_OUT_EXECUTABLES)/zopflipng
1576$(RECOVERY_INSTALLING_TEXT_FILE): PRIVATE_SOURCE_FONTS := $(recovery_noto-fonts_dep) $(recovery_roboto-fonts_dep) 1618$(RECOVERY_INSTALLING_TEXT_FILE): PRIVATE_SOURCE_FONTS := $(recovery_noto-fonts_dep) $(recovery_roboto-fonts_dep)
1577$(RECOVERY_INSTALLING_TEXT_FILE): PRIVATE_RECOVERY_FONT_FILES_DIR := $(call intermediates-dir-for,PACKAGING,recovery_font_files) 1619$(RECOVERY_INSTALLING_TEXT_FILE): PRIVATE_RECOVERY_FONT_FILES_DIR := $(call intermediates-dir-for,PACKAGING,recovery_font_files)
1578$(RECOVERY_INSTALLING_TEXT_FILE): PRIVATE_RESOURCE_DIR := $(resource_dir) 1620$(RECOVERY_INSTALLING_TEXT_FILE): PRIVATE_RESOURCE_DIR := $(resource_dir)
1579$(RECOVERY_INSTALLING_TEXT_FILE): PRIVATE_IMAGE_GENERATOR_JAR := $(image_generator_jar) 1621$(RECOVERY_INSTALLING_TEXT_FILE): PRIVATE_IMAGE_GENERATOR_JAR := $(image_generator_jar)
1622$(RECOVERY_INSTALLING_TEXT_FILE): PRIVATE_ZOPFLIPNG := $(zopflipng)
1580$(RECOVERY_INSTALLING_TEXT_FILE): PRIVATE_RECOVERY_IMAGE_WIDTH := $(recovery_image_width) 1623$(RECOVERY_INSTALLING_TEXT_FILE): PRIVATE_RECOVERY_IMAGE_WIDTH := $(recovery_image_width)
1581$(RECOVERY_INSTALLING_TEXT_FILE): PRIVATE_RECOVERY_TEXT_LIST := recovery_installing recovery_installing_security recovery_erasing recovery_error recovery_no_command 1624$(RECOVERY_INSTALLING_TEXT_FILE): PRIVATE_RECOVERY_BACKGROUND_TEXT_LIST := \
1582$(RECOVERY_INSTALLING_TEXT_FILE): .KATI_IMPLICIT_OUTPUTS := $(RECOVERY_INSTALLING_SECURITY_TEXT_FILE) $(RECOVERY_ERASING_TEXT_FILE) $(RECOVERY_ERROR_TEXT_FILE) $(RECOVERY_NO_COMMAND_TEXT_FILE) 1625 recovery_installing \
1583$(RECOVERY_INSTALLING_TEXT_FILE): $(image_generator_jar) $(resource_dir) $(recovery_noto-fonts_dep) $(recovery_roboto-fonts_dep) 1626 recovery_installing_security \
1627 recovery_erasing \
1628 recovery_error \
1629 recovery_no_command
1630$(RECOVERY_INSTALLING_TEXT_FILE): PRIVATE_RECOVERY_WIPE_DATA_TEXT_LIST := \
1631 recovery_cancel_wipe_data \
1632 recovery_factory_data_reset \
1633 recovery_try_again \
1634 recovery_wipe_data_menu_header \
1635 recovery_wipe_data_confirmation
1636$(RECOVERY_INSTALLING_TEXT_FILE): .KATI_IMPLICIT_OUTPUTS := $(filter-out $(RECOVERY_INSTALLING_TEXT_FILE),$(generated_recovery_text_files))
1637$(RECOVERY_INSTALLING_TEXT_FILE): $(image_generator_jar) $(resource_dir) $(recovery_noto-fonts_dep) $(recovery_roboto-fonts_dep) $(zopflipng)
1584 # Prepares the font directory. 1638 # Prepares the font directory.
1585 @rm -rf $(PRIVATE_RECOVERY_FONT_FILES_DIR) 1639 @rm -rf $(PRIVATE_RECOVERY_FONT_FILES_DIR)
1586 @mkdir -p $(PRIVATE_RECOVERY_FONT_FILES_DIR) 1640 @mkdir -p $(PRIVATE_RECOVERY_FONT_FILES_DIR)
1587 $(foreach filename,$(PRIVATE_SOURCE_FONTS), cp $(filename) $(PRIVATE_RECOVERY_FONT_FILES_DIR);) 1641 $(foreach filename,$(PRIVATE_SOURCE_FONTS), cp $(filename) $(PRIVATE_RECOVERY_FONT_FILES_DIR) &&) true
1588
1589 @rm -rf $(dir $@) 1642 @rm -rf $(dir $@)
1590 @mkdir -p $(dir $@) 1643 @mkdir -p $(dir $@)
1591 $(foreach text_name,$(PRIVATE_RECOVERY_TEXT_LIST), \ 1644 $(foreach text_name,$(PRIVATE_RECOVERY_BACKGROUND_TEXT_LIST) $(PRIVATE_RECOVERY_WIPE_DATA_TEXT_LIST), \
1645 $(eval output_file := $(dir $@)/$(patsubst recovery_%,%_text.png,$(text_name))) \
1646 $(eval center_alignment := $(if $(filter $(text_name),$(PRIVATE_RECOVERY_BACKGROUND_TEXT_LIST)), --center_alignment)) \
1592 java -jar $(PRIVATE_IMAGE_GENERATOR_JAR) \ 1647 java -jar $(PRIVATE_IMAGE_GENERATOR_JAR) \
1593 --image_width $(PRIVATE_RECOVERY_IMAGE_WIDTH) \ 1648 --image_width $(PRIVATE_RECOVERY_IMAGE_WIDTH) \
1594 --text_name $(text_name) \ 1649 --text_name $(text_name) \
1595 --font_dir $(PRIVATE_RECOVERY_FONT_FILES_DIR) \ 1650 --font_dir $(PRIVATE_RECOVERY_FONT_FILES_DIR) \
1596 --resource_dir $(PRIVATE_RESOURCE_DIR) \ 1651 --resource_dir $(PRIVATE_RESOURCE_DIR) \
1597 --output_file $(dir $@)/$(patsubst recovery_%,%_text.png,$(text_name));) 1652 --output_file $(output_file) $(center_alignment) && \
1653 $(PRIVATE_ZOPFLIPNG) -y --iterations=1 --filters=0 $(output_file) $(output_file) > /dev/null &&) true
1598else 1654else
1599RECOVERY_INSTALLING_TEXT_FILE := 1655RECOVERY_INSTALLING_TEXT_FILE :=
1600RECOVERY_INSTALLING_SECURITY_TEXT_FILE := 1656RECOVERY_INSTALLING_SECURITY_TEXT_FILE :=
1601RECOVERY_ERASING_TEXT_FILE := 1657RECOVERY_ERASING_TEXT_FILE :=
1602RECOVERY_ERROR_TEXT_FILE := 1658RECOVERY_ERROR_TEXT_FILE :=
1603RECOVERY_NO_COMMAND_TEXT_FILE := 1659RECOVERY_NO_COMMAND_TEXT_FILE :=
1660RECOVERY_CANCEL_WIPE_DATA_TEXT_FILE :=
1661RECOVERY_FACTORY_DATA_RESET_TEXT_FILE :=
1662RECOVERY_TRY_AGAIN_TEXT_FILE :=
1663RECOVERY_WIPE_DATA_CONFIRMATION_TEXT_FILE :=
1664RECOVERY_WIPE_DATA_MENU_HEADER_TEXT_FILE :=
1604endif # TARGET_RECOVERY_UI_SCREEN_WIDTH 1665endif # TARGET_RECOVERY_UI_SCREEN_WIDTH
1605 1666
1606ifndef TARGET_PRIVATE_RES_DIRS 1667ifndef TARGET_PRIVATE_RES_DIRS
@@ -1608,7 +1669,7 @@ TARGET_PRIVATE_RES_DIRS := $(wildcard $(TARGET_DEVICE_DIR)/recovery/res)
1608endif 1669endif
1609recovery_resource_deps := $(shell find $(recovery_resources_common) \ 1670recovery_resource_deps := $(shell find $(recovery_resources_common) \
1610 $(TARGET_PRIVATE_RES_DIRS) -type f) 1671 $(TARGET_PRIVATE_RES_DIRS) -type f)
1611recovery_resource_deps += $(generated_recovery_background_text_files) 1672recovery_resource_deps += $(generated_recovery_text_files)
1612 1673
1613 1674
1614ifdef TARGET_RECOVERY_FSTAB 1675ifdef TARGET_RECOVERY_FSTAB
@@ -1637,9 +1698,12 @@ endif
1637# d) We include the recovery DTBO image within recovery - not needing the resource file as we 1698# d) We include the recovery DTBO image within recovery - not needing the resource file as we
1638# do bsdiff because boot and recovery will contain different number of entries 1699# do bsdiff because boot and recovery will contain different number of entries
1639# (BOARD_INCLUDE_RECOVERY_DTBO = true). 1700# (BOARD_INCLUDE_RECOVERY_DTBO = true).
1701# e) We include the recovery ACPIO image within recovery - not needing the resource file as we
1702# do bsdiff because boot and recovery will contain different number of entries
1703# (BOARD_INCLUDE_RECOVERY_ACPIO = true).
1640 1704
1641ifeq (,$(filter true, $(BOARD_USES_FULL_RECOVERY_IMAGE) $(BOARD_USES_RECOVERY_AS_BOOT) \ 1705ifeq (,$(filter true, $(BOARD_USES_FULL_RECOVERY_IMAGE) $(BOARD_USES_RECOVERY_AS_BOOT) \
1642 $(BOARD_BUILD_SYSTEM_ROOT_IMAGE) $(BOARD_INCLUDE_RECOVERY_DTBO))) 1706 $(BOARD_BUILD_SYSTEM_ROOT_IMAGE) $(BOARD_INCLUDE_RECOVERY_DTBO) $(BOARD_INCLUDE_RECOVERY_ACPIO)))
1643# Named '.dat' so we don't attempt to use imgdiff for patching it. 1707# Named '.dat' so we don't attempt to use imgdiff for patching it.
1644RECOVERY_RESOURCE_ZIP := $(TARGET_OUT)/etc/recovery-resource.dat 1708RECOVERY_RESOURCE_ZIP := $(TARGET_OUT)/etc/recovery-resource.dat
1645else 1709else
@@ -1713,6 +1777,9 @@ endif
1713ifdef BOARD_INCLUDE_RECOVERY_DTBO 1777ifdef BOARD_INCLUDE_RECOVERY_DTBO
1714 INTERNAL_RECOVERYIMAGE_ARGS += --recovery_dtbo $(BOARD_PREBUILT_DTBOIMAGE) 1778 INTERNAL_RECOVERYIMAGE_ARGS += --recovery_dtbo $(BOARD_PREBUILT_DTBOIMAGE)
1715endif 1779endif
1780ifdef BOARD_INCLUDE_RECOVERY_ACPIO
1781 INTERNAL_RECOVERYIMAGE_ARGS += --recovery_acpio $(BOARD_RECOVERY_ACPIO)
1782endif
1716 1783
1717# Keys authorized to sign OTA packages this build will accept. The 1784# Keys authorized to sign OTA packages this build will accept. The
1718# build always uses dev-keys for this; release packaging tools will 1785# build always uses dev-keys for this; release packaging tools will
@@ -1752,8 +1819,8 @@ define build-recoveryimage-target
1752 $(hide) mkdir -p $(TARGET_RECOVERY_ROOT_OUT)/res 1819 $(hide) mkdir -p $(TARGET_RECOVERY_ROOT_OUT)/res
1753 $(hide) rm -rf $(TARGET_RECOVERY_ROOT_OUT)/res/* 1820 $(hide) rm -rf $(TARGET_RECOVERY_ROOT_OUT)/res/*
1754 $(hide) cp -rf $(recovery_resources_common)/* $(TARGET_RECOVERY_ROOT_OUT)/res 1821 $(hide) cp -rf $(recovery_resources_common)/* $(TARGET_RECOVERY_ROOT_OUT)/res
1755 $(hide) $(foreach recovery_text_file,$(generated_recovery_background_text_files), \ 1822 $(hide) $(foreach recovery_text_file,$(generated_recovery_text_files), \
1756 cp -rf $(recovery_text_file) $(TARGET_RECOVERY_ROOT_OUT)/res/images/;) 1823 cp -rf $(recovery_text_file) $(TARGET_RECOVERY_ROOT_OUT)/res/images/ &&) true
1757 $(hide) cp -f $(recovery_font) $(TARGET_RECOVERY_ROOT_OUT)/res/images/font.png 1824 $(hide) cp -f $(recovery_font) $(TARGET_RECOVERY_ROOT_OUT)/res/images/font.png
1758 $(hide) $(foreach item,$(TARGET_PRIVATE_RES_DIRS), \ 1825 $(hide) $(foreach item,$(TARGET_PRIVATE_RES_DIRS), \
1759 cp -rf $(item) $(TARGET_RECOVERY_ROOT_OUT)/$(newline)) 1826 cp -rf $(item) $(TARGET_RECOVERY_ROOT_OUT)/$(newline))
@@ -1799,6 +1866,9 @@ endif
1799ifdef BOARD_INCLUDE_RECOVERY_DTBO 1866ifdef BOARD_INCLUDE_RECOVERY_DTBO
1800$(INSTALLED_BOOTIMAGE_TARGET): $(BOARD_PREBUILT_DTBOIMAGE) 1867$(INSTALLED_BOOTIMAGE_TARGET): $(BOARD_PREBUILT_DTBOIMAGE)
1801endif 1868endif
1869ifdef BOARD_INCLUDE_RECOVERY_ACPIO
1870$(INSTALLED_BOOTIMAGE_TARGET): $(BOARD_RECOVERY_ACPIO)
1871endif
1802 1872
1803$(INSTALLED_BOOTIMAGE_TARGET): $(MKBOOTFS) $(MKBOOTIMG) $(MINIGZIP) \ 1873$(INSTALLED_BOOTIMAGE_TARGET): $(MKBOOTFS) $(MKBOOTIMG) $(MINIGZIP) \
1804 $(INTERNAL_ROOT_FILES) \ 1874 $(INTERNAL_ROOT_FILES) \
@@ -1819,6 +1889,9 @@ endif # BOARD_USES_RECOVERY_AS_BOOT
1819ifdef BOARD_INCLUDE_RECOVERY_DTBO 1889ifdef BOARD_INCLUDE_RECOVERY_DTBO
1820$(INSTALLED_RECOVERYIMAGE_TARGET): $(BOARD_PREBUILT_DTBOIMAGE) 1890$(INSTALLED_RECOVERYIMAGE_TARGET): $(BOARD_PREBUILT_DTBOIMAGE)
1821endif 1891endif
1892ifdef BOARD_INCLUDE_RECOVERY_ACPIO
1893$(INSTALLED_RECOVERYIMAGE_TARGET): $(BOARD_RECOVERY_ACPIO)
1894endif
1822 1895
1823$(INSTALLED_RECOVERYIMAGE_TARGET): $(MKBOOTFS) $(MKBOOTIMG) $(MINIGZIP) \ 1896$(INSTALLED_RECOVERYIMAGE_TARGET): $(MKBOOTFS) $(MKBOOTIMG) $(MINIGZIP) \
1824 $(INTERNAL_ROOT_FILES) \ 1897 $(INTERNAL_ROOT_FILES) \
@@ -2029,7 +2102,7 @@ INSTALLED_SYSTEMIMAGE := $(INSTALLED_SYSTEMIMAGE_TARGET)
2029ifneq ($(INSTALLED_BOOTIMAGE_TARGET),) 2102ifneq ($(INSTALLED_BOOTIMAGE_TARGET),)
2030ifneq ($(INSTALLED_RECOVERYIMAGE_TARGET),) 2103ifneq ($(INSTALLED_RECOVERYIMAGE_TARGET),)
2031ifneq ($(BOARD_USES_FULL_RECOVERY_IMAGE),true) 2104ifneq ($(BOARD_USES_FULL_RECOVERY_IMAGE),true)
2032ifneq (,$(filter true, $(BOARD_BUILD_SYSTEM_ROOT_IMAGE) $(BOARD_INCLUDE_RECOVERY_DTBO))) 2105ifneq (,$(filter true, $(BOARD_BUILD_SYSTEM_ROOT_IMAGE) $(BOARD_INCLUDE_RECOVERY_DTBO) $(BOARD_INCLUDE_RECOVERY_ACPIO)))
2033diff_tool := $(HOST_OUT_EXECUTABLES)/bsdiff 2106diff_tool := $(HOST_OUT_EXECUTABLES)/bsdiff
2034else 2107else
2035diff_tool := $(HOST_OUT_EXECUTABLES)/imgdiff 2108diff_tool := $(HOST_OUT_EXECUTABLES)/imgdiff
@@ -2116,9 +2189,9 @@ stnod: systemtarball-nodeps
2116## Files under out dir will be rejected to prevent possible conflicts with other rules. 2189## Files under out dir will be rejected to prevent possible conflicts with other rules.
2117ifneq (,$(BUILD_PLATFORM_ZIP)) 2190ifneq (,$(BUILD_PLATFORM_ZIP))
2118pdk_odex_javalibs := $(strip $(foreach m,$(DEXPREOPT.MODULES.JAVA_LIBRARIES),\ 2191pdk_odex_javalibs := $(strip $(foreach m,$(DEXPREOPT.MODULES.JAVA_LIBRARIES),\
2119 $(if $(filter $(DEXPREOPT.$(m).INSTALLED),$(ALL_DEFAULT_INSTALLED_MODULES)),$(m)))) 2192 $(if $(filter $(DEXPREOPT.$(m).INSTALLED_STRIPPED),$(ALL_DEFAULT_INSTALLED_MODULES)),$(m))))
2120pdk_odex_apps := $(strip $(foreach m,$(DEXPREOPT.MODULES.APPS),\ 2193pdk_odex_apps := $(strip $(foreach m,$(DEXPREOPT.MODULES.APPS),\
2121 $(if $(filter $(DEXPREOPT.$(m).INSTALLED),$(ALL_DEFAULT_INSTALLED_MODULES)),$(m)))) 2194 $(if $(filter $(DEXPREOPT.$(m).INSTALLED_STRIPPED),$(ALL_DEFAULT_INSTALLED_MODULES)),$(m))))
2122pdk_classes_dex := $(strip \ 2195pdk_classes_dex := $(strip \
2123 $(foreach m,$(pdk_odex_javalibs),$(call intermediates-dir-for,JAVA_LIBRARIES,$(m),,COMMON)/javalib.jar) \ 2196 $(foreach m,$(pdk_odex_javalibs),$(call intermediates-dir-for,JAVA_LIBRARIES,$(m),,COMMON)/javalib.jar) \
2124 $(foreach m,$(pdk_odex_apps),$(call intermediates-dir-for,APPS,$(m))/package.dex.apk)) 2197 $(foreach m,$(pdk_odex_apps),$(call intermediates-dir-for,APPS,$(m))/package.dex.apk))
@@ -2157,7 +2230,7 @@ $(INSTALLED_PLATFORM_ZIP): PRIVATE_ODEX_CONFIG := $(pdk_odex_config_mk)
2157$(INSTALLED_PLATFORM_ZIP) : $(SOONG_ZIP) 2230$(INSTALLED_PLATFORM_ZIP) : $(SOONG_ZIP)
2158# dependencies for the other partitions are defined below after their file lists 2231# dependencies for the other partitions are defined below after their file lists
2159# are known 2232# are known
2160$(INSTALLED_PLATFORM_ZIP) : $(INTERNAL_SYSTEMIMAGE_FILES) $(pdk_classes_dex) $(pdk_odex_config_mk) 2233$(INSTALLED_PLATFORM_ZIP) : $(INTERNAL_SYSTEMIMAGE_FILES) $(pdk_classes_dex) $(pdk_odex_config_mk) $(api_fingerprint)
2161 $(call pretty,"Platform zip package: $(INSTALLED_PLATFORM_ZIP)") 2234 $(call pretty,"Platform zip package: $(INSTALLED_PLATFORM_ZIP)")
2162 rm -f $@ $@.lst 2235 rm -f $@ $@.lst
2163 echo "-C $(PRODUCT_OUT)" >> $@.lst 2236 echo "-C $(PRODUCT_OUT)" >> $@.lst
@@ -2190,6 +2263,7 @@ endif
2190 @# Add dex-preopt files and config. 2263 @# Add dex-preopt files and config.
2191 $(if $(PRIVATE_DEX_FILES),\ 2264 $(if $(PRIVATE_DEX_FILES),\
2192 echo "-C $(OUT_DIR) $(addprefix -f ,$(PRIVATE_DEX_FILES))") >> $@.lst 2265 echo "-C $(OUT_DIR) $(addprefix -f ,$(PRIVATE_DEX_FILES))") >> $@.lst
2266 echo "-C $(dir $(api_fingerprint)) -f $(api_fingerprint)" >> $@.lst
2193 touch $(PRODUCT_OUT)/pdk.mk 2267 touch $(PRODUCT_OUT)/pdk.mk
2194 echo "-C $(PRODUCT_OUT) -f $(PRIVATE_ODEX_CONFIG) -f $(PRODUCT_OUT)/pdk.mk" >> $@.lst 2268 echo "-C $(PRODUCT_OUT) -f $(PRIVATE_ODEX_CONFIG) -f $(PRODUCT_OUT)/pdk.mk" >> $@.lst
2195 $(SOONG_ZIP) --ignore_missing_files -o $@ @$@.lst 2269 $(SOONG_ZIP) --ignore_missing_files -o $@ @$@.lst
@@ -2404,6 +2478,9 @@ INTERNAL_SYSTEMOTHERIMAGE_FILES := \
2404 $(ALL_PDK_FUSION_FILES)) \ 2478 $(ALL_PDK_FUSION_FILES)) \
2405 $(PDK_FUSION_SYMLINK_STAMP) 2479 $(PDK_FUSION_SYMLINK_STAMP)
2406 2480
2481# system_other dex files are installed as a side-effect of installing system image files
2482INTERNAL_SYSTEMOTHERIMAGE_FILES += $(INTERNAL_SYSTEMIMAGE_FILES)
2483
2407INSTALLED_FILES_FILE_SYSTEMOTHER := $(PRODUCT_OUT)/installed-files-system-other.txt 2484INSTALLED_FILES_FILE_SYSTEMOTHER := $(PRODUCT_OUT)/installed-files-system-other.txt
2408INSTALLED_FILES_JSON_SYSTEMOTHER := $(INSTALLED_FILES_FILE_SYSTEMOTHER:.txt=.json) 2485INSTALLED_FILES_JSON_SYSTEMOTHER := $(INSTALLED_FILES_FILE_SYSTEMOTHER:.txt=.json)
2409$(INSTALLED_FILES_FILE_SYSTEMOTHER): .KATI_IMPLICIT_OUTPUTS := $(INSTALLED_FILES_JSON_SYSTEMOTHER) 2486$(INSTALLED_FILES_FILE_SYSTEMOTHER): .KATI_IMPLICIT_OUTPUTS := $(INSTALLED_FILES_JSON_SYSTEMOTHER)
@@ -3208,7 +3285,9 @@ OTATOOLS += \
3208 $(HOST_LIBRARY_PATH)/libpcre2$(HOST_SHLIB_SUFFIX) \ 3285 $(HOST_LIBRARY_PATH)/libpcre2$(HOST_SHLIB_SUFFIX) \
3209 $(HOST_LIBRARY_PATH)/libbrotli$(HOST_SHLIB_SUFFIX) \ 3286 $(HOST_LIBRARY_PATH)/libbrotli$(HOST_SHLIB_SUFFIX) \
3210 $(HOST_LIBRARY_PATH)/liblp$(HOST_SHLIB_SUFFIX) \ 3287 $(HOST_LIBRARY_PATH)/liblp$(HOST_SHLIB_SUFFIX) \
3211 $(HOST_LIBRARY_PATH)/libext4_utils$(HOST_SHLIB_SUFFIX) 3288 $(HOST_LIBRARY_PATH)/libext4_utils$(HOST_SHLIB_SUFFIX) \
3289 $(HOST_LIBRARY_PATH)/libfec$(HOST_SHLIB_SUFFIX) \
3290 $(HOST_LIBRARY_PATH)/libsquashfs_utils$(HOST_SHLIB_SUFFIX)
3212 3291
3213 3292
3214.PHONY: otatools 3293.PHONY: otatools
@@ -3349,6 +3428,8 @@ define dump-dynamic-partitions-info
3349 echo "lpmake=$(notdir $(LPMAKE))" >> $(1) 3428 echo "lpmake=$(notdir $(LPMAKE))" >> $(1)
3350 $(if $(filter true,$(PRODUCT_BUILD_SUPER_PARTITION)), $(if $(BOARD_SUPER_PARTITION_SIZE), \ 3429 $(if $(filter true,$(PRODUCT_BUILD_SUPER_PARTITION)), $(if $(BOARD_SUPER_PARTITION_SIZE), \
3351 echo "build_super_partition=true" >> $(1))) 3430 echo "build_super_partition=true" >> $(1)))
3431 $(if $(filter true,$(BOARD_BUILD_RETROFIT_DYNAMIC_PARTITIONS_OTA_PACKAGE)), \
3432 echo "build_retrofit_dynamic_partitions_ota_package=true" >> $(1))
3352 echo "super_metadata_device=$(BOARD_SUPER_PARTITION_METADATA_DEVICE)" >> $(1) 3433 echo "super_metadata_device=$(BOARD_SUPER_PARTITION_METADATA_DEVICE)" >> $(1)
3353 $(if $(BOARD_SUPER_PARTITION_BLOCK_DEVICES), \ 3434 $(if $(BOARD_SUPER_PARTITION_BLOCK_DEVICES), \
3354 echo "super_block_devices=$(BOARD_SUPER_PARTITION_BLOCK_DEVICES)" >> $(1)) 3435 echo "super_block_devices=$(BOARD_SUPER_PARTITION_BLOCK_DEVICES)" >> $(1))
@@ -3385,6 +3466,7 @@ $(BUILT_TARGET_FILES_PACKAGE): \
3385 $(INSTALLED_KERNEL_TARGET) \ 3466 $(INSTALLED_KERNEL_TARGET) \
3386 $(INSTALLED_2NDBOOTLOADER_TARGET) \ 3467 $(INSTALLED_2NDBOOTLOADER_TARGET) \
3387 $(BOARD_PREBUILT_DTBOIMAGE) \ 3468 $(BOARD_PREBUILT_DTBOIMAGE) \
3469 $(BOARD_RECOVERY_ACPIO) \
3388 $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SYSTEM_BASE_FS_PATH) \ 3470 $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SYSTEM_BASE_FS_PATH) \
3389 $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_VENDOR_BASE_FS_PATH) \ 3471 $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_VENDOR_BASE_FS_PATH) \
3390 $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_PRODUCT_BASE_FS_PATH) \ 3472 $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_PRODUCT_BASE_FS_PATH) \
@@ -3425,6 +3507,9 @@ endif
3425ifdef BOARD_INCLUDE_RECOVERY_DTBO 3507ifdef BOARD_INCLUDE_RECOVERY_DTBO
3426 $(hide) cp $(BOARD_PREBUILT_DTBOIMAGE) $(zip_root)/$(PRIVATE_RECOVERY_OUT)/recovery_dtbo 3508 $(hide) cp $(BOARD_PREBUILT_DTBOIMAGE) $(zip_root)/$(PRIVATE_RECOVERY_OUT)/recovery_dtbo
3427endif 3509endif
3510ifdef BOARD_INCLUDE_RECOVERY_ACPIO
3511 $(hide) cp $(BOARD_RECOVERY_ACPIO) $(zip_root)/$(PRIVATE_RECOVERY_OUT)/recovery_acpio
3512endif
3428ifdef INTERNAL_KERNEL_CMDLINE 3513ifdef INTERNAL_KERNEL_CMDLINE
3429 $(hide) echo "$(INTERNAL_KERNEL_CMDLINE)" > $(zip_root)/$(PRIVATE_RECOVERY_OUT)/cmdline 3514 $(hide) echo "$(INTERNAL_KERNEL_CMDLINE)" > $(zip_root)/$(PRIVATE_RECOVERY_OUT)/cmdline
3430endif 3515endif
@@ -3528,6 +3613,9 @@ endif
3528ifdef BOARD_INCLUDE_RECOVERY_DTBO 3613ifdef BOARD_INCLUDE_RECOVERY_DTBO
3529 $(hide) echo "include_recovery_dtbo=true" >> $(zip_root)/META/misc_info.txt 3614 $(hide) echo "include_recovery_dtbo=true" >> $(zip_root)/META/misc_info.txt
3530endif 3615endif
3616ifdef BOARD_INCLUDE_RECOVERY_ACPIO
3617 $(hide) echo "include_recovery_acpio=true" >> $(zip_root)/META/misc_info.txt
3618endif
3531ifdef BOARD_RECOVERYIMAGE_PARTITION_SIZE 3619ifdef BOARD_RECOVERYIMAGE_PARTITION_SIZE
3532 $(hide) echo "recovery_size=$(BOARD_RECOVERYIMAGE_PARTITION_SIZE)" >> $(zip_root)/META/misc_info.txt 3620 $(hide) echo "recovery_size=$(BOARD_RECOVERYIMAGE_PARTITION_SIZE)" >> $(zip_root)/META/misc_info.txt
3533endif 3621endif
@@ -3727,12 +3815,16 @@ ifdef BUILT_VENDOR_MATRIX
3727endif 3815endif
3728ifneq ($(BOARD_SUPER_PARTITION_GROUPS),) 3816ifneq ($(BOARD_SUPER_PARTITION_GROUPS),)
3729 $(hide) echo "super_partition_groups=$(BOARD_SUPER_PARTITION_GROUPS)" > $(zip_root)/META/dynamic_partitions_info.txt 3817 $(hide) echo "super_partition_groups=$(BOARD_SUPER_PARTITION_GROUPS)" > $(zip_root)/META/dynamic_partitions_info.txt
3818 @# Remove 'vendor' from the group partition list if the image is not available. This should only
3819 @# happen to AOSP targets built without vendor.img. We can't remove the partition from the
3820 @# BoardConfig file, as it's still needed elsewhere (e.g. when creating super_empty.img).
3730 $(foreach group,$(BOARD_SUPER_PARTITION_GROUPS), \ 3821 $(foreach group,$(BOARD_SUPER_PARTITION_GROUPS), \
3822 $(eval _group_partition_list := $(BOARD_$(call to-upper,$(group))_PARTITION_LIST)) \
3823 $(if $(INSTALLED_VENDORIMAGE_TARGET),,$(eval _group_partition_list := $(filter-out vendor,$(_group_partition_list)))) \
3731 echo "$(group)_size=$(BOARD_$(call to-upper,$(group))_SIZE)" >> $(zip_root)/META/dynamic_partitions_info.txt; \ 3824 echo "$(group)_size=$(BOARD_$(call to-upper,$(group))_SIZE)" >> $(zip_root)/META/dynamic_partitions_info.txt; \
3732 $(if $(BOARD_$(call to-upper,$(group))_PARTITION_LIST), \ 3825 $(if $(_group_partition_list), \
3733 echo "$(group)_partition_list=$(BOARD_$(call to-upper,$(group))_PARTITION_LIST)" >> $(zip_root)/META/dynamic_partitions_info.txt;)) 3826 echo "$(group)_partition_list=$(_group_partition_list)" >> $(zip_root)/META/dynamic_partitions_info.txt;))
3734endif 3827endif # BOARD_SUPER_PARTITION_GROUPS
3735
3736 $(hide) PATH=$(foreach p,$(INTERNAL_USERIMAGES_BINARY_PATHS),$(p):)$$PATH MKBOOTIMG=$(MKBOOTIMG) \ 3828 $(hide) PATH=$(foreach p,$(INTERNAL_USERIMAGES_BINARY_PATHS),$(p):)$$PATH MKBOOTIMG=$(MKBOOTIMG) \
3737 build/make/tools/releasetools/add_img_to_target_files -a -v -p $(HOST_OUT) $(zip_root) 3829 build/make/tools/releasetools/add_img_to_target_files -a -v -p $(HOST_OUT) $(zip_root)
3738 @# Zip everything up, preserving symlinks and placing META/ files first to 3830 @# Zip everything up, preserving symlinks and placing META/ files first to
@@ -3798,7 +3890,7 @@ $(INTERNAL_OTA_PACKAGE_TARGET): $(BUILT_TARGET_FILES_PACKAGE) \
3798.PHONY: otapackage 3890.PHONY: otapackage
3799otapackage: $(INTERNAL_OTA_PACKAGE_TARGET) 3891otapackage: $(INTERNAL_OTA_PACKAGE_TARGET)
3800 3892
3801ifeq ($(PRODUCT_RETROFIT_DYNAMIC_PARTITIONS),true) 3893ifeq ($(BOARD_BUILD_RETROFIT_DYNAMIC_PARTITIONS_OTA_PACKAGE),true)
3802name := $(TARGET_PRODUCT) 3894name := $(TARGET_PRODUCT)
3803ifeq ($(TARGET_BUILD_TYPE),debug) 3895ifeq ($(TARGET_BUILD_TYPE),debug)
3804 name := $(name)_debug 3896 name := $(name)_debug
@@ -3824,7 +3916,7 @@ $(INTERNAL_OTA_RETROFIT_DYNAMIC_PARTITIONS_PACKAGE_TARGET): $(BUILT_TARGET_FILES
3824 3916
3825otapackage otardppackage: $(INTERNAL_OTA_RETROFIT_DYNAMIC_PARTITIONS_PACKAGE_TARGET) 3917otapackage otardppackage: $(INTERNAL_OTA_RETROFIT_DYNAMIC_PARTITIONS_PACKAGE_TARGET)
3826 3918
3827endif # PRODUCT_RETROFIT_DYNAMIC_PARTITIONS 3919endif # BOARD_BUILD_RETROFIT_DYNAMIC_PARTITIONS_OTA_PACKAGE
3828 3920
3829endif # build_ota_package 3921endif # build_ota_package
3830 3922
@@ -4005,7 +4097,8 @@ INSTALLED_SUPERIMAGE_TARGET := $(PRODUCT_OUT)/super.img
4005$(INSTALLED_SUPERIMAGE_TARGET): extracted_input_target_files := $(patsubst %.zip,%,$(BUILT_TARGET_FILES_PACKAGE)) 4097$(INSTALLED_SUPERIMAGE_TARGET): extracted_input_target_files := $(patsubst %.zip,%,$(BUILT_TARGET_FILES_PACKAGE))
4006$(INSTALLED_SUPERIMAGE_TARGET): $(LPMAKE) $(BUILT_TARGET_FILES_PACKAGE) $(BUILD_SUPER_IMAGE) 4098$(INSTALLED_SUPERIMAGE_TARGET): $(LPMAKE) $(BUILT_TARGET_FILES_PACKAGE) $(BUILD_SUPER_IMAGE)
4007 $(call pretty,"Target super fs image: $@") 4099 $(call pretty,"Target super fs image: $@")
4008 $(BUILD_SUPER_IMAGE) -v $(extracted_input_target_files) $@ 4100 PATH=$(dir $(LPMAKE)):$$PATH \
4101 $(BUILD_SUPER_IMAGE) -v $(extracted_input_target_files) $@
4009endif 4102endif
4010 4103
4011$(call dist-for-goals,dist_files,$(INSTALLED_SUPERIMAGE_TARGET)) 4104$(call dist-for-goals,dist_files,$(INSTALLED_SUPERIMAGE_TARGET))
@@ -4018,9 +4111,10 @@ $(INSTALLED_SUPERIMAGE_EMPTY_TARGET): $(LPMAKE) $(BUILD_SUPER_IMAGE)
4018 rm -rf $(intermediates)/misc_info.txt 4111 rm -rf $(intermediates)/misc_info.txt
4019 $(call dump-dynamic-partitions-info,$(intermediates)/misc_info.txt) 4112 $(call dump-dynamic-partitions-info,$(intermediates)/misc_info.txt)
4020ifeq ($(AB_OTA_UPDATER),true) 4113ifeq ($(AB_OTA_UPDATER),true)
4021 $(hide) echo "ab_update=true" >> $(intermediates)/misc_info.txt 4114 echo "ab_update=true" >> $(intermediates)/misc_info.txt
4022endif 4115endif
4023 $(BUILD_SUPER_IMAGE) -v $(intermediates)/misc_info.txt $@ 4116 PATH=$(dir $(LPMAKE)):$$PATH \
4117 $(BUILD_SUPER_IMAGE) -v $(intermediates)/misc_info.txt $@
4024 4118
4025$(call dist-for-goals,dist_files,$(INSTALLED_SUPERIMAGE_EMPTY_TARGET)) 4119$(call dist-for-goals,dist_files,$(INSTALLED_SUPERIMAGE_EMPTY_TARGET))
4026 4120
@@ -4042,7 +4136,7 @@ $(INSTALLED_QEMU_SYSTEMIMAGE): $(INSTALLED_SYSTEMIMAGE_TARGET) $(MK_QEMU_IMAGE_S
4042 4136
4043systemimage: $(INSTALLED_QEMU_SYSTEMIMAGE) 4137systemimage: $(INSTALLED_QEMU_SYSTEMIMAGE)
4044droidcore: $(INSTALLED_QEMU_SYSTEMIMAGE) 4138droidcore: $(INSTALLED_QEMU_SYSTEMIMAGE)
4045ifeq ($(BOARD_USES_VENDORIMAGE),true) 4139ifdef INSTALLED_VENDORIMAGE_TARGET
4046INSTALLED_QEMU_VENDORIMAGE := $(PRODUCT_OUT)/vendor-qemu.img 4140INSTALLED_QEMU_VENDORIMAGE := $(PRODUCT_OUT)/vendor-qemu.img
4047$(INSTALLED_QEMU_VENDORIMAGE): $(INSTALLED_VENDORIMAGE_TARGET) $(MK_QEMU_IMAGE_SH) $(SGDISK_HOST) $(SIMG2IMG) 4141$(INSTALLED_QEMU_VENDORIMAGE): $(INSTALLED_VENDORIMAGE_TARGET) $(MK_QEMU_IMAGE_SH) $(SGDISK_HOST) $(SIMG2IMG)
4048 @echo Create vendor-qemu.img 4142 @echo Create vendor-qemu.img
@@ -4051,7 +4145,7 @@ $(INSTALLED_QEMU_VENDORIMAGE): $(INSTALLED_VENDORIMAGE_TARGET) $(MK_QEMU_IMAGE_S
4051vendorimage: $(INSTALLED_QEMU_VENDORIMAGE) 4145vendorimage: $(INSTALLED_QEMU_VENDORIMAGE)
4052droidcore: $(INSTALLED_QEMU_VENDORIMAGE) 4146droidcore: $(INSTALLED_QEMU_VENDORIMAGE)
4053endif 4147endif
4054ifeq ($(BOARD_USES_PRODUCTIMAGE),true) 4148ifdef INSTALLED_PRODUCTIMAGE_TARGET
4055INSTALLED_QEMU_PRODUCTIMAGE := $(PRODUCT_OUT)/product-qemu.img 4149INSTALLED_QEMU_PRODUCTIMAGE := $(PRODUCT_OUT)/product-qemu.img
4056$(INSTALLED_QEMU_PRODUCTIMAGE): $(INSTALLED_PRODUCTIMAGE_TARGET) $(MK_QEMU_IMAGE_SH) $(SGDISK_HOST) $(SIMG2IMG) 4150$(INSTALLED_QEMU_PRODUCTIMAGE): $(INSTALLED_PRODUCTIMAGE_TARGET) $(MK_QEMU_IMAGE_SH) $(SGDISK_HOST) $(SIMG2IMG)
4057 @echo Create product-qemu.img 4151 @echo Create product-qemu.img
@@ -4060,7 +4154,7 @@ $(INSTALLED_QEMU_PRODUCTIMAGE): $(INSTALLED_PRODUCTIMAGE_TARGET) $(MK_QEMU_IMAGE
4060productimage: $(INSTALLED_QEMU_PRODUCTIMAGE) 4154productimage: $(INSTALLED_QEMU_PRODUCTIMAGE)
4061droidcore: $(INSTALLED_QEMU_PRODUCTIMAGE) 4155droidcore: $(INSTALLED_QEMU_PRODUCTIMAGE)
4062endif 4156endif
4063ifeq ($(BOARD_USES_PRODUCT_SERVICESIMAGE),true) 4157ifdef INSTALLED_PRODUCT_SERVICESIMAGE_TARGET
4064INSTALLED_QEMU_PRODUCT_SERVICESIMAGE := $(PRODUCT_OUT)/product_services-qemu.img 4158INSTALLED_QEMU_PRODUCT_SERVICESIMAGE := $(PRODUCT_OUT)/product_services-qemu.img
4065$(INSTALLED_QEMU_PRODUCT_SERVICESIMAGE): $(INSTALLED_PRODUCT_SERVICESIMAGE_TARGET) $(MK_QEMU_IMAGE_SH) $(SGDISK_HOST) $(SIMG2IMG) 4159$(INSTALLED_QEMU_PRODUCT_SERVICESIMAGE): $(INSTALLED_PRODUCT_SERVICESIMAGE_TARGET) $(MK_QEMU_IMAGE_SH) $(SGDISK_HOST) $(SIMG2IMG)
4066 @echo Create product_services-qemu.img 4160 @echo Create product_services-qemu.img
@@ -4069,7 +4163,7 @@ $(INSTALLED_QEMU_PRODUCT_SERVICESIMAGE): $(INSTALLED_PRODUCT_SERVICESIMAGE_TARGE
4069productservicesimage: $(INSTALLED_QEMU_PRODUCT_SERVICESIMAGE) 4163productservicesimage: $(INSTALLED_QEMU_PRODUCT_SERVICESIMAGE)
4070droidcore: $(INSTALLED_QEMU_PRODUCT_SERVICESIMAGE) 4164droidcore: $(INSTALLED_QEMU_PRODUCT_SERVICESIMAGE)
4071endif 4165endif
4072ifeq ($(BOARD_USES_ODMIMAGE),true) 4166ifdef INSTALLED_ODMIMAGE_TARGET
4073INSTALLED_QEMU_ODMIMAGE := $(PRODUCT_OUT)/odm-qemu.img 4167INSTALLED_QEMU_ODMIMAGE := $(PRODUCT_OUT)/odm-qemu.img
4074$(INSTALLED_QEMU_ODMIMAGE): $(INSTALLED_ODMIMAGE_TARGET) $(MK_QEMU_IMAGE_SH) $(SGDISK_HOST) 4168$(INSTALLED_QEMU_ODMIMAGE): $(INSTALLED_ODMIMAGE_TARGET) $(MK_QEMU_IMAGE_SH) $(SGDISK_HOST)
4075 @echo Create odm-qemu.img 4169 @echo Create odm-qemu.img
diff --git a/core/OWNERS b/core/OWNERS
index 570ede8a4..750f1fa20 100644
--- a/core/OWNERS
+++ b/core/OWNERS
@@ -1 +1,3 @@
1per-file dex_preopt*.mk = ngeoffray@google.com,calin@google.com,mathewi@google.com,dbrazdil@google.com 1per-file dex_preopt*.mk = ngeoffray@google.com,calin@google.com,mathewi@google.com,dbrazdil@google.com
2per-file construct_context.sh = ngeoffray@google.com,calin@google.com,mathieuc@google.com
3per-file verify_uses_libraries.sh = ngeoffray@google.com,calin@google.com,mathieuc@google.com
diff --git a/core/android_manifest.mk b/core/android_manifest.mk
index c3af942f9..ed759c5ad 100644
--- a/core/android_manifest.mk
+++ b/core/android_manifest.mk
@@ -72,8 +72,8 @@ ifeq ($(LOCAL_PRIVATE_PLATFORM_APIS),true)
72 my_manifest_fixer_flags += --uses-non-sdk-api 72 my_manifest_fixer_flags += --uses-non-sdk-api
73endif 73endif
74 74
75ifeq (true,$(LOCAL_PREFER_INTEGRITY)) 75ifeq (true,$(LOCAL_PREFER_CODE_INTEGRITY))
76 my_manifest_fixer_flags += --prefer-integrity 76 my_manifest_fixer_flags += --prefer-code-integrity
77endif 77endif
78 78
79$(fixed_android_manifest): PRIVATE_MANIFEST_FIXER_FLAGS := $(my_manifest_fixer_flags) 79$(fixed_android_manifest): PRIVATE_MANIFEST_FIXER_FLAGS := $(my_manifest_fixer_flags)
diff --git a/core/app_certificate_validate.mk b/core/app_certificate_validate.mk
new file mode 100644
index 000000000..15ddd9450
--- /dev/null
+++ b/core/app_certificate_validate.mk
@@ -0,0 +1,12 @@
1
2ifeq (true,$(filter true, \
3 $(LOCAL_PRODUCT_MODULE) $(LOCAL_PRODUCT_SERVICES_MODULE) \
4 $(LOCAL_VENDOR_MODULE) $(LOCAL_PROPRIETARY_MODULE)))
5 ifneq (,$(filter $(dir $(DEFAULT_SYSTEM_DEV_CERTIFICATE))%,$(LOCAL_CERTIFICATE)))
6 CERTIFICATE_VIOLATION_MODULES += $(LOCAL_MODULE)
7 ifeq (true,$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_ENFORCE_ARTIFACT_SYSTEM_CERTIFICATE_REQUIREMENT))
8 $(if $(filter $(LOCAL_MODULE),$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_ARTIFACT_SYSTEM_CERTIFICATE_REQUIREMENT_WHITELIST)),,\
9 $(call pretty-error,The module in product partition cannot be signed with certificate in system.))
10 endif
11 endif
12endif \ No newline at end of file
diff --git a/core/binary.mk b/core/binary.mk
index 427f6894e..be10c2d37 100644
--- a/core/binary.mk
+++ b/core/binary.mk
@@ -72,6 +72,9 @@ endif
72else 72else
73 my_native_coverage := false 73 my_native_coverage := false
74endif 74endif
75ifneq ($(NATIVE_COVERAGE),true)
76 my_native_coverage := false
77endif
75 78
76ifeq ($(strip $(ENABLE_XOM)),true) 79ifeq ($(strip $(ENABLE_XOM)),true)
77 ifndef LOCAL_IS_HOST_MODULE 80 ifndef LOCAL_IS_HOST_MODULE
@@ -470,144 +473,6 @@ endif
470my_asflags += -D__ASSEMBLY__ 473my_asflags += -D__ASSEMBLY__
471 474
472########################################################### 475###########################################################
473## Define PRIVATE_ variables from global vars
474###########################################################
475ifndef LOCAL_IS_HOST_MODULE
476ifdef LOCAL_USE_VNDK
477my_target_global_c_includes := \
478 $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)PROJECT_INCLUDES)
479my_target_global_c_system_includes := \
480 $(TARGET_OUT_HEADERS) \
481 $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)PROJECT_SYSTEM_INCLUDES)
482else ifdef LOCAL_SDK_VERSION
483my_target_global_c_includes :=
484my_target_global_c_system_includes := $(my_ndk_stl_include_path) $(my_ndk_sysroot_include)
485else ifdef BOARD_VNDK_VERSION
486my_target_global_c_includes := $(SRC_HEADERS) \
487 $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)PROJECT_INCLUDES) \
488 $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)C_INCLUDES)
489my_target_global_c_system_includes := $(SRC_SYSTEM_HEADERS) \
490 $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)PROJECT_SYSTEM_INCLUDES) \
491 $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)C_SYSTEM_INCLUDES)
492else
493my_target_global_c_includes := $(SRC_HEADERS) \
494 $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)PROJECT_INCLUDES) \
495 $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)C_INCLUDES)
496my_target_global_c_system_includes := $(SRC_SYSTEM_HEADERS) $(TARGET_OUT_HEADERS) \
497 $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)PROJECT_SYSTEM_INCLUDES) \
498 $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)C_SYSTEM_INCLUDES)
499endif
500
501my_target_global_cflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)CLANG_$(my_prefix)GLOBAL_CFLAGS)
502my_target_global_conlyflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)CLANG_$(my_prefix)GLOBAL_CONLYFLAGS) $(my_c_std_conlyflags)
503my_target_global_cppflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)CLANG_$(my_prefix)GLOBAL_CPPFLAGS) $(my_cpp_std_cppflags)
504ifeq ($(my_use_clang_lld),true)
505 my_target_global_ldflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)CLANG_$(my_prefix)GLOBAL_LLDFLAGS)
506 include $(BUILD_SYSTEM)/pack_dyn_relocs_setup.mk
507 ifeq ($(my_pack_module_relocations),false)
508 my_target_global_ldflags += -Wl,--pack-dyn-relocs=none
509 endif
510else
511 my_target_global_ldflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)CLANG_$(my_prefix)GLOBAL_LDFLAGS)
512endif # my_use_clang_lld
513
514$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_GLOBAL_C_INCLUDES := $(my_target_global_c_includes)
515$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_GLOBAL_C_SYSTEM_INCLUDES := $(my_target_global_c_system_includes)
516$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_TARGET_GLOBAL_CFLAGS := $(my_target_global_cflags)
517$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_TARGET_GLOBAL_CONLYFLAGS := $(my_target_global_conlyflags)
518$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_TARGET_GLOBAL_CPPFLAGS := $(my_target_global_cppflags)
519$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_TARGET_GLOBAL_LDFLAGS := $(my_target_global_ldflags)
520
521else # LOCAL_IS_HOST_MODULE
522
523my_host_global_c_includes := $(SRC_HEADERS) \
524 $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)C_INCLUDES)
525my_host_global_c_system_includes := $(SRC_SYSTEM_HEADERS) \
526 $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)C_SYSTEM_INCLUDES)
527
528my_host_global_cflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)CLANG_$(my_prefix)GLOBAL_CFLAGS)
529my_host_global_conlyflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)CLANG_$(my_prefix)GLOBAL_CONLYFLAGS) $(my_c_std_conlyflags)
530my_host_global_cppflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)CLANG_$(my_prefix)GLOBAL_CPPFLAGS) $(my_cpp_std_cppflags)
531ifeq ($(my_use_clang_lld),true)
532 my_host_global_ldflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)CLANG_$(my_prefix)GLOBAL_LLDFLAGS)
533else
534 my_host_global_ldflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)CLANG_$(my_prefix)GLOBAL_LDFLAGS)
535endif # my_use_clang_lld
536
537$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_GLOBAL_C_INCLUDES := $(my_host_global_c_includes)
538$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_GLOBAL_C_SYSTEM_INCLUDES := $(my_host_global_c_system_includes)
539$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_HOST_GLOBAL_CFLAGS := $(my_host_global_cflags)
540$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_HOST_GLOBAL_CONLYFLAGS := $(my_host_global_conlyflags)
541$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_HOST_GLOBAL_CPPFLAGS := $(my_host_global_cppflags)
542$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_HOST_GLOBAL_LDFLAGS := $(my_host_global_ldflags)
543endif # LOCAL_IS_HOST_MODULE
544
545# To enable coverage for a given module, set LOCAL_NATIVE_COVERAGE=true and
546# build with NATIVE_COVERAGE=true in your enviornment. Note that the build
547# system is not sensitive to changes to NATIVE_COVERAGE, so you should do a
548# clean build of your module after toggling it.
549ifeq ($(NATIVE_COVERAGE),true)
550 ifeq ($(my_native_coverage),true)
551 # Note that clang coverage doesn't play nicely with acov out of the box.
552 # Clang apparently generates .gcno files that aren't compatible with
553 # gcov-4.8. This can be solved by installing gcc-4.6 and invoking lcov
554 # with `--gcov-tool /usr/bin/gcov-4.6`.
555 #
556 # http://stackoverflow.com/questions/17758126/clang-code-coverage-invalid-output
557 my_cflags += --coverage -O0
558 my_ldflags += --coverage
559 endif
560
561 my_coverage_lib := $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)LIBPROFILE_RT)
562
563 $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_TARGET_COVERAGE_LIB := $(my_coverage_lib)
564 $(LOCAL_INTERMEDIATE_TARGETS): $(my_coverage_lib)
565else
566 my_native_coverage := false
567endif
568
569###########################################################
570## Define PRIVATE_ variables used by multiple module types
571###########################################################
572$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_NO_DEFAULT_COMPILER_FLAGS := \
573 $(strip $(LOCAL_NO_DEFAULT_COMPILER_FLAGS))
574
575ifeq ($(strip $(WITH_STATIC_ANALYZER)),)
576 LOCAL_NO_STATIC_ANALYZER := true
577endif
578
579ifneq ($(strip $(LOCAL_IS_HOST_MODULE)),)
580 my_syntax_arch := host
581else
582 my_syntax_arch := $($(my_prefix)$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)
583endif
584
585ifeq ($(strip $(my_cc)),)
586 my_cc := $(my_cc_wrapper) $(CLANG)
587endif
588
589SYNTAX_TOOLS_PREFIX := \
590 $(LLVM_PREBUILTS_BASE)/$(BUILD_OS)-x86/$(LLVM_PREBUILTS_VERSION)/libexec
591
592ifneq ($(LOCAL_NO_STATIC_ANALYZER),true)
593 my_cc := CCC_CC=$(CLANG) CLANG=$(CLANG) \
594 $(SYNTAX_TOOLS_PREFIX)/ccc-analyzer
595endif
596
597$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_CC := $(my_cc)
598
599ifeq ($(strip $(my_cxx)),)
600 my_cxx := $(my_cxx_wrapper) $(CLANG_CXX)
601endif
602
603ifneq ($(LOCAL_NO_STATIC_ANALYZER),true)
604 my_cxx := CCC_CXX=$(CLANG_CXX) CLANG_CXX=$(CLANG_CXX) \
605 $(SYNTAX_TOOLS_PREFIX)/c++-analyzer
606endif
607
608$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_LINKER := $(my_linker)
609$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_CXX := $(my_cxx)
610
611# TODO: support a mix of standard extensions so that this isn't necessary 476# TODO: support a mix of standard extensions so that this isn't necessary
612LOCAL_CPP_EXTENSION := $(strip $(LOCAL_CPP_EXTENSION)) 477LOCAL_CPP_EXTENSION := $(strip $(LOCAL_CPP_EXTENSION))
613ifeq ($(LOCAL_CPP_EXTENSION),) 478ifeq ($(LOCAL_CPP_EXTENSION),)
@@ -913,8 +778,6 @@ vts_gen_include_root := $(intermediates)/vts-generated/include
913# Thus we'll actually generate source for each architecture. 778# Thus we'll actually generate source for each architecture.
914$(foreach s,$(vts_src),\ 779$(foreach s,$(vts_src),\
915 $(eval $(call define-vts-cpp-rule,$(s),$(vts_gen_cpp_root),vts_gen_cpp))) 780 $(eval $(call define-vts-cpp-rule,$(s),$(vts_gen_cpp_root),vts_gen_cpp)))
916$(foreach cpp,$(vts_gen_cpp), \
917 $(call include-depfile,$(addsuffix .vts.P,$(basename $(cpp))),$(cpp)))
918$(call track-src-file-gen,$(vts_src),$(vts_gen_cpp)) 781$(call track-src-file-gen,$(vts_src),$(vts_gen_cpp))
919 782
920$(vts_gen_cpp) : PRIVATE_MODULE := $(LOCAL_MODULE) 783$(vts_gen_cpp) : PRIVATE_MODULE := $(LOCAL_MODULE)
@@ -1445,6 +1308,8 @@ normal_objects += $(addprefix $(TOPDIR)$(LOCAL_PATH)/,$(LOCAL_PREBUILT_OBJ_FILES
1445 1308
1446all_objects := $(normal_objects) $(gen_o_objects) 1309all_objects := $(normal_objects) $(gen_o_objects)
1447 1310
1311LOCAL_INTERMEDIATE_TARGETS += $(all_objects)
1312
1448# Cleanup file tracking 1313# Cleanup file tracking
1449$(foreach f,$(my_tracked_gen_files),$(eval my_src_file_gen_$(s):=)) 1314$(foreach f,$(my_tracked_gen_files),$(eval my_src_file_gen_$(s):=))
1450my_tracked_gen_files := 1315my_tracked_gen_files :=
@@ -1571,6 +1436,9 @@ endif
1571$(notice_target): | $(installed_static_library_notice_file_targets) 1436$(notice_target): | $(installed_static_library_notice_file_targets)
1572$(LOCAL_INSTALLED_MODULE): | $(notice_target) 1437$(LOCAL_INSTALLED_MODULE): | $(notice_target)
1573 1438
1439$(notice_target): | $(installed_static_library_notice_file_targets)
1440$(LOCAL_INSTALLED_MODULE): | $(notice_target)
1441
1574# Default is -fno-rtti. 1442# Default is -fno-rtti.
1575ifeq ($(strip $(LOCAL_RTTI_FLAG)),) 1443ifeq ($(strip $(LOCAL_RTTI_FLAG)),)
1576LOCAL_RTTI_FLAG := -fno-rtti 1444LOCAL_RTTI_FLAG := -fno-rtti
@@ -1735,6 +1603,141 @@ endif
1735# (start-group/end-group), so append after the check above. 1603# (start-group/end-group), so append after the check above.
1736my_ldlibs += $(my_cxx_ldlibs) 1604my_ldlibs += $(my_cxx_ldlibs)
1737 1605
1606###########################################################
1607## Define PRIVATE_ variables from global vars
1608###########################################################
1609ifndef LOCAL_IS_HOST_MODULE
1610ifdef LOCAL_USE_VNDK
1611my_target_global_c_includes := \
1612 $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)PROJECT_INCLUDES)
1613my_target_global_c_system_includes := \
1614 $(TARGET_OUT_HEADERS) \
1615 $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)PROJECT_SYSTEM_INCLUDES)
1616else ifdef LOCAL_SDK_VERSION
1617my_target_global_c_includes :=
1618my_target_global_c_system_includes := $(my_ndk_stl_include_path) $(my_ndk_sysroot_include)
1619else ifdef BOARD_VNDK_VERSION
1620my_target_global_c_includes := $(SRC_HEADERS) \
1621 $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)PROJECT_INCLUDES) \
1622 $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)C_INCLUDES)
1623my_target_global_c_system_includes := $(SRC_SYSTEM_HEADERS) \
1624 $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)PROJECT_SYSTEM_INCLUDES) \
1625 $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)C_SYSTEM_INCLUDES)
1626else
1627my_target_global_c_includes := $(SRC_HEADERS) \
1628 $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)PROJECT_INCLUDES) \
1629 $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)C_INCLUDES)
1630my_target_global_c_system_includes := $(SRC_SYSTEM_HEADERS) $(TARGET_OUT_HEADERS) \
1631 $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)PROJECT_SYSTEM_INCLUDES) \
1632 $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)C_SYSTEM_INCLUDES)
1633endif
1634
1635my_target_global_cflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)CLANG_$(my_prefix)GLOBAL_CFLAGS)
1636my_target_global_conlyflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)CLANG_$(my_prefix)GLOBAL_CONLYFLAGS) $(my_c_std_conlyflags)
1637my_target_global_cppflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)CLANG_$(my_prefix)GLOBAL_CPPFLAGS) $(my_cpp_std_cppflags)
1638ifeq ($(my_use_clang_lld),true)
1639 my_target_global_ldflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)CLANG_$(my_prefix)GLOBAL_LLDFLAGS)
1640 include $(BUILD_SYSTEM)/pack_dyn_relocs_setup.mk
1641 ifeq ($(my_pack_module_relocations),false)
1642 my_target_global_ldflags += -Wl,--pack-dyn-relocs=none
1643 endif
1644else
1645 my_target_global_ldflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)CLANG_$(my_prefix)GLOBAL_LDFLAGS)
1646endif # my_use_clang_lld
1647
1648$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_GLOBAL_C_INCLUDES := $(my_target_global_c_includes)
1649$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_GLOBAL_C_SYSTEM_INCLUDES := $(my_target_global_c_system_includes)
1650$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_TARGET_GLOBAL_CFLAGS := $(my_target_global_cflags)
1651$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_TARGET_GLOBAL_CONLYFLAGS := $(my_target_global_conlyflags)
1652$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_TARGET_GLOBAL_CPPFLAGS := $(my_target_global_cppflags)
1653$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_TARGET_GLOBAL_LDFLAGS := $(my_target_global_ldflags)
1654
1655else # LOCAL_IS_HOST_MODULE
1656
1657my_host_global_c_includes := $(SRC_HEADERS) \
1658 $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)C_INCLUDES)
1659my_host_global_c_system_includes := $(SRC_SYSTEM_HEADERS) \
1660 $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)C_SYSTEM_INCLUDES)
1661
1662my_host_global_cflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)CLANG_$(my_prefix)GLOBAL_CFLAGS)
1663my_host_global_conlyflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)CLANG_$(my_prefix)GLOBAL_CONLYFLAGS) $(my_c_std_conlyflags)
1664my_host_global_cppflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)CLANG_$(my_prefix)GLOBAL_CPPFLAGS) $(my_cpp_std_cppflags)
1665ifeq ($(my_use_clang_lld),true)
1666 my_host_global_ldflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)CLANG_$(my_prefix)GLOBAL_LLDFLAGS)
1667else
1668 my_host_global_ldflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)CLANG_$(my_prefix)GLOBAL_LDFLAGS)
1669endif # my_use_clang_lld
1670
1671$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_GLOBAL_C_INCLUDES := $(my_host_global_c_includes)
1672$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_GLOBAL_C_SYSTEM_INCLUDES := $(my_host_global_c_system_includes)
1673$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_HOST_GLOBAL_CFLAGS := $(my_host_global_cflags)
1674$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_HOST_GLOBAL_CONLYFLAGS := $(my_host_global_conlyflags)
1675$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_HOST_GLOBAL_CPPFLAGS := $(my_host_global_cppflags)
1676$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_HOST_GLOBAL_LDFLAGS := $(my_host_global_ldflags)
1677endif # LOCAL_IS_HOST_MODULE
1678
1679# To enable coverage for a given module, set LOCAL_NATIVE_COVERAGE=true and
1680# build with NATIVE_COVERAGE=true in your enviornment.
1681ifeq ($(NATIVE_COVERAGE),true)
1682 ifeq ($(my_native_coverage),true)
1683 # Note that clang coverage doesn't play nicely with acov out of the box.
1684 # Clang apparently generates .gcno files that aren't compatible with
1685 # gcov-4.8. This can be solved by installing gcc-4.6 and invoking lcov
1686 # with `--gcov-tool /usr/bin/gcov-4.6`.
1687 #
1688 # http://stackoverflow.com/questions/17758126/clang-code-coverage-invalid-output
1689 my_cflags += --coverage -O0
1690 my_ldflags += --coverage
1691 endif
1692
1693 my_coverage_lib := $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)LIBPROFILE_RT)
1694
1695 $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_TARGET_COVERAGE_LIB := $(my_coverage_lib)
1696 $(LOCAL_INTERMEDIATE_TARGETS): $(my_coverage_lib)
1697endif
1698
1699###########################################################
1700## Define PRIVATE_ variables used by multiple module types
1701###########################################################
1702$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_NO_DEFAULT_COMPILER_FLAGS := \
1703 $(strip $(LOCAL_NO_DEFAULT_COMPILER_FLAGS))
1704
1705ifeq ($(strip $(WITH_STATIC_ANALYZER)),)
1706 LOCAL_NO_STATIC_ANALYZER := true
1707endif
1708
1709ifneq ($(strip $(LOCAL_IS_HOST_MODULE)),)
1710 my_syntax_arch := host
1711else
1712 my_syntax_arch := $($(my_prefix)$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)
1713endif
1714
1715ifeq ($(strip $(my_cc)),)
1716 my_cc := $(my_cc_wrapper) $(CLANG)
1717endif
1718
1719SYNTAX_TOOLS_PREFIX := \
1720 $(LLVM_PREBUILTS_BASE)/$(BUILD_OS)-x86/$(LLVM_PREBUILTS_VERSION)/libexec
1721
1722ifneq ($(LOCAL_NO_STATIC_ANALYZER),true)
1723 my_cc := CCC_CC=$(CLANG) CLANG=$(CLANG) \
1724 $(SYNTAX_TOOLS_PREFIX)/ccc-analyzer
1725endif
1726
1727$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_CC := $(my_cc)
1728
1729ifeq ($(strip $(my_cxx)),)
1730 my_cxx := $(my_cxx_wrapper) $(CLANG_CXX)
1731endif
1732
1733ifneq ($(LOCAL_NO_STATIC_ANALYZER),true)
1734 my_cxx := CCC_CXX=$(CLANG_CXX) CLANG_CXX=$(CLANG_CXX) \
1735 $(SYNTAX_TOOLS_PREFIX)/c++-analyzer
1736endif
1737
1738$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_LINKER := $(my_linker)
1739$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_CXX := $(my_cxx)
1740
1738$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_YACCFLAGS := $(LOCAL_YACCFLAGS) 1741$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_YACCFLAGS := $(LOCAL_YACCFLAGS)
1739$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_ASFLAGS := $(my_asflags) 1742$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_ASFLAGS := $(my_asflags)
1740$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_CONLYFLAGS := $(my_conlyflags) 1743$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_CONLYFLAGS := $(my_conlyflags)
diff --git a/core/clear_vars.mk b/core/clear_vars.mk
index 0417e1389..b47071a23 100644
--- a/core/clear_vars.mk
+++ b/core/clear_vars.mk
@@ -51,7 +51,6 @@ LOCAL_CTS_TEST_PACKAGE:=
51LOCAL_CTS_TEST_RUNNER:= 51LOCAL_CTS_TEST_RUNNER:=
52LOCAL_CXX:= 52LOCAL_CXX:=
53LOCAL_CXX_STL := default 53LOCAL_CXX_STL := default
54LOCAL_DATA_BINDING:=
55LOCAL_DEX_PREOPT_APP_IMAGE:= 54LOCAL_DEX_PREOPT_APP_IMAGE:=
56LOCAL_DEX_PREOPT_FLAGS:= 55LOCAL_DEX_PREOPT_FLAGS:=
57LOCAL_DEX_PREOPT_GENERATE_PROFILE:= 56LOCAL_DEX_PREOPT_GENERATE_PROFILE:=
@@ -213,7 +212,7 @@ LOCAL_PREBUILT_MODULE_FILE:=
213LOCAL_PREBUILT_OBJ_FILES:= 212LOCAL_PREBUILT_OBJ_FILES:=
214LOCAL_PREBUILT_STATIC_JAVA_LIBRARIES:= 213LOCAL_PREBUILT_STATIC_JAVA_LIBRARIES:=
215LOCAL_PREBUILT_STRIP_COMMENTS:= 214LOCAL_PREBUILT_STRIP_COMMENTS:=
216LOCAL_PREFER_INTEGRITY:= 215LOCAL_PREFER_CODE_INTEGRITY:=
217LOCAL_PRESUBMIT_DISABLED:= 216LOCAL_PRESUBMIT_DISABLED:=
218LOCAL_PRIVATE_PLATFORM_APIS:= 217LOCAL_PRIVATE_PLATFORM_APIS:=
219LOCAL_PRIVILEGED_MODULE:= 218LOCAL_PRIVILEGED_MODULE:=
@@ -248,6 +247,7 @@ LOCAL_RTTI_FLAG:=
248LOCAL_SANITIZE:= 247LOCAL_SANITIZE:=
249LOCAL_SANITIZE_DIAG:= 248LOCAL_SANITIZE_DIAG:=
250LOCAL_SANITIZE_RECOVER:= 249LOCAL_SANITIZE_RECOVER:=
250LOCAL_SANITIZE_NO_RECOVER:=
251LOCAL_SANITIZE_BLACKLIST := 251LOCAL_SANITIZE_BLACKLIST :=
252LOCAL_SDK_LIBRARIES := 252LOCAL_SDK_LIBRARIES :=
253LOCAL_SDK_RES_VERSION:= 253LOCAL_SDK_RES_VERSION:=
@@ -255,6 +255,7 @@ LOCAL_SDK_VERSION:=
255LOCAL_SHARED_ANDROID_LIBRARIES:= 255LOCAL_SHARED_ANDROID_LIBRARIES:=
256LOCAL_SHARED_LIBRARIES:= 256LOCAL_SHARED_LIBRARIES:=
257LOCAL_SOONG_AAR := 257LOCAL_SOONG_AAR :=
258LOCAL_SOONG_BUILT_INSTALLED :=
258LOCAL_SOONG_BUNDLE := 259LOCAL_SOONG_BUNDLE :=
259LOCAL_SOONG_CLASSES_JAR := 260LOCAL_SOONG_CLASSES_JAR :=
260LOCAL_SOONG_DEX_JAR := 261LOCAL_SOONG_DEX_JAR :=
@@ -277,7 +278,6 @@ LOCAL_STATIC_ANDROID_LIBRARIES:=
277LOCAL_STATIC_JAVA_AAR_LIBRARIES:= 278LOCAL_STATIC_JAVA_AAR_LIBRARIES:=
278LOCAL_STATIC_JAVA_LIBRARIES:= 279LOCAL_STATIC_JAVA_LIBRARIES:=
279LOCAL_STATIC_LIBRARIES:= 280LOCAL_STATIC_LIBRARIES:=
280LOCAL_STRIP_DEX:=
281LOCAL_STRIP_MODULE:= 281LOCAL_STRIP_MODULE:=
282LOCAL_SYSTEM_SHARED_LIBRARIES:=none 282LOCAL_SYSTEM_SHARED_LIBRARIES:=none
283LOCAL_TARGET_REQUIRED_MODULES:= 283LOCAL_TARGET_REQUIRED_MODULES:=
diff --git a/core/config.mk b/core/config.mk
index b7c2ed162..c0a159dce 100644
--- a/core/config.mk
+++ b/core/config.mk
@@ -120,6 +120,8 @@ include $(BUILD_SYSTEM_COMMON)/math.mk
120 120
121include $(BUILD_SYSTEM_COMMON)/strings.mk 121include $(BUILD_SYSTEM_COMMON)/strings.mk
122 122
123include $(BUILD_SYSTEM_COMMON)/json.mk
124
123# Various mappings to avoid hard-coding paths all over the place 125# Various mappings to avoid hard-coding paths all over the place
124include $(BUILD_SYSTEM)/pathmap.mk 126include $(BUILD_SYSTEM)/pathmap.mk
125 127
@@ -567,6 +569,13 @@ ALLOW_MISSING_DEPENDENCIES := true
567endif 569endif
568.KATI_READONLY := ALLOW_MISSING_DEPENDENCIES 570.KATI_READONLY := ALLOW_MISSING_DEPENDENCIES
569 571
572TARGET_BUILD_APPS_USE_PREBUILT_SDK :=
573ifdef TARGET_BUILD_APPS
574 ifndef UNBUNDLED_BUILD_SDKS_FROM_SOURCE
575 TARGET_BUILD_APPS_USE_PREBUILT_SDK := true
576 endif
577endif
578
570prebuilt_sdk_tools := prebuilts/sdk/tools 579prebuilt_sdk_tools := prebuilts/sdk/tools
571prebuilt_sdk_tools_bin := $(prebuilt_sdk_tools)/$(HOST_OS)/bin 580prebuilt_sdk_tools_bin := $(prebuilt_sdk_tools)/$(HOST_OS)/bin
572 581
@@ -678,7 +687,7 @@ AVBTOOL := $(HOST_OUT_EXECUTABLES)/avbtool$(HOST_EXECUTABLE_SUFFIX)
678else 687else
679AVBTOOL := $(BOARD_CUSTOM_AVBTOOL) 688AVBTOOL := $(BOARD_CUSTOM_AVBTOOL)
680endif 689endif
681APICHECK := $(HOST_OUT_EXECUTABLES)/apicheck$(HOST_EXECUTABLE_SUFFIX) 690APICHECK := $(HOST_OUT_JAVA_LIBRARIES)/metalava$(COMMON_JAVA_PACKAGE_SUFFIX)
682FS_GET_STATS := $(HOST_OUT_EXECUTABLES)/fs_get_stats$(HOST_EXECUTABLE_SUFFIX) 691FS_GET_STATS := $(HOST_OUT_EXECUTABLES)/fs_get_stats$(HOST_EXECUTABLE_SUFFIX)
683MAKE_EXT4FS := $(HOST_OUT_EXECUTABLES)/mke2fs$(HOST_EXECUTABLE_SUFFIX) 692MAKE_EXT4FS := $(HOST_OUT_EXECUTABLES)/mke2fs$(HOST_EXECUTABLE_SUFFIX)
684MKEXTUSERIMG := $(HOST_OUT_EXECUTABLES)/mkuserimg_mke2fs 693MKEXTUSERIMG := $(HOST_OUT_EXECUTABLES)/mkuserimg_mke2fs
@@ -746,13 +755,7 @@ else
746MD5SUM:=md5sum 755MD5SUM:=md5sum
747endif 756endif
748 757
749APICHECK_CLASSPATH_ENTRIES := \ 758APICHECK_COMMAND := $(JAVA) -Xmx4g -jar $(APICHECK) --no-banner --compatible-output=yes
750 $(HOST_OUT_JAVA_LIBRARIES)/apicheck$(COMMON_JAVA_PACKAGE_SUFFIX) \
751 $(HOST_JDK_TOOLS_JAR) \
752 )
753APICHECK_CLASSPATH := $(subst $(space),:,$(strip $(APICHECK_CLASSPATH_ENTRIES)))
754
755APICHECK_COMMAND := $(APICHECK) -JXmx1024m -J"classpath $(APICHECK_CLASSPATH)"
756 759
757# Boolean variable determining if the whitelist for compatible properties is enabled 760# Boolean variable determining if the whitelist for compatible properties is enabled
758PRODUCT_COMPATIBLE_PROPERTY := false 761PRODUCT_COMPATIBLE_PROPERTY := false
@@ -1055,31 +1058,52 @@ endif
1055# The metadata device must be supplied to init via the kernel command-line. 1058# The metadata device must be supplied to init via the kernel command-line.
1056BOARD_KERNEL_CMDLINE += androidboot.super_partition=$(BOARD_SUPER_PARTITION_METADATA_DEVICE) 1059BOARD_KERNEL_CMDLINE += androidboot.super_partition=$(BOARD_SUPER_PARTITION_METADATA_DEVICE)
1057 1060
1058else # PRODUCT_RETROFIT_DYNAMIC_PARTITIONS 1061BOARD_BUILD_RETROFIT_DYNAMIC_PARTITIONS_OTA_PACKAGE := true
1059 1062
1060# These should not be specified on devices launching with dynamic partition support. 1063# If "vendor" is listed as one of the dynamic partitions but without its image available (e.g. an
1061ifdef BOARD_SUPER_PARTITION_BLOCK_DEVICES 1064# AOSP target built without vendor image), don't build the retrofit full OTA package. Because we
1062$(error BOARD_SUPER_PARTITION_BLOCK_DEVICES can only be used if PRODUCT_RETROFIT_DYNAMIC_PARTITIONS is true.) 1065# won't be able to build meaningful super_* images for retrofitting purpose.
1063endif 1066ifneq (,$(filter vendor,$(BOARD_SUPER_PARTITION_PARTITION_LIST)))
1064ifdef BOARD_SUPER_PARTITION_METADATA_DEVICE 1067ifndef BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE
1065$(error BOARD_SUPER_PARTITION_METADATA_DEVICE can only be used if PRODUCT_RETROFIT_DYNAMIC_PARTITIONS is true.) 1068ifndef BOARD_PREBUILT_VENDORIMAGE
1066endif 1069BOARD_BUILD_RETROFIT_DYNAMIC_PARTITIONS_OTA_PACKAGE :=
1070endif # BOARD_PREBUILT_VENDORIMAGE
1071endif # BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE
1072endif # BOARD_SUPER_PARTITION_PARTITION_LIST
1073
1074else # PRODUCT_RETROFIT_DYNAMIC_PARTITIONS
1067 1075
1068# For normal devices, we populate BOARD_SUPER_PARTITION_BLOCK_DEVICES so the 1076# For normal devices, we populate BOARD_SUPER_PARTITION_BLOCK_DEVICES so the
1069# build can handle both cases consistently. 1077# build can handle both cases consistently.
1070BOARD_SUPER_PARTITION_BLOCK_DEVICES := super 1078ifeq ($(BOARD_SUPER_PARTITION_METADATA_DEVICE),)
1071BOARD_SUPER_PARTITION_METADATA_DEVICE := super 1079BOARD_SUPER_PARTITION_METADATA_DEVICE := super
1072BOARD_SUPER_PARTITION_SUPER_DEVICE_SIZE := $(BOARD_SUPER_PARTITION_SIZE) 1080endif
1081
1082ifeq ($(BOARD_SUPER_PARTITION_BLOCK_DEVICES),)
1083BOARD_SUPER_PARTITION_BLOCK_DEVICES := $(BOARD_SUPER_PARTITION_METADATA_DEVICE)
1084endif
1085
1086# If only one super block device, default to super partition size.
1087ifeq ($(word 2,$(BOARD_SUPER_PARTITION_BLOCK_DEVICES)),)
1088BOARD_SUPER_PARTITION_$(call to-upper,$(strip $(BOARD_SUPER_PARTITION_BLOCK_DEVICES)))_DEVICE_SIZE ?= \
1089 $(BOARD_SUPER_PARTITION_SIZE)
1090endif
1091
1092ifneq ($(BOARD_SUPER_PARTITION_METADATA_DEVICE),super)
1093BOARD_KERNEL_CMDLINE += androidboot.super_partition=$(BOARD_SUPER_PARTITION_METADATA_DEVICE)
1094endif
1095BOARD_BUILD_RETROFIT_DYNAMIC_PARTITIONS_OTA_PACKAGE :=
1073 1096
1074endif # PRODUCT_RETROFIT_DYNAMIC_PARTITIONS 1097endif # PRODUCT_RETROFIT_DYNAMIC_PARTITIONS
1075endif # BOARD_SUPER_PARTITION_SIZE 1098endif # BOARD_SUPER_PARTITION_SIZE
1076.KATI_READONLY := BOARD_SUPER_PARTITION_BLOCK_DEVICES 1099.KATI_READONLY := BOARD_SUPER_PARTITION_BLOCK_DEVICES
1077.KATI_READONLY := BOARD_SUPER_PARTITION_METADATA_DEVICE 1100.KATI_READONLY := BOARD_SUPER_PARTITION_METADATA_DEVICE
1101.KATI_READONLY := BOARD_BUILD_RETROFIT_DYNAMIC_PARTITIONS_OTA_PACKAGE
1078 1102
1079$(foreach device,$(call to-upper,$(BOARD_SUPER_PARTITION_BLOCK_DEVICES)), \ 1103$(foreach device,$(call to-upper,$(BOARD_SUPER_PARTITION_BLOCK_DEVICES)), \
1080 $(eval BOARD_SUPER_PARTITION_$(device)_DEVICE_SIZE := $(strip $(BOARD_SUPER_PARTITION_$(device)_DEVICE_SIZE))) \ 1104 $(eval BOARD_SUPER_PARTITION_$(device)_DEVICE_SIZE := $(strip $(BOARD_SUPER_PARTITION_$(device)_DEVICE_SIZE))) \
1081 $(if $(BOARD_SUPER_PARTITION_$(device)_DEVICE_SIZE),, \ 1105 $(if $(BOARD_SUPER_PARTITION_$(device)_DEVICE_SIZE),, \
1082 $(error $(BOARD_SUPER_PARTITION_$(device)_DEVICE_SIZE must not be empty))) \ 1106 $(error BOARD_SUPER_PARTITION_$(device)_DEVICE_SIZE must not be empty)) \
1083 $(eval .KATI_READONLY := BOARD_SUPER_PARTITION_$(device)_DEVICE_SIZE)) 1107 $(eval .KATI_READONLY := BOARD_SUPER_PARTITION_$(device)_DEVICE_SIZE))
1084 1108
1085endif # PRODUCT_BUILD_SUPER_PARTITION 1109endif # PRODUCT_BUILD_SUPER_PARTITION
diff --git a/core/config_sanitizers.mk b/core/config_sanitizers.mk
index 7b4015e19..6c9caa86c 100644
--- a/core/config_sanitizers.mk
+++ b/core/config_sanitizers.mk
@@ -337,7 +337,7 @@ ifneq ($(filter address,$(my_global_sanitize) $(my_sanitize)),)
337 my_ldflags += -Wl,--as-needed 337 my_ldflags += -Wl,--as-needed
338 endif 338 endif
339 339
340 ifeq ($(LOCAL_MODULE_CLASS),EXECUTABLES) 340 ifneq ($(filter EXECUTABLES NATIVE_TESTS,$(LOCAL_MODULE_CLASS)),)
341 ifneq ($(LOCAL_FORCE_STATIC_EXECUTABLE),true) 341 ifneq ($(LOCAL_FORCE_STATIC_EXECUTABLE),true)
342 my_linker := $($(LOCAL_2ND_ARCH_VAR_PREFIX)ADDRESS_SANITIZER_LINKER) 342 my_linker := $($(LOCAL_2ND_ARCH_VAR_PREFIX)ADDRESS_SANITIZER_LINKER)
343 # Make sure linker_asan get installed. 343 # Make sure linker_asan get installed.
@@ -401,6 +401,11 @@ ifneq ($(strip $(LOCAL_SANITIZE_RECOVER)),)
401 my_cflags += -fsanitize-recover=$(recover_arg) 401 my_cflags += -fsanitize-recover=$(recover_arg)
402endif 402endif
403 403
404ifneq ($(strip $(LOCAL_SANITIZE_NO_RECOVER)),)
405 no_recover_arg := $(subst $(space),$(comma),$(LOCAL_SANITIZE_NO_RECOVER)),
406 my_cflags += -fno-sanitize-recover=$(no_recover_arg)
407endif
408
404ifneq ($(my_sanitize_diag),) 409ifneq ($(my_sanitize_diag),)
405 # TODO(vishwath): Add diagnostic support for static executables once 410 # TODO(vishwath): Add diagnostic support for static executables once
406 # we switch to clang-4393122 (which adds the static ubsan runtime 411 # we switch to clang-4393122 (which adds the static ubsan runtime
diff --git a/core/construct_context.sh b/core/construct_context.sh
index b4ae51994..399c15d62 100755
--- a/core/construct_context.sh
+++ b/core/construct_context.sh
@@ -16,39 +16,54 @@
16 16
17set -e 17set -e
18 18
19# inputs:
20# $1 is PRIVATE_CONDITIONAL_USES_LIBRARIES_HOST
21# $2 is PRIVATE_CONDITIONAL_USES_LIBRARIES_TARGET
22
23# class_loader_context: library paths on the host
24# stored_class_loader_context_libs: library paths on device
25# these are both comma separated paths, example: lib1.jar:lib2.jar or /system/framework/lib1.jar:/system/framework/lib2.jar
26
27# target_sdk_version: parsed from manifest 19# target_sdk_version: parsed from manifest
28# my_conditional_host_libs: libraries conditionally added for non P
29# my_conditional_target_libs: target libraries conditionally added for non P
30# 20#
31# outputs 21# outputs
32# class_loader_context_arg: final class loader conext arg 22# class_loader_context_arg: final class loader conext arg
33# stored_class_loader_context_arg: final stored class loader context arg 23# stored_class_loader_context_arg: final stored class loader context arg
34 24
35my_conditional_host_libs=$1 25# The hidl.manager shared library has a dependency on hidl.base. We'll manually
36my_conditional_target_libs=$2 26# add that information to the class loader context if we see those libraries.
27hidl_manager="android.hidl.manager-V1.0-java"
28hidl_base="android.hidl.base-V1.0-java"
29
30function add_to_contexts {
31 for i in $1; do
32 if [[ -z "${class_loader_context}" ]]; then
33 export class_loader_context="PCL[$i]"
34 else
35 export class_loader_context+="#PCL[$i]"
36 fi
37 if [[ $i == *"$hidl_manager"* ]]; then
38 export class_loader_context+="{PCL[${i/$hidl_manager/$hidl_base}]}"
39 fi
40 done
41
42 for i in $2; do
43 if [[ -z "${stored_class_loader_context}" ]]; then
44 export stored_class_loader_context="PCL[$i]"
45 else
46 export stored_class_loader_context+="#PCL[$i]"
47 fi
48 if [[ $i == *"$hidl_manager"* ]]; then
49 export stored_class_loader_context+="{PCL[${i/$hidl_manager/$hidl_base}]}"
50 fi
51 done
52}
53
54# The order below must match what the package manager also computes for
55# class loader context.
37 56
38# Note that SDK 28 is P.
39if [[ "${target_sdk_version}" -lt "28" ]]; then 57if [[ "${target_sdk_version}" -lt "28" ]]; then
40 if [[ -z "${class_loader_context}" ]]; then 58 add_to_contexts "${conditional_host_libs_28}" "${conditional_target_libs_28}"
41 export class_loader_context="${my_conditional_host_libs}" 59fi
42 else 60
43 export class_loader_context="${my_conditional_host_libs}:${class_loader_context}" 61if [[ "${target_sdk_version}" -lt "29" ]]; then
44 fi 62 add_to_contexts "${conditional_host_libs_29}" "${conditional_target_libs_29}"
45 if [[ -z "${stored_class_loader_context_libs}" ]]; then
46 export stored_class_loader_context_libs="${my_conditional_target_libs}";
47 else
48 export stored_class_loader_context_libs="${my_conditional_target_libs}:${stored_class_loader_context_libs}";
49 fi
50fi 63fi
51 64
65add_to_contexts "${dex_preopt_host_libraries}" "${dex_preopt_target_libraries}"
66
52# Generate the actual context string. 67# Generate the actual context string.
53export class_loader_context_arg="--class-loader-context=PCL[${class_loader_context}]" 68export class_loader_context_arg="--class-loader-context=PCL[]{${class_loader_context}}"
54export stored_class_loader_context_arg="--stored-class-loader-context=PCL[${stored_class_loader_context_libs}]" 69export stored_class_loader_context_arg="--stored-class-loader-context=PCL[]{${stored_class_loader_context}}"
diff --git a/core/definitions.mk b/core/definitions.mk
index 50c26d3b3..d5c7b9113 100644
--- a/core/definitions.mk
+++ b/core/definitions.mk
@@ -77,6 +77,9 @@ ALL_FINDBUGS_FILES:=
77# GPL module license files 77# GPL module license files
78ALL_GPL_MODULE_LICENSE_FILES:= 78ALL_GPL_MODULE_LICENSE_FILES:=
79 79
80# Packages with certificate violation
81CERTIFICATE_VIOLATION_MODULES :=
82
80# Target and host installed module's dependencies on shared libraries. 83# Target and host installed module's dependencies on shared libraries.
81# They are list of "<module_name>:<installed_file>:lib1,lib2...". 84# They are list of "<module_name>:<installed_file>:lib1,lib2...".
82TARGET_DEPENDENCIES_ON_SHARED_LIBRARIES := 85TARGET_DEPENDENCIES_ON_SHARED_LIBRARIES :=
@@ -1023,7 +1026,7 @@ define transform-vts-to-cpp
1023@mkdir -p $(dir $@) 1026@mkdir -p $(dir $@)
1024@mkdir -p $(PRIVATE_HEADER_OUTPUT_DIR) 1027@mkdir -p $(PRIVATE_HEADER_OUTPUT_DIR)
1025@echo "Generating C++ from VTS: $(PRIVATE_MODULE) <= $<" 1028@echo "Generating C++ from VTS: $(PRIVATE_MODULE) <= $<"
1026$(hide) $(VTSC) -d$(basename $@).vts.P $(PRIVATE_VTS_FLAGS) \ 1029$(hide) $(VTSC) -TODO_b/120496070 $(PRIVATE_VTS_FLAGS) \
1027 $< $(PRIVATE_HEADER_OUTPUT_DIR) $@ 1030 $< $(PRIVATE_HEADER_OUTPUT_DIR) $@
1028endef 1031endef
1029 1032
@@ -2370,7 +2373,7 @@ endef
2370define run-appcompat 2373define run-appcompat
2371$(hide) \ 2374$(hide) \
2372 echo "appcompat.sh output:" >> $(PRODUCT_OUT)/appcompat/$(PRIVATE_MODULE).log && \ 2375 echo "appcompat.sh output:" >> $(PRODUCT_OUT)/appcompat/$(PRIVATE_MODULE).log && \
2373 PACKAGING=$(TARGET_OUT_COMMON_INTERMEDIATES)/PACKAGING art/tools/veridex/appcompat.sh --dex-file=$@ 2>&1 >> $(PRODUCT_OUT)/appcompat/$(PRIVATE_MODULE).log 2376 PACKAGING=$(TARGET_OUT_COMMON_INTERMEDIATES)/PACKAGING ANDROID_LOG_TAGS="*:e" art/tools/veridex/appcompat.sh --dex-file=$@ 2>&1 >> $(PRODUCT_OUT)/appcompat/$(PRIVATE_MODULE).log
2374endef 2377endef
2375appcompat-files = \ 2378appcompat-files = \
2376 art/tools/veridex/appcompat.sh \ 2379 art/tools/veridex/appcompat.sh \
@@ -2704,9 +2707,9 @@ $(3): $(1) $(CLASS2GREYLIST) $(INTERNAL_PLATFORM_HIDDENAPI_PUBLIC_LIST)
2704$(INTERNAL_PLATFORM_HIDDENAPI_FLAGS): $(2) 2707$(INTERNAL_PLATFORM_HIDDENAPI_FLAGS): $(2)
2705$(INTERNAL_PLATFORM_HIDDENAPI_FLAGS): PRIVATE_FLAGS_INPUTS := $$(PRIVATE_FLAGS_INPUTS) $(2) 2708$(INTERNAL_PLATFORM_HIDDENAPI_FLAGS): PRIVATE_FLAGS_INPUTS := $$(PRIVATE_FLAGS_INPUTS) $(2)
2706 2709
2707$(INTERNAL_PLATFORM_HIDDENAPI_GREYLIST_METADATA): $(5) 2710$(INTERNAL_PLATFORM_HIDDENAPI_GREYLIST_METADATA): $(3)
2708$(INTERNAL_PLATFORM_HIDDENAPI_GREYLIST_METADATA): \ 2711$(INTERNAL_PLATFORM_HIDDENAPI_GREYLIST_METADATA): \
2709 PRIVATE_METADATA_INPUTS := $$(PRIVATE_METADATA_INPUTS) $(5) 2712 PRIVATE_METADATA_INPUTS := $$(PRIVATE_METADATA_INPUTS) $(3)
2710 2713
2711endif 2714endif
2712endef 2715endef
@@ -2904,7 +2907,7 @@ endef
2904define check-api 2907define check-api
2905$(TARGET_OUT_COMMON_INTERMEDIATES)/PACKAGING/$(strip $(1))-timestamp: $(2) $(3) $(4) $(APICHECK) $(9) 2908$(TARGET_OUT_COMMON_INTERMEDIATES)/PACKAGING/$(strip $(1))-timestamp: $(2) $(3) $(4) $(APICHECK) $(9)
2906 @echo "Checking API:" $(1) 2909 @echo "Checking API:" $(1)
2907 $(hide) ( $(APICHECK_COMMAND) $(6) $(2) $(3) $(4) $(5) || ( $(7) ; exit 38 ) ) 2910 $(hide) ( $(APICHECK_COMMAND) --check-api-files $(6) $(2) $(3) $(4) $(5) || ( $(7) ; exit 38 ) )
2908 $(hide) mkdir -p $$(dir $$@) 2911 $(hide) mkdir -p $$(dir $$@)
2909 $(hide) touch $$@ 2912 $(hide) touch $$@
2910$(8): $(TARGET_OUT_COMMON_INTERMEDIATES)/PACKAGING/$(strip $(1))-timestamp 2913$(8): $(TARGET_OUT_COMMON_INTERMEDIATES)/PACKAGING/$(strip $(1))-timestamp
diff --git a/core/dex_preopt.mk b/core/dex_preopt.mk
index 92ed9707f..4d7d11cc6 100644
--- a/core/dex_preopt.mk
+++ b/core/dex_preopt.mk
@@ -3,31 +3,7 @@
3# 3#
4#################################### 4####################################
5 5
6# list of boot classpath jars for dexpreopt 6include $(BUILD_SYSTEM)/dex_preopt_config.mk
7DEXPREOPT_BOOT_JARS := $(subst $(space),:,$(PRODUCT_BOOT_JARS))
8DEXPREOPT_BOOT_JARS_MODULES := $(PRODUCT_BOOT_JARS)
9PRODUCT_BOOTCLASSPATH := $(subst $(space),:,$(foreach m,$(DEXPREOPT_BOOT_JARS_MODULES),/system/framework/$(m).jar))
10
11PRODUCT_SYSTEM_SERVER_CLASSPATH := $(subst $(space),:,$(foreach m,$(PRODUCT_SYSTEM_SERVER_JARS),/system/framework/$(m).jar))
12
13DEXPREOPT_BUILD_DIR := $(OUT_DIR)
14DEXPREOPT_PRODUCT_DIR_FULL_PATH := $(PRODUCT_OUT)/dex_bootjars
15DEXPREOPT_PRODUCT_DIR := $(patsubst $(DEXPREOPT_BUILD_DIR)/%,%,$(DEXPREOPT_PRODUCT_DIR_FULL_PATH))
16DEXPREOPT_BOOT_JAR_DIR := system/framework
17DEXPREOPT_BOOT_JAR_DIR_FULL_PATH := $(DEXPREOPT_PRODUCT_DIR_FULL_PATH)/$(DEXPREOPT_BOOT_JAR_DIR)
18
19# The default value for LOCAL_DEX_PREOPT
20DEX_PREOPT_DEFAULT ?= true
21
22# The default filter for which files go into the system_other image (if it is
23# being used). To bundle everything one should set this to '%'
24SYSTEM_OTHER_ODEX_FILTER ?= \
25 app/% \
26 priv-app/% \
27 product_services/app/% \
28 product_services/priv-app/% \
29 product/app/% \
30 product/priv-app/% \
31 7
32# Method returning whether the install path $(1) should be for system_other. 8# Method returning whether the install path $(1) should be for system_other.
33# Under SANITIZE_LITE, we do not want system_other. Just put things under /data/asan. 9# Under SANITIZE_LITE, we do not want system_other. Just put things under /data/asan.
@@ -37,35 +13,6 @@ else
37install-on-system-other = $(filter-out $(PRODUCT_DEXPREOPT_SPEED_APPS) $(PRODUCT_SYSTEM_SERVER_APPS),$(basename $(notdir $(filter $(foreach f,$(SYSTEM_OTHER_ODEX_FILTER),$(TARGET_OUT)/$(f)),$(1))))) 13install-on-system-other = $(filter-out $(PRODUCT_DEXPREOPT_SPEED_APPS) $(PRODUCT_SYSTEM_SERVER_APPS),$(basename $(notdir $(filter $(foreach f,$(SYSTEM_OTHER_ODEX_FILTER),$(TARGET_OUT)/$(f)),$(1)))))
38endif 14endif
39 15
40# The default values for pre-opting: always preopt PIC.
41# Conditional to building on linux, as dex2oat currently does not work on darwin.
42ifeq ($(HOST_OS),linux)
43 WITH_DEXPREOPT ?= true
44 ifeq (eng,$(TARGET_BUILD_VARIANT))
45 # Don't strip for quick development turnarounds.
46 DEX_PREOPT_DEFAULT := nostripping
47 # For an eng build only pre-opt the boot image and system server. This gives reasonable performance
48 # and still allows a simple workflow: building in frameworks/base and syncing.
49 WITH_DEXPREOPT_BOOT_IMG_AND_SYSTEM_SERVER_ONLY ?= true
50 endif
51 # Add mini-debug-info to the boot classpath unless explicitly asked not to.
52 ifneq (false,$(WITH_DEXPREOPT_DEBUG_INFO))
53 PRODUCT_DEX_PREOPT_BOOT_FLAGS += --generate-mini-debug-info
54 endif
55
56 # Non eng linux builds must have preopt enabled so that system server doesn't run as interpreter
57 # only. b/74209329
58 ifeq (,$(filter eng, $(TARGET_BUILD_VARIANT)))
59 ifneq (true,$(WITH_DEXPREOPT))
60 ifneq (true,$(WITH_DEXPREOPT_BOOT_IMG_AND_SYSTEM_SERVER_ONLY))
61 $(call pretty-error, DEXPREOPT must be enabled for user and userdebug builds)
62 endif
63 endif
64 endif
65endif
66
67GLOBAL_DEXPREOPT_FLAGS :=
68
69# Special rules for building stripped boot jars that override java_library.mk rules 16# Special rules for building stripped boot jars that override java_library.mk rules
70 17
71# $(1): boot jar module name 18# $(1): boot jar module name
@@ -83,19 +30,6 @@ $(foreach b,$(DEXPREOPT_BOOT_JARS_MODULES),$(eval $(call _dexpreopt-boot-jar-rem
83 30
84include $(BUILD_SYSTEM)/dex_preopt_libart.mk 31include $(BUILD_SYSTEM)/dex_preopt_libart.mk
85 32
86# Define dexpreopt-one-file based on current default runtime.
87# $(1): the input .jar or .apk file
88# $(2): the output .odex file
89define dexpreopt-one-file
90$(call dex2oat-one-file,$(1),$(2))
91endef
92
93DEXPREOPT_ONE_FILE_DEPENDENCY_TOOLS := $(DEX2OAT_DEPENDENCY)
94DEXPREOPT_ONE_FILE_DEPENDENCY_BUILT_BOOT_PREOPT := $(DEFAULT_DEX_PREOPT_BUILT_IMAGE_FILENAME)
95ifdef TARGET_2ND_ARCH
96$(TARGET_2ND_ARCH_VAR_PREFIX)DEXPREOPT_ONE_FILE_DEPENDENCY_BUILT_BOOT_PREOPT := $($(TARGET_2ND_ARCH_VAR_PREFIX)DEFAULT_DEX_PREOPT_BUILT_IMAGE_FILENAME)
97endif # TARGET_2ND_ARCH
98
99# === hiddenapi rules === 33# === hiddenapi rules ===
100 34
101hiddenapi_stubs_jar = $(call intermediates-dir-for,JAVA_LIBRARIES,$(1),,COMMON)/javalib.jar 35hiddenapi_stubs_jar = $(call intermediates-dir-for,JAVA_LIBRARIES,$(1),,COMMON)/javalib.jar
@@ -149,10 +83,12 @@ $(INTERNAL_PLATFORM_HIDDENAPI_PRIVATE_LIST): $(HIDDENAPI) $(HIDDENAPI_STUBS) \
149 $(call commit-change-for-toc,$(INTERNAL_PLATFORM_HIDDENAPI_PUBLIC_LIST)) 83 $(call commit-change-for-toc,$(INTERNAL_PLATFORM_HIDDENAPI_PUBLIC_LIST))
150 $(call commit-change-for-toc,$(INTERNAL_PLATFORM_HIDDENAPI_PRIVATE_LIST)) 84 $(call commit-change-for-toc,$(INTERNAL_PLATFORM_HIDDENAPI_PRIVATE_LIST))
151 85
86
87
152ifeq ($(PRODUCT_DIST_BOOT_AND_SYSTEM_JARS),true) 88ifeq ($(PRODUCT_DIST_BOOT_AND_SYSTEM_JARS),true)
153boot_profile_jars_zip := $(PRODUCT_OUT)/boot_profile_jars.zip 89boot_profile_jars_zip := $(PRODUCT_OUT)/boot_profile_jars.zip
154all_boot_jars := \ 90all_boot_jars := \
155 $(foreach m,$(DEXPREOPT_BOOT_JARS_MODULES),$(PRODUCT_OUT)/system/framework/$(m).jar) \ 91 $(foreach m,$(PRODUCT_BOOT_JARS),$(PRODUCT_OUT)/system/framework/$(m).jar) \
156 $(foreach m,$(PRODUCT_SYSTEM_SERVER_JARS),$(PRODUCT_OUT)/system/framework/$(m).jar) 92 $(foreach m,$(PRODUCT_SYSTEM_SERVER_JARS),$(PRODUCT_OUT)/system/framework/$(m).jar)
157 93
158$(boot_profile_jars_zip): PRIVATE_JARS := $(all_boot_jars) 94$(boot_profile_jars_zip): PRIVATE_JARS := $(all_boot_jars)
diff --git a/core/dex_preopt_config.mk b/core/dex_preopt_config.mk
new file mode 100644
index 000000000..0793516b2
--- /dev/null
+++ b/core/dex_preopt_config.mk
@@ -0,0 +1,205 @@
1DEX_PREOPT_CONFIG := $(PRODUCT_OUT)/dexpreopt.config
2
3# list of boot classpath jars for dexpreopt
4DEXPREOPT_BOOT_JARS_MODULES := $(PRODUCT_BOOT_JARS)
5PRODUCT_BOOTCLASSPATH_JARS := $(strip $(DEXPREOPT_BOOT_JARS_MODULES))
6PRODUCT_BOOTCLASSPATH := $(subst $(space),:,$(foreach m,$(PRODUCT_BOOTCLASSPATH_JARS),/system/framework/$(m).jar))
7
8PRODUCT_SYSTEM_SERVER_CLASSPATH := $(subst $(space),:,$(foreach m,$(PRODUCT_SYSTEM_SERVER_JARS),/system/framework/$(m).jar))
9
10DEXPREOPT_BUILD_DIR := $(OUT_DIR)
11DEXPREOPT_PRODUCT_DIR_FULL_PATH := $(PRODUCT_OUT)/dex_bootjars
12DEXPREOPT_PRODUCT_DIR := $(patsubst $(DEXPREOPT_BUILD_DIR)/%,%,$(DEXPREOPT_PRODUCT_DIR_FULL_PATH))
13DEXPREOPT_BOOT_JAR_DIR := system/framework
14DEXPREOPT_BOOT_JAR_DIR_FULL_PATH := $(DEXPREOPT_PRODUCT_DIR_FULL_PATH)/$(DEXPREOPT_BOOT_JAR_DIR)
15
16DEXPREOPT_BOOTCLASSPATH_DEX_LOCATIONS := $(foreach m,$(PRODUCT_BOOTCLASSPATH_JARS),/$(DEXPREOPT_BOOT_JAR_DIR)/$(m).jar)
17DEXPREOPT_BOOTCLASSPATH_DEX_FILES := $(foreach jar,$(DEXPREOPT_BOOTCLASSPATH_DEX_LOCATIONS),$(PRODUCT_OUT)$(jar))
18
19DEFAULT_DEX_PREOPT_BUILT_IMAGE_LOCATION := $(DEXPREOPT_BOOT_JAR_DIR_FULL_PATH)/boot.art
20DEFAULT_DEX_PREOPT_BUILT_IMAGE_FILENAME := $(DEXPREOPT_BOOT_JAR_DIR_FULL_PATH)/$(DEX2OAT_TARGET_ARCH)/boot.art
21
22ifdef TARGET_2ND_ARCH
23 $(TARGET_2ND_ARCH_VAR_PREFIX)DEFAULT_DEX_PREOPT_BUILT_IMAGE_LOCATION := $(DEXPREOPT_BOOT_JAR_DIR_FULL_PATH)/boot.art
24 $(TARGET_2ND_ARCH_VAR_PREFIX)DEFAULT_DEX_PREOPT_BUILT_IMAGE_FILENAME := $(DEXPREOPT_BOOT_JAR_DIR_FULL_PATH)/$($(TARGET_2ND_ARCH_VAR_PREFIX)DEX2OAT_TARGET_ARCH)/boot.art
25endif
26
27# The default value for LOCAL_DEX_PREOPT
28DEX_PREOPT_DEFAULT ?= true
29
30# The default filter for which files go into the system_other image (if it is
31# being used). To bundle everything one should set this to '%'
32SYSTEM_OTHER_ODEX_FILTER ?= \
33 app/% \
34 priv-app/% \
35 product_services/app/% \
36 product_services/priv-app/% \
37 product/app/% \
38 product/priv-app/% \
39
40# The default values for pre-opting: always preopt PIC.
41# Conditional to building on linux, as dex2oat currently does not work on darwin.
42ifeq ($(HOST_OS),linux)
43 WITH_DEXPREOPT ?= true
44 ifeq (eng,$(TARGET_BUILD_VARIANT))
45 # Don't strip for quick development turnarounds.
46 DEX_PREOPT_DEFAULT := nostripping
47 # For an eng build only pre-opt the boot image and system server. This gives reasonable performance
48 # and still allows a simple workflow: building in frameworks/base and syncing.
49 WITH_DEXPREOPT_BOOT_IMG_AND_SYSTEM_SERVER_ONLY ?= true
50 endif
51 # Add mini-debug-info to the boot classpath unless explicitly asked not to.
52 ifneq (false,$(WITH_DEXPREOPT_DEBUG_INFO))
53 PRODUCT_DEX_PREOPT_BOOT_FLAGS += --generate-mini-debug-info
54 endif
55
56 # Non eng linux builds must have preopt enabled so that system server doesn't run as interpreter
57 # only. b/74209329
58 ifeq (,$(filter eng, $(TARGET_BUILD_VARIANT)))
59 ifneq (true,$(WITH_DEXPREOPT))
60 ifneq (true,$(WITH_DEXPREOPT_BOOT_IMG_AND_SYSTEM_SERVER_ONLY))
61 $(call pretty-error, DEXPREOPT must be enabled for user and userdebug builds)
62 endif
63 endif
64 endif
65endif
66
67# Default to debug version to help find bugs.
68# Set USE_DEX2OAT_DEBUG to false for only building non-debug versions.
69ifeq ($(USE_DEX2OAT_DEBUG),false)
70DEX2OAT := $(HOST_OUT_EXECUTABLES)/dex2oat$(HOST_EXECUTABLE_SUFFIX)
71else
72DEX2OAT := $(HOST_OUT_EXECUTABLES)/dex2oatd$(HOST_EXECUTABLE_SUFFIX)
73endif
74
75DEX2OAT_DEPENDENCY += $(DEX2OAT)
76
77# Use the first preloaded-classes file in PRODUCT_COPY_FILES.
78PRELOADED_CLASSES := $(call word-colon,1,$(firstword \
79 $(filter %system/etc/preloaded-classes,$(PRODUCT_COPY_FILES))))
80
81# Use the first dirty-image-objects file in PRODUCT_COPY_FILES.
82DIRTY_IMAGE_OBJECTS := $(call word-colon,1,$(firstword \
83 $(filter %system/etc/dirty-image-objects,$(PRODUCT_COPY_FILES))))
84
85define get-product-default-property
86$(strip \
87 $(eval _prop := $(patsubst $(1)=%,%,$(filter $(1)=%,$(PRODUCT_DEFAULT_PROPERTY_OVERRIDES))))\
88 $(if $(_prop),$(_prop),$(patsubst $(1)=%,%,$(filter $(1)=%,$(PRODUCT_SYSTEM_DEFAULT_PROPERTIES)))))
89endef
90
91DEX2OAT_IMAGE_XMS := $(call get-product-default-property,dalvik.vm.image-dex2oat-Xms)
92DEX2OAT_IMAGE_XMX := $(call get-product-default-property,dalvik.vm.image-dex2oat-Xmx)
93DEX2OAT_XMS := $(call get-product-default-property,dalvik.vm.dex2oat-Xms)
94DEX2OAT_XMX := $(call get-product-default-property,dalvik.vm.dex2oat-Xmx)
95
96ifeq ($(TARGET_ARCH),$(filter $(TARGET_ARCH),mips mips64))
97# MIPS specific overrides.
98# For MIPS the ART image is loaded at a lower address. This causes issues
99# with the image overlapping with memory on the host cross-compiling and
100# building the image. We therefore limit the Xmx value. This isn't done
101# via a property as we want the larger Xmx value if we're running on a
102# MIPS device.
103DEX2OAT_XMX := 128m
104endif
105
106ifeq ($(WRITE_SOONG_VARIABLES),true)
107
108 $(call json_start)
109
110 $(call add_json_bool, DefaultNoStripping, $(filter nostripping,$(DEX_PREOPT_DEFAULT)))
111 $(call add_json_list, DisablePreoptModules, $(DEXPREOPT_DISABLED_MODULES))
112 $(call add_json_bool, OnlyPreoptBootImageAndSystemServer, $(filter true,$(WITH_DEXPREOPT_BOOT_IMG_AND_SYSTEM_SERVER_ONLY)))
113 $(call add_json_bool, DontUncompressPrivAppsDex, $(filter true,$(DONT_UNCOMPRESS_PRIV_APPS_DEXS)))
114 $(call add_json_list, ModulesLoadedByPrivilegedModules, $(PRODUCT_LOADED_BY_PRIVILEGED_MODULES))
115 $(call add_json_bool, HasSystemOther, $(BOARD_USES_SYSTEM_OTHER_ODEX))
116 $(call add_json_list, PatternsOnSystemOther, $(SYSTEM_OTHER_ODEX_FILTER))
117 $(call add_json_bool, DisableGenerateProfile, $(filter false,$(WITH_DEX_PREOPT_GENERATE_PROFILE)))
118 $(call add_json_list, PreoptBootClassPathDexFiles, $(DEXPREOPT_BOOTCLASSPATH_DEX_FILES))
119 $(call add_json_list, PreoptBootClassPathDexLocations, $(DEXPREOPT_BOOTCLASSPATH_DEX_LOCATIONS))
120 $(call add_json_list, BootJars, $(PRODUCT_BOOT_JARS))
121 $(call add_json_list, SystemServerJars, $(PRODUCT_SYSTEM_SERVER_JARS))
122 $(call add_json_list, SystemServerApps, $(PRODUCT_SYSTEM_SERVER_APPS))
123 $(call add_json_list, SpeedApps, $(PRODUCT_DEXPREOPT_SPEED_APPS))
124 $(call add_json_list, PreoptFlags, $(PRODUCT_DEX_PREOPT_DEFAULT_FLAGS))
125 $(call add_json_str, DefaultCompilerFilter, $(PRODUCT_DEX_PREOPT_DEFAULT_COMPILER_FILTER))
126 $(call add_json_str, SystemServerCompilerFilter, $(PRODUCT_SYSTEM_SERVER_COMPILER_FILTER))
127 $(call add_json_bool, GenerateDmFiles, $(PRODUCT_DEX_PREOPT_GENERATE_DM_FILES))
128 $(call add_json_bool, NoDebugInfo, $(filter false,$(WITH_DEXPREOPT_DEBUG_INFO)))
129 $(call add_json_bool, AlwaysSystemServerDebugInfo, $(filter true,$(PRODUCT_SYSTEM_SERVER_DEBUG_INFO)))
130 $(call add_json_bool, NeverSystemServerDebugInfo, $(filter false,$(PRODUCT_SYSTEM_SERVER_DEBUG_INFO)))
131 $(call add_json_bool, AlwaysOtherDebugInfo, $(filter true,$(PRODUCT_OTHER_JAVA_DEBUG_INFO)))
132 $(call add_json_bool, NeverOtherDebugInfo, $(filter false,$(PRODUCT_OTHER_JAVA_DEBUG_INFO)))
133 $(call add_json_list, MissingUsesLibraries, $(INTERNAL_PLATFORM_MISSING_USES_LIBRARIES))
134 $(call add_json_bool, IsEng, $(filter eng,$(TARGET_BUILD_VARIANT)))
135 $(call add_json_bool, SanitizeLite, $(SANITIZE_LITE))
136 $(call add_json_bool, DefaultAppImages, $(WITH_DEX_PREOPT_APP_IMAGE))
137 $(call add_json_str, Dex2oatXmx, $(DEX2OAT_XMX))
138 $(call add_json_str, Dex2oatXms, $(DEX2OAT_XMS))
139 $(call add_json_str, EmptyDirectory, $(OUT_DIR)/empty)
140
141 $(call add_json_map, DefaultDexPreoptImageLocation)
142 $(call add_json_str, $(TARGET_ARCH), $(DEFAULT_DEX_PREOPT_BUILT_IMAGE_LOCATION))
143 ifdef TARGET_2ND_ARCH
144 $(call add_json_str, $(TARGET_2ND_ARCH), $($(TARGET_2ND_ARCH_VAR_PREFIX)DEFAULT_DEX_PREOPT_BUILT_IMAGE_LOCATION))
145 endif
146 $(call end_json_map)
147
148 $(call add_json_map, CpuVariant)
149 $(call add_json_str, $(TARGET_ARCH), $(DEX2OAT_TARGET_CPU_VARIANT))
150 ifdef TARGET_2ND_ARCH
151 $(call add_json_str, $(TARGET_2ND_ARCH), $($(TARGET_2ND_ARCH_VAR_PREFIX)DEX2OAT_TARGET_CPU_VARIANT))
152 endif
153 $(call end_json_map)
154
155 $(call add_json_map, InstructionSetFeatures)
156 $(call add_json_str, $(TARGET_ARCH), $(DEX2OAT_TARGET_INSTRUCTION_SET_FEATURES))
157 ifdef TARGET_2ND_ARCH
158 $(call add_json_str, $(TARGET_2ND_ARCH), $($(TARGET_2ND_ARCH_VAR_PREFIX)DEX2OAT_TARGET_INSTRUCTION_SET_FEATURES))
159 endif
160 $(call end_json_map)
161
162 $(call add_json_map, Tools)
163 $(call add_json_str, Profman, $(PROFMAN))
164 $(call add_json_str, Dex2oat, $(DEX2OAT))
165 $(call add_json_str, Aapt, $(AAPT))
166 $(call add_json_str, SoongZip, $(SOONG_ZIP))
167 $(call add_json_str, Zip2zip, $(ZIP2ZIP))
168 $(call add_json_str, VerifyUsesLibraries, $(BUILD_SYSTEM)/verify_uses_libraries.sh)
169 $(call add_json_str, ConstructContext, $(BUILD_SYSTEM)/construct_context.sh)
170 $(call end_json_map)
171
172 $(call json_end)
173
174 $(shell mkdir -p $(dir $(DEX_PREOPT_CONFIG)))
175 $(file >$(DEX_PREOPT_CONFIG).tmp,$(json_contents))
176
177 $(shell \
178 if ! cmp -s $(DEX_PREOPT_CONFIG).tmp $(DEX_PREOPT_CONFIG); then \
179 mv $(DEX_PREOPT_CONFIG).tmp $(DEX_PREOPT_CONFIG); \
180 else \
181 rm $(DEX_PREOPT_CONFIG).tmp; \
182 fi)
183endif
184
185# Dummy rule to create dexpreopt.config, it will already have been created
186# by the $(file) call above, but a rule needs to exist to keep the dangling
187# rule check happy.
188$(DEX_PREOPT_CONFIG):
189 @#empty
190
191DEXPREOPT_GEN_DEPS := \
192 $(PROFMAN) \
193 $(DEX2OAT) \
194 $(AAPT) \
195 $(SOONG_ZIP) \
196 $(ZIP2ZIP) \
197 $(BUILD_SYSTEM)/verify_uses_libraries.sh \
198 $(BUILD_SYSTEM)/construct_context.sh \
199
200DEXPREOPT_GEN_DEPS += $(DEFAULT_DEX_PREOPT_BUILT_IMAGE_FILENAME)
201ifdef TARGET_2ND_ARCH
202 ifneq ($(TARGET_TRANSLATE_2ND_ARCH),true)
203 DEXPREOPT_GEN_DEPS += $($(TARGET_2ND_ARCH_VAR_PREFIX)DEFAULT_DEX_PREOPT_BUILT_IMAGE_FILENAME)
204 endif
205endif
diff --git a/core/dex_preopt_libart.mk b/core/dex_preopt_libart.mk
index 1c9ef6433..631db0a0f 100644
--- a/core/dex_preopt_libart.mk
+++ b/core/dex_preopt_libart.mk
@@ -3,77 +3,9 @@
3# 3#
4#################################### 4####################################
5 5
6# Default to debug version to help find bugs.
7# Set USE_DEX2OAT_DEBUG to false for only building non-debug versions.
8ifeq ($(USE_DEX2OAT_DEBUG),false)
9DEX2OAT := $(HOST_OUT_EXECUTABLES)/dex2oat$(HOST_EXECUTABLE_SUFFIX)
10else
11DEX2OAT := $(HOST_OUT_EXECUTABLES)/dex2oatd$(HOST_EXECUTABLE_SUFFIX)
12endif
13
14DEX2OAT_DEPENDENCY += $(DEX2OAT)
15
16# Use the first preloaded-classes file in PRODUCT_COPY_FILES.
17PRELOADED_CLASSES := $(call word-colon,1,$(firstword \
18 $(filter %system/etc/preloaded-classes,$(PRODUCT_COPY_FILES))))
19
20# Use the first dirty-image-objects file in PRODUCT_COPY_FILES.
21DIRTY_IMAGE_OBJECTS := $(call word-colon,1,$(firstword \
22 $(filter %system/etc/dirty-image-objects,$(PRODUCT_COPY_FILES))))
23
24define get-product-default-property
25$(strip \
26 $(eval _prop := $(patsubst $(1)=%,%,$(filter $(1)=%,$(PRODUCT_DEFAULT_PROPERTY_OVERRIDES))))\
27 $(if $(_prop),$(_prop),$(patsubst $(1)=%,%,$(filter $(1)=%,$(PRODUCT_SYSTEM_DEFAULT_PROPERTIES)))))
28endef
29
30DEX2OAT_IMAGE_XMS := $(call get-product-default-property,dalvik.vm.image-dex2oat-Xms)
31DEX2OAT_IMAGE_XMX := $(call get-product-default-property,dalvik.vm.image-dex2oat-Xmx)
32DEX2OAT_XMS := $(call get-product-default-property,dalvik.vm.dex2oat-Xms)
33DEX2OAT_XMX := $(call get-product-default-property,dalvik.vm.dex2oat-Xmx)
34
35ifeq ($(TARGET_ARCH),$(filter $(TARGET_ARCH),mips mips64))
36# MIPS specific overrides.
37# For MIPS the ART image is loaded at a lower address. This causes issues
38# with the image overlapping with memory on the host cross-compiling and
39# building the image. We therefore limit the Xmx value. This isn't done
40# via a property as we want the larger Xmx value if we're running on a
41# MIPS device.
42DEX2OAT_XMX := 128m
43endif
44
45######################################################################## 6########################################################################
46# The full system boot classpath 7# The full system boot classpath
47 8
48# Returns the path to the .odex file
49# $(1): the arch name.
50# $(2): the full path (including file name) of the corresponding .jar or .apk.
51define get-odex-file-path
52$(dir $(2))oat/$(1)/$(basename $(notdir $(2))).odex
53endef
54
55# Returns the full path to the installed .odex file.
56# This handles BOARD_USES_SYSTEM_OTHER_ODEX to install odex files into another
57# partition.
58# $(1): the arch name.
59# $(2): the full install path (including file name) of the corresponding .apk.
60ifeq ($(BOARD_USES_SYSTEM_OTHER_ODEX),true)
61define get-odex-installed-file-path
62$(if $(call install-on-system-other, $(2)),
63 $(call get-odex-file-path,$(1),$(patsubst $(TARGET_OUT)/%,$(TARGET_OUT_SYSTEM_OTHER)/%,$(2))),
64 $(call get-odex-file-path,$(1),$(2)))
65endef
66else
67get-odex-installed-file-path = $(get-odex-file-path)
68endif
69
70# Returns the path to the image file (such as "/system/framework/<arch>/boot.art"
71# $(1): the arch name (such as "arm")
72# $(2): the image location (such as "/system/framework/boot.art")
73define get-image-file-path
74$(dir $(2))$(1)/$(notdir $(2))
75endef
76
77LIBART_TARGET_BOOT_JARS := $(DEXPREOPT_BOOT_JARS_MODULES) 9LIBART_TARGET_BOOT_JARS := $(DEXPREOPT_BOOT_JARS_MODULES)
78LIBART_TARGET_BOOT_DEX_LOCATIONS := $(foreach jar,$(LIBART_TARGET_BOOT_JARS),/$(DEXPREOPT_BOOT_JAR_DIR)/$(jar).jar) 10LIBART_TARGET_BOOT_DEX_LOCATIONS := $(foreach jar,$(LIBART_TARGET_BOOT_JARS),/$(DEXPREOPT_BOOT_JAR_DIR)/$(jar).jar)
79LIBART_TARGET_BOOT_DEX_FILES := $(foreach jar,$(LIBART_TARGET_BOOT_JARS),$(call intermediates-dir-for,JAVA_LIBRARIES,$(jar),,COMMON)/javalib.jar) 11LIBART_TARGET_BOOT_DEX_FILES := $(foreach jar,$(LIBART_TARGET_BOOT_JARS),$(call intermediates-dir-for,JAVA_LIBRARIES,$(jar),,COMMON)/javalib.jar)
@@ -164,51 +96,3 @@ $(LIBART_TARGET_BOOT_ART_VDEX_INSTALLED_SHARED_FILES) : $(DEFAULT_DEX_PREOPT_BUI
164 $(hide) ln -sf /$(DEXPREOPT_BOOT_JAR_DIR)/$(notdir $@) $(SECOND_ARCH_DIR)$(notdir $@) 96 $(hide) ln -sf /$(DEXPREOPT_BOOT_JAR_DIR)/$(notdir $@) $(SECOND_ARCH_DIR)$(notdir $@)
165 97
166my_2nd_arch_prefix := 98my_2nd_arch_prefix :=
167
168########################################################################
169# For a single jar or APK
170
171# $(1): the input .jar or .apk file
172# $(2): the output .odex file
173# In the case where LOCAL_ENFORCE_USES_LIBRARIES is true, PRIVATE_DEX2OAT_CLASS_LOADER_CONTEXT
174# contains the normalized path list of the libraries. This makes it easier to conditionally prepend
175# org.apache.http.legacy.impl based on the SDK level if required.
176#
177# Pass --avoid-storing-invocation to make the output deterministics between
178# different products that may have different paths on the command line.
179define dex2oat-one-file
180$(hide) rm -f $(2)
181$(hide) mkdir -p $(dir $(2))
182stored_class_loader_context_libs=$(PRIVATE_DEX2OAT_STORED_CLASS_LOADER_CONTEXT_LIBS) && \
183class_loader_context_arg=--class-loader-context=$(PRIVATE_DEX2OAT_CLASS_LOADER_CONTEXT) && \
184class_loader_context=$(PRIVATE_DEX2OAT_CLASS_LOADER_CONTEXT) && \
185stored_class_loader_context_arg="" && \
186uses_library_names="$(PRIVATE_USES_LIBRARY_NAMES)" && \
187optional_uses_library_names="$(PRIVATE_OPTIONAL_USES_LIBRARY_NAMES)" && \
188aapt_binary="$(AAPT)" && \
189$(if $(filter true,$(PRIVATE_ENFORCE_USES_LIBRARIES)), \
190source build/make/core/verify_uses_libraries.sh "$(1)" && \
191source build/make/core/construct_context.sh "$(PRIVATE_CONDITIONAL_USES_LIBRARIES_HOST)" "$(PRIVATE_CONDITIONAL_USES_LIBRARIES_TARGET)" && \
192,) \
193ANDROID_LOG_TAGS="*:e" $(DEX2OAT) \
194 --avoid-storing-invocation \
195 --runtime-arg -Xms$(DEX2OAT_XMS) --runtime-arg -Xmx$(DEX2OAT_XMX) \
196 $${class_loader_context_arg} \
197 $${stored_class_loader_context_arg} \
198 --boot-image=$(PRIVATE_DEX_PREOPT_IMAGE_LOCATION) \
199 --dex-file=$(1) \
200 --dex-location=$(PRIVATE_DEX_LOCATION) \
201 --oat-file=$(2) \
202 --android-root=$(PRODUCT_OUT)/system \
203 --instruction-set=$($(PRIVATE_2ND_ARCH_VAR_PREFIX)DEX2OAT_TARGET_ARCH) \
204 --instruction-set-variant=$($(PRIVATE_2ND_ARCH_VAR_PREFIX)DEX2OAT_TARGET_CPU_VARIANT) \
205 --instruction-set-features=$($(PRIVATE_2ND_ARCH_VAR_PREFIX)DEX2OAT_TARGET_INSTRUCTION_SET_FEATURES) \
206 --no-generate-debug-info --generate-build-id \
207 --abort-on-hard-verifier-error \
208 --force-determinism \
209 --no-inline-from=core-oj.jar \
210 $(PRIVATE_DEX_PREOPT_FLAGS) \
211 $(PRIVATE_ART_FILE_PREOPT_FLAGS) \
212 $(PRIVATE_PROFILE_PREOPT_FLAGS) \
213 $(GLOBAL_DEXPREOPT_FLAGS)
214endef
diff --git a/core/dex_preopt_libart_boot.mk b/core/dex_preopt_libart_boot.mk
index 70a934cd9..b31f5a847 100644
--- a/core/dex_preopt_libart_boot.mk
+++ b/core/dex_preopt_libart_boot.mk
@@ -20,8 +20,6 @@
20# 2ND_DEFAULT_DEX_PREOPT_BUILT_IMAGE_FILENAME=out/target/product/generic_x86_64/dex_bootjars/system/framework/x86/boot.art 20# 2ND_DEFAULT_DEX_PREOPT_BUILT_IMAGE_FILENAME=out/target/product/generic_x86_64/dex_bootjars/system/framework/x86/boot.art
21# 2ND_LIBART_BOOT_IMAGE=/system/framework/x86/boot.art 21# 2ND_LIBART_BOOT_IMAGE=/system/framework/x86/boot.art
22 22
23$(my_2nd_arch_prefix)DEFAULT_DEX_PREOPT_BUILT_IMAGE_LOCATION := $(DEXPREOPT_BOOT_JAR_DIR_FULL_PATH)/boot.art
24$(my_2nd_arch_prefix)DEFAULT_DEX_PREOPT_BUILT_IMAGE_FILENAME := $(DEXPREOPT_BOOT_JAR_DIR_FULL_PATH)/$($(my_2nd_arch_prefix)DEX2OAT_TARGET_ARCH)/boot.art
25$(my_2nd_arch_prefix)LIBART_BOOT_IMAGE_FILENAME := /$(DEXPREOPT_BOOT_JAR_DIR)/$($(my_2nd_arch_prefix)DEX2OAT_TARGET_ARCH)/boot.art 23$(my_2nd_arch_prefix)LIBART_BOOT_IMAGE_FILENAME := /$(DEXPREOPT_BOOT_JAR_DIR)/$($(my_2nd_arch_prefix)DEX2OAT_TARGET_ARCH)/boot.art
26 24
27# The .oat with symbols 25# The .oat with symbols
@@ -92,11 +90,13 @@ $($(my_2nd_arch_prefix)DEFAULT_DEX_PREOPT_BUILT_IMAGE_FILENAME) : $(LIBART_TARGE
92 @echo "target dex2oat: $@" 90 @echo "target dex2oat: $@"
93 @mkdir -p $(dir $@) 91 @mkdir -p $(dir $@)
94 @mkdir -p $(dir $($(PRIVATE_2ND_ARCH_VAR_PREFIX)LIBART_TARGET_BOOT_OAT_UNSTRIPPED)) 92 @mkdir -p $(dir $($(PRIVATE_2ND_ARCH_VAR_PREFIX)LIBART_TARGET_BOOT_OAT_UNSTRIPPED))
95 @rm -f $(dir $@)/*.art $(dir $@)/*.oat 93 @rm -f $(dir $@)/*.art $(dir $@)/*.oat $(dir $@)/*.invocation
96 @rm -f $(dir $($(PRIVATE_2ND_ARCH_VAR_PREFIX)LIBART_TARGET_BOOT_OAT_UNSTRIPPED))/*.art 94 @rm -f $(dir $($(PRIVATE_2ND_ARCH_VAR_PREFIX)LIBART_TARGET_BOOT_OAT_UNSTRIPPED))/*.art
97 @rm -f $(dir $($(PRIVATE_2ND_ARCH_VAR_PREFIX)LIBART_TARGET_BOOT_OAT_UNSTRIPPED))/*.oat 95 @rm -f $(dir $($(PRIVATE_2ND_ARCH_VAR_PREFIX)LIBART_TARGET_BOOT_OAT_UNSTRIPPED))/*.oat
96 @rm -f $(dir $($(PRIVATE_2ND_ARCH_VAR_PREFIX)LIBART_TARGET_BOOT_OAT_UNSTRIPPED))/*.invocation
98 $(hide) $(DEX2OAT_BOOT_IMAGE_LOG_TAGS) $(DEX2OAT) --runtime-arg -Xms$(DEX2OAT_IMAGE_XMS) \ 97 $(hide) $(DEX2OAT_BOOT_IMAGE_LOG_TAGS) $(DEX2OAT) --runtime-arg -Xms$(DEX2OAT_IMAGE_XMS) \
99 --avoid-storing-invocation \ 98 --avoid-storing-invocation \
99 --write-invocation-to=$(patsubst %.art,%.invocation,$@) \
100 --runtime-arg -Xmx$(DEX2OAT_IMAGE_XMX) \ 100 --runtime-arg -Xmx$(DEX2OAT_IMAGE_XMX) \
101 $(PRIVATE_BOOT_IMAGE_FLAGS) \ 101 $(PRIVATE_BOOT_IMAGE_FLAGS) \
102 $(addprefix --dex-file=,$(LIBART_TARGET_BOOT_DEX_FILES)) \ 102 $(addprefix --dex-file=,$(LIBART_TARGET_BOOT_DEX_FILES)) \
@@ -114,7 +114,7 @@ $($(my_2nd_arch_prefix)DEFAULT_DEX_PREOPT_BUILT_IMAGE_FILENAME) : $(LIBART_TARGE
114 --no-inline-from=core-oj.jar \ 114 --no-inline-from=core-oj.jar \
115 --abort-on-hard-verifier-error \ 115 --abort-on-hard-verifier-error \
116 --abort-on-soft-verifier-error \ 116 --abort-on-soft-verifier-error \
117 $(PRODUCT_DEX_PREOPT_BOOT_FLAGS) $(GLOBAL_DEXPREOPT_FLAGS) $(ART_BOOT_IMAGE_EXTRA_ARGS) \ 117 $(PRODUCT_DEX_PREOPT_BOOT_FLAGS) $(ART_BOOT_IMAGE_EXTRA_ARGS) \
118 || ( echo "$(DEX2OAT_FAILURE_MESSAGE)" ; false ) 118 || ( echo "$(DEX2OAT_FAILURE_MESSAGE)" ; false )
119 119
120endif 120endif
diff --git a/core/dex_preopt_odex_install.mk b/core/dex_preopt_odex_install.mk
index 6a892e23a..69790cb10 100644
--- a/core/dex_preopt_odex_install.mk
+++ b/core/dex_preopt_odex_install.mk
@@ -3,7 +3,7 @@
3# Output variables: LOCAL_DEX_PREOPT, LOCAL_UNCOMPRESS_DEX, built_odex, 3# Output variables: LOCAL_DEX_PREOPT, LOCAL_UNCOMPRESS_DEX, built_odex,
4# dexpreopt_boot_jar_module 4# dexpreopt_boot_jar_module
5 5
6ifeq (true,$(LOCAL_PREFER_INTEGRITY)) 6ifeq (true,$(LOCAL_PREFER_CODE_INTEGRITY))
7 LOCAL_UNCOMPRESS_DEX := true 7 LOCAL_UNCOMPRESS_DEX := true
8else 8else
9 LOCAL_UNCOMPRESS_DEX := 9 LOCAL_UNCOMPRESS_DEX :=
@@ -25,24 +25,6 @@ endif # DONT_UNCOMPRESS_PRIV_APPS_DEXS
25LOCAL_DEX_PREOPT := $(strip $(LOCAL_DEX_PREOPT)) 25LOCAL_DEX_PREOPT := $(strip $(LOCAL_DEX_PREOPT))
26ifndef LOCAL_DEX_PREOPT # LOCAL_DEX_PREOPT undefined 26ifndef LOCAL_DEX_PREOPT # LOCAL_DEX_PREOPT undefined
27 LOCAL_DEX_PREOPT := $(DEX_PREOPT_DEFAULT) 27 LOCAL_DEX_PREOPT := $(DEX_PREOPT_DEFAULT)
28
29 ifeq ($(filter $(TARGET_OUT)/%,$(my_module_path)),) # Not installed to system.img.
30 # Default to nostripping for non system preopt (enables preopt).
31 # Don't strip in case the oat/vdex version in system ROM doesn't match the one in other
32 # partitions. It needs to be able to fall back to the APK for that case.
33 LOCAL_DEX_PREOPT := nostripping
34 endif
35
36 ifneq (,$(LOCAL_APK_LIBRARIES)) # LOCAL_APK_LIBRARIES not empty
37 LOCAL_DEX_PREOPT := nostripping
38 endif
39endif
40
41ifeq (nostripping,$(LOCAL_DEX_PREOPT))
42 LOCAL_DEX_PREOPT := true
43 LOCAL_STRIP_DEX :=
44else
45 LOCAL_STRIP_DEX := true
46endif 28endif
47 29
48ifeq (false,$(LOCAL_DEX_PREOPT)) 30ifeq (false,$(LOCAL_DEX_PREOPT))
@@ -90,38 +72,8 @@ ifneq (true,$(my_preopt_for_extracted_apk))
90 endif 72 endif
91endif 73endif
92 74
93ifeq ($(LOCAL_DEX_PREOPT),true)
94 # Don't strip with dexes we explicitly uncompress (dexopt will not store the dex code).
95 ifeq ($(LOCAL_UNCOMPRESS_DEX),true)
96 LOCAL_STRIP_DEX :=
97 endif # LOCAL_UNCOMPRESS_DEX
98
99 # system_other isn't there for an OTA, so don't strip
100 # if module is on system, and odex is on system_other.
101 ifeq ($(BOARD_USES_SYSTEM_OTHER_ODEX),true)
102 ifneq ($(call install-on-system-other, $(my_module_path)),)
103 LOCAL_STRIP_DEX :=
104 endif # install-on-system-other
105 endif # BOARD_USES_SYSTEM_OTHER_ODEX
106
107 # We also don't strip if all dexs are uncompressed (dexopt will not store the dex code),
108 # but that requires to inspect the source file, which is too early at this point (as we
109 # don't know if the source file will actually be used).
110 # See dexpreopt-remove-classes.dex.
111endif # LOCAL_DEX_PREOPT
112
113built_odex :=
114built_vdex :=
115built_art :=
116installed_odex :=
117installed_vdex :=
118installed_art :=
119built_installed_odex :=
120built_installed_vdex :=
121built_installed_art :=
122my_process_profile := 75my_process_profile :=
123my_profile_is_text_listing := 76my_profile_is_text_listing :=
124my_generate_dm :=
125 77
126ifeq (false,$(WITH_DEX_PREOPT_GENERATE_PROFILE)) 78ifeq (false,$(WITH_DEX_PREOPT_GENERATE_PROFILE))
127 LOCAL_DEX_PREOPT_GENERATE_PROFILE := false 79 LOCAL_DEX_PREOPT_GENERATE_PROFILE := false
@@ -135,7 +87,7 @@ ifndef LOCAL_DEX_PREOPT_GENERATE_PROFILE
135 87
136 ifneq (,$(wildcard $(LOCAL_DEX_PREOPT_PROFILE))) 88 ifneq (,$(wildcard $(LOCAL_DEX_PREOPT_PROFILE)))
137 my_process_profile := true 89 my_process_profile := true
138 my_profile_is_text_listing := false 90 my_profile_is_text_listing :=
139 endif 91 endif
140else 92else
141 my_process_profile := $(LOCAL_DEX_PREOPT_GENERATE_PROFILE) 93 my_process_profile := $(LOCAL_DEX_PREOPT_GENERATE_PROFILE)
@@ -144,273 +96,72 @@ else
144endif 96endif
145 97
146ifeq (true,$(my_process_profile)) 98ifeq (true,$(my_process_profile))
147
148 ifeq (,$(LOCAL_DEX_PREOPT_APP_IMAGE))
149 LOCAL_DEX_PREOPT_APP_IMAGE := true
150 endif
151
152 ifndef LOCAL_DEX_PREOPT_PROFILE 99 ifndef LOCAL_DEX_PREOPT_PROFILE
153 $(call pretty-error,Must have specified class listing (LOCAL_DEX_PREOPT_PROFILE)) 100 $(call pretty-error,Must have specified class listing (LOCAL_DEX_PREOPT_PROFILE))
154 endif 101 endif
155 ifeq (,$(dex_preopt_profile_src_file)) 102 ifeq (,$(dex_preopt_profile_src_file))
156 $(call pretty-error, Internal error: dex_preopt_profile_src_file must be set) 103 $(call pretty-error, Internal error: dex_preopt_profile_src_file must be set)
157 endif 104 endif
158 my_built_profile := $(dir $(LOCAL_BUILT_MODULE))/profile.prof
159 my_dex_location := $(patsubst $(PRODUCT_OUT)%,%,$(LOCAL_INSTALLED_MODULE))
160 # Remove compressed APK extension.
161 my_dex_location := $(patsubst %.gz,%,$(my_dex_location))
162 $(my_built_profile): PRIVATE_BUILT_MODULE := $(dex_preopt_profile_src_file)
163 $(my_built_profile): PRIVATE_DEX_LOCATION := $(my_dex_location)
164 $(my_built_profile): PRIVATE_SOURCE_CLASSES := $(LOCAL_DEX_PREOPT_PROFILE)
165 $(my_built_profile): $(LOCAL_DEX_PREOPT_PROFILE)
166 $(my_built_profile): $(PROFMAN)
167 $(my_built_profile): $(dex_preopt_profile_src_file)
168 ifeq (true,$(my_profile_is_text_listing))
169 # The profile is a test listing of classes (used for framework jars).
170 # We need to generate the actual binary profile before being able to compile.
171 $(my_built_profile):
172 $(hide) mkdir -p $(dir $@)
173 ANDROID_LOG_TAGS="*:e" $(PROFMAN) \
174 --create-profile-from=$(PRIVATE_SOURCE_CLASSES) \
175 --apk=$(PRIVATE_BUILT_MODULE) \
176 --dex-location=$(PRIVATE_DEX_LOCATION) \
177 --reference-profile-file=$@
178 else
179 # The profile is binary profile (used for apps). Run it through profman to
180 # ensure the profile keys match the apk.
181 $(my_built_profile):
182 $(hide) mkdir -p $(dir $@)
183 touch $@
184 ANDROID_LOG_TAGS="*:i" $(PROFMAN) \
185 --copy-and-update-profile-key \
186 --profile-file=$(PRIVATE_SOURCE_CLASSES) \
187 --apk=$(PRIVATE_BUILT_MODULE) \
188 --dex-location=$(PRIVATE_DEX_LOCATION) \
189 --reference-profile-file=$@ \
190 || echo "Profile out of date for $(PRIVATE_BUILT_MODULE)"
191 endif
192
193 my_profile_is_text_listing :=
194 dex_preopt_profile_src_file :=
195
196 # Remove compressed APK extension.
197 my_installed_profile := $(patsubst %.gz,%,$(LOCAL_INSTALLED_MODULE)).prof
198
199 # my_installed_profile := $(LOCAL_INSTALLED_MODULE).prof
200 $(eval $(call copy-one-file,$(my_built_profile),$(my_installed_profile)))
201 build_installed_profile:=$(my_built_profile):$(my_installed_profile)
202else
203 build_installed_profile:=
204 my_installed_profile :=
205endif 105endif
206 106
207ifdef LOCAL_DEX_PREOPT 107# If LOCAL_ENFORCE_USES_LIBRARIES is not set, default to true if either of LOCAL_USES_LIBRARIES or
208 108# LOCAL_OPTIONAL_USES_LIBRARIES are specified.
209 dexpreopt_boot_jar_module := $(filter $(DEXPREOPT_BOOT_JARS_MODULES),$(LOCAL_MODULE)) 109ifeq (,$(LOCAL_ENFORCE_USES_LIBRARIES))
210 110 # Will change the default to true unconditionally in the future.
211 ifdef dexpreopt_boot_jar_module 111 ifneq (,$(LOCAL_OPTIONAL_USES_LIBRARIES))
212 # For libart, the boot jars' odex files are replaced by $(DEFAULT_DEX_PREOPT_INSTALLED_IMAGE). 112 LOCAL_ENFORCE_USES_LIBRARIES := true
213 # We use this installed_odex trick to get boot.art installed. 113 endif
214 installed_odex := $(DEFAULT_DEX_PREOPT_INSTALLED_IMAGE) 114 ifneq (,$(LOCAL_USES_LIBRARIES))
215 # Append the odex for the 2nd arch if we have one. 115 LOCAL_ENFORCE_USES_LIBRARIES := true
216 installed_odex += $($(TARGET_2ND_ARCH_VAR_PREFIX)DEFAULT_DEX_PREOPT_INSTALLED_IMAGE) 116 endif
217 else # boot jar 117endif
218 ifeq ($(LOCAL_MODULE_CLASS),JAVA_LIBRARIES)
219
220 my_module_multilib := $(LOCAL_MULTILIB)
221 # If the module is not an SDK library and it's a system server jar, only preopt the primary arch.
222 my_filtered_lib_name := $(patsubst %.impl,%,$(LOCAL_MODULE))
223 ifeq (,$(filter $(JAVA_SDK_LIBRARIES),$(my_filtered_lib_name)))
224 # For a Java library, by default we build odex for both 1st arch and 2nd arch.
225 # But it can be overridden with "LOCAL_MULTILIB := first".
226 ifneq (,$(filter $(PRODUCT_SYSTEM_SERVER_JARS),$(LOCAL_MODULE)))
227 # For system server jars, we build for only "first".
228 my_module_multilib := first
229 endif
230 endif
231
232 # Only preopt primary arch for translated arch since there is only an image there.
233 ifeq ($(TARGET_TRANSLATE_2ND_ARCH),true)
234 my_module_multilib := first
235 endif
236
237 # #################################################
238 # Odex for the 1st arch
239 my_2nd_arch_prefix :=
240 include $(BUILD_SYSTEM)/setup_one_odex.mk
241 # #################################################
242 # Odex for the 2nd arch
243 ifdef TARGET_2ND_ARCH
244 ifneq ($(TARGET_TRANSLATE_2ND_ARCH),true)
245 ifneq (first,$(my_module_multilib))
246 my_2nd_arch_prefix := $(TARGET_2ND_ARCH_VAR_PREFIX)
247 include $(BUILD_SYSTEM)/setup_one_odex.mk
248 endif # my_module_multilib is not first.
249 endif # TARGET_TRANSLATE_2ND_ARCH not true
250 endif # TARGET_2ND_ARCH
251 # #################################################
252 else # must be APPS
253 # The preferred arch
254 my_2nd_arch_prefix := $(LOCAL_2ND_ARCH_VAR_PREFIX)
255 # Save the module multilib since setup_one_odex modifies it.
256 saved_my_module_multilib := $(my_module_multilib)
257 include $(BUILD_SYSTEM)/setup_one_odex.mk
258 my_module_multilib := $(saved_my_module_multilib)
259 ifdef TARGET_2ND_ARCH
260 ifeq ($(my_module_multilib),both)
261 # The non-preferred arch
262 my_2nd_arch_prefix := $(if $(LOCAL_2ND_ARCH_VAR_PREFIX),,$(TARGET_2ND_ARCH_VAR_PREFIX))
263 include $(BUILD_SYSTEM)/setup_one_odex.mk
264 endif # LOCAL_MULTILIB is both
265 endif # TARGET_2ND_ARCH
266 endif # LOCAL_MODULE_CLASS
267 endif # boot jar
268
269 built_odex := $(strip $(built_odex))
270 built_vdex := $(strip $(built_vdex))
271 built_art := $(strip $(built_art))
272 installed_odex := $(strip $(installed_odex))
273 installed_vdex := $(strip $(installed_vdex))
274 installed_art := $(strip $(installed_art))
275
276 ifdef built_odex
277 ifeq (true,$(my_process_profile))
278 $(built_odex): $(my_built_profile)
279 $(built_odex): PRIVATE_PROFILE_PREOPT_FLAGS := --profile-file=$(my_built_profile)
280 else
281 $(built_odex): PRIVATE_PROFILE_PREOPT_FLAGS :=
282 endif
283
284 ifndef LOCAL_DEX_PREOPT_FLAGS
285 LOCAL_DEX_PREOPT_FLAGS := $(DEXPREOPT.$(TARGET_PRODUCT).$(LOCAL_MODULE).CONFIG)
286 ifndef LOCAL_DEX_PREOPT_FLAGS
287 LOCAL_DEX_PREOPT_FLAGS := $(PRODUCT_DEX_PREOPT_DEFAULT_FLAGS)
288 endif
289 endif
290
291 my_system_server_compiler_filter := $(PRODUCT_SYSTEM_SERVER_COMPILER_FILTER)
292 ifeq (,$(my_system_server_compiler_filter))
293 my_system_server_compiler_filter := speed
294 endif
295 118
296 my_default_compiler_filter := $(PRODUCT_DEX_PREOPT_DEFAULT_COMPILER_FILTER) 119my_dexpreopt_archs :=
297 ifeq (,$(my_default_compiler_filter))
298 # If no default compiler filter is specified, default to 'quicken' to save on storage.
299 my_default_compiler_filter := quicken
300 endif
301 120
302 ifeq (,$(filter --compiler-filter=%, $(LOCAL_DEX_PREOPT_FLAGS))) 121ifdef LOCAL_DEX_PREOPT
122 ifeq ($(LOCAL_MODULE_CLASS),JAVA_LIBRARIES)
123 my_module_multilib := $(LOCAL_MULTILIB)
124 # If the module is not an SDK library and it's a system server jar, only preopt the primary arch.
125 my_filtered_lib_name := $(patsubst %.impl,%,$(LOCAL_MODULE))
126 ifeq (,$(filter $(JAVA_SDK_LIBRARIES),$(my_filtered_lib_name)))
127 # For a Java library, by default we build odex for both 1st arch and 2nd arch.
128 # But it can be overridden with "LOCAL_MULTILIB := first".
303 ifneq (,$(filter $(PRODUCT_SYSTEM_SERVER_JARS),$(LOCAL_MODULE))) 129 ifneq (,$(filter $(PRODUCT_SYSTEM_SERVER_JARS),$(LOCAL_MODULE)))
304 # Jars of system server, use the product option if it is set, speed otherwise. 130 # For system server jars, we build for only "first".
305 LOCAL_DEX_PREOPT_FLAGS += --compiler-filter=$(my_system_server_compiler_filter) 131 my_module_multilib := first
306 else
307 ifneq (,$(filter $(PRODUCT_DEXPREOPT_SPEED_APPS) $(PRODUCT_SYSTEM_SERVER_APPS),$(LOCAL_MODULE)))
308 # Apps loaded into system server, and apps the product default to being compiled with the
309 # 'speed' compiler filter.
310 LOCAL_DEX_PREOPT_FLAGS += --compiler-filter=speed
311 else
312 ifeq (true,$(my_process_profile))
313 # For non system server jars, use speed-profile when we have a profile.
314 LOCAL_DEX_PREOPT_FLAGS += --compiler-filter=speed-profile
315 else
316 LOCAL_DEX_PREOPT_FLAGS += --compiler-filter=$(my_default_compiler_filter)
317 endif
318 endif
319 endif
320 endif
321
322 my_generate_dm := $(PRODUCT_DEX_PREOPT_GENERATE_DM_FILES)
323 ifeq (,$(filter $(LOCAL_DEX_PREOPT_FLAGS),--compiler-filter=verify))
324 # Generating DM files only makes sense for verify, avoid doing for non verify compiler filter APKs.
325 my_generate_dm := false
326 endif
327
328 # No reason to use a dm file if the dex is already uncompressed.
329 ifeq ($(LOCAL_UNCOMPRESS_DEX),true)
330 my_generate_dm := false
331 endif
332
333 ifeq (true,$(my_generate_dm))
334 LOCAL_DEX_PREOPT_FLAGS += --copy-dex-files=false
335 LOCAL_DEX_PREOPT := true
336 LOCAL_STRIP_DEX :=
337 my_built_dm := $(dir $(LOCAL_BUILT_MODULE))generated.dm
338 my_installed_dm := $(patsubst %.apk,%,$(LOCAL_INSTALLED_MODULE)).dm
339 my_copied_vdex := $(dir $(LOCAL_BUILT_MODULE))primary.vdex
340 $(eval $(call copy-one-file,$(built_vdex),$(my_copied_vdex)))
341 $(my_built_dm): PRIVATE_INPUT_VDEX := $(my_copied_vdex)
342 $(my_built_dm): $(my_copied_vdex) $(ZIPTIME)
343 $(hide) mkdir -p $(dir $@)
344 $(hide) rm -f $@
345 $(hide) zip -qD -j -X -9 $@ $(PRIVATE_INPUT_VDEX)
346 $(ZIPTIME) $@
347 $(eval $(call copy-one-file,$(my_built_dm),$(my_installed_dm)))
348 endif
349
350 # By default, emit debug info.
351 my_dexpreopt_debug_info := true
352 # If the global setting suppresses mini-debug-info, disable it.
353 ifeq (false,$(WITH_DEXPREOPT_DEBUG_INFO))
354 my_dexpreopt_debug_info := false
355 endif
356
357 # PRODUCT_SYSTEM_SERVER_DEBUG_INFO overrides WITH_DEXPREOPT_DEBUG_INFO.
358 # PRODUCT_OTHER_JAVA_DEBUG_INFO overrides WITH_DEXPREOPT_DEBUG_INFO.
359 ifneq (,$(filter $(PRODUCT_SYSTEM_SERVER_JARS),$(LOCAL_MODULE)))
360 ifeq (true,$(PRODUCT_SYSTEM_SERVER_DEBUG_INFO))
361 my_dexpreopt_debug_info := true
362 else ifeq (false,$(PRODUCT_SYSTEM_SERVER_DEBUG_INFO))
363 my_dexpreopt_debug_info := false
364 endif
365 else
366 ifeq (true,$(PRODUCT_OTHER_JAVA_DEBUG_INFO))
367 my_dexpreopt_debug_info := true
368 else ifeq (false,$(PRODUCT_OTHER_JAVA_DEBUG_INFO))
369 my_dexpreopt_debug_info := false
370 endif 132 endif
371 endif 133 endif
372 134
373 # Never enable on eng. 135 # Only preopt primary arch for translated arch since there is only an image there.
374 ifeq (eng,$(filter eng, $(TARGET_BUILD_VARIANT))) 136 ifeq ($(TARGET_TRANSLATE_2ND_ARCH),true)
375 my_dexpreopt_debug_info := false 137 my_module_multilib := first
376 endif 138 endif
377 139
378 # Add dex2oat flag for debug-info/no-debug-info. 140 # #################################################
379 ifeq (true,$(my_dexpreopt_debug_info)) 141 # Odex for the 1st arch
380 LOCAL_DEX_PREOPT_FLAGS += --generate-mini-debug-info 142 my_dexpreopt_archs += $(TARGET_ARCH)
381 else ifeq (false,$(my_dexpreopt_debug_info)) 143 # Odex for the 2nd arch
382 LOCAL_DEX_PREOPT_FLAGS += --no-generate-mini-debug-info 144 ifdef TARGET_2ND_ARCH
383 endif 145 ifneq ($(TARGET_TRANSLATE_2ND_ARCH),true)
384 146 ifneq (first,$(my_module_multilib))
385 # Set the compiler reason to 'prebuilt' to identify the oat files produced 147 my_dexpreopt_archs += $(TARGET_2ND_ARCH)
386 # during the build, as opposed to compiled on the device. 148 endif # my_module_multilib is not first.
387 LOCAL_DEX_PREOPT_FLAGS += --compilation-reason=prebuilt 149 endif # TARGET_TRANSLATE_2ND_ARCH not true
388 150 endif # TARGET_2ND_ARCH
389 $(built_odex): PRIVATE_DEX_PREOPT_FLAGS := $(LOCAL_DEX_PREOPT_FLAGS) 151 # #################################################
390 $(built_vdex): $(built_odex) 152 else # must be APPS
391 $(built_art): $(built_odex) 153 # The preferred arch
392 endif 154 # Save the module multilib since setup_one_odex modifies it.
393 155 my_2nd_arch_prefix := $(LOCAL_2ND_ARCH_VAR_PREFIX)
394 ifneq (true,$(my_generate_dm)) 156 my_dexpreopt_archs += $(TARGET_$(my_2nd_arch_prefix)ARCH)
395 # Add the installed_odex to the list of installed files for this module if we aren't generating a 157 ifdef TARGET_2ND_ARCH
396 # dm file. 158 ifeq ($(my_module_multilib),both)
397 ALL_MODULES.$(my_register_name).INSTALLED += $(installed_odex) 159 # The non-preferred arch
398 ALL_MODULES.$(my_register_name).INSTALLED += $(installed_vdex) 160 my_2nd_arch_prefix := $(if $(LOCAL_2ND_ARCH_VAR_PREFIX),,$(TARGET_2ND_ARCH_VAR_PREFIX))
399 ALL_MODULES.$(my_register_name).INSTALLED += $(installed_art) 161 my_dexpreopt_archs += $(TARGET_$(my_2nd_arch_prefix)ARCH)
400 162 endif # LOCAL_MULTILIB is both
401 ALL_MODULES.$(my_register_name).BUILT_INSTALLED += $(built_installed_odex) 163 endif # TARGET_2ND_ARCH
402 ALL_MODULES.$(my_register_name).BUILT_INSTALLED += $(built_installed_vdex) 164 endif # LOCAL_MODULE_CLASS
403 ALL_MODULES.$(my_register_name).BUILT_INSTALLED += $(built_installed_art)
404
405 # Make sure to install the .odex and .vdex when you run "make <module_name>"
406 $(my_all_targets): $(installed_odex) $(installed_vdex) $(installed_art)
407 else
408 ALL_MODULES.$(my_register_name).INSTALLED += $(my_installed_dm)
409 ALL_MODULES.$(my_register_name).BUILT_INSTALLED += $(my_built_dm) $(my_installed_dm)
410
411 # Make sure to install the .dm when you run "make <module_name>"
412 $(my_all_targets): $(installed_dm)
413 endif
414 165
415 # Record dex-preopt config. 166 # Record dex-preopt config.
416 DEXPREOPT.$(LOCAL_MODULE).DEX_PREOPT := $(LOCAL_DEX_PREOPT) 167 DEXPREOPT.$(LOCAL_MODULE).DEX_PREOPT := $(LOCAL_DEX_PREOPT)
@@ -419,17 +170,104 @@ ifdef LOCAL_DEX_PREOPT
419 DEXPREOPT.$(LOCAL_MODULE).PRIVILEGED_MODULE := $(LOCAL_PRIVILEGED_MODULE) 170 DEXPREOPT.$(LOCAL_MODULE).PRIVILEGED_MODULE := $(LOCAL_PRIVILEGED_MODULE)
420 DEXPREOPT.$(LOCAL_MODULE).VENDOR_MODULE := $(LOCAL_VENDOR_MODULE) 171 DEXPREOPT.$(LOCAL_MODULE).VENDOR_MODULE := $(LOCAL_VENDOR_MODULE)
421 DEXPREOPT.$(LOCAL_MODULE).TARGET_ARCH := $(LOCAL_MODULE_TARGET_ARCH) 172 DEXPREOPT.$(LOCAL_MODULE).TARGET_ARCH := $(LOCAL_MODULE_TARGET_ARCH)
422 DEXPREOPT.$(LOCAL_MODULE).INSTALLED := $(installed_odex)
423 DEXPREOPT.$(LOCAL_MODULE).INSTALLED_STRIPPED := $(LOCAL_INSTALLED_MODULE) 173 DEXPREOPT.$(LOCAL_MODULE).INSTALLED_STRIPPED := $(LOCAL_INSTALLED_MODULE)
424 DEXPREOPT.MODULES.$(LOCAL_MODULE_CLASS) := $(sort \ 174 DEXPREOPT.MODULES.$(LOCAL_MODULE_CLASS) := $(sort \
425 $(DEXPREOPT.MODULES.$(LOCAL_MODULE_CLASS)) $(LOCAL_MODULE)) 175 $(DEXPREOPT.MODULES.$(LOCAL_MODULE_CLASS)) $(LOCAL_MODULE))
426 176
427endif # LOCAL_DEX_PREOPT 177 $(call json_start)
178
179 $(call add_json_str, Name, $(LOCAL_MODULE))
180 $(call add_json_str, DexLocation, $(patsubst $(PRODUCT_OUT)%,%,$(LOCAL_INSTALLED_MODULE)))
181 $(call add_json_str, BuildPath, $(LOCAL_BUILT_MODULE))
182 $(call add_json_str, DexPath, $$1)
183 $(call add_json_str, ExtrasOutputPath, $$2)
184 $(call add_json_bool, PreferCodeIntegrity, $(filter true,$(LOCAL_PREFER_CODE_INTEGRITY)))
185 $(call add_json_bool, Privileged, $(filter true,$(LOCAL_PRIVILEGED_MODULE)))
186 $(call add_json_bool, UncompressedDex, $(filter true,$(LOCAL_UNCOMPRESS_DEX)))
187 $(call add_json_bool, HasApkLibraries, $(LOCAL_APK_LIBRARIES))
188 $(call add_json_list, PreoptFlags, $(LOCAL_DEX_PREOPT_FLAGS))
189 $(call add_json_str, ProfileClassListing, $(if $(my_process_profile),$(LOCAL_DEX_PREOPT_PROFILE)))
190 $(call add_json_bool, ProfileIsTextListing, $(my_profile_is_text_listing))
191 $(call add_json_bool, EnforceUsesLibraries, $(LOCAL_ENFORCE_USES_LIBRARIES))
192 $(call add_json_list, OptionalUsesLibraries, $(LOCAL_OPTIONAL_USES_LIBRARIES))
193 $(call add_json_list, UsesLibraries, $(LOCAL_USES_LIBRARIES))
194 $(call add_json_map, LibraryPaths)
195 $(foreach lib,$(sort $(LOCAL_USES_LIBRARIES) $(LOCAL_OPTIONAL_USES_LIBRARIES) org.apache.http.legacy.impl android.hidl.base-V1.0-java android.hidl.manager-V1.0-java),\
196 $(call add_json_str, $(lib), $(call intermediates-dir-for,JAVA_LIBRARIES,$(lib),,COMMON)/javalib.jar))
197 $(call end_json_map)
198 $(call add_json_list, Archs, $(my_dexpreopt_archs))
199 $(call add_json_str, DexPreoptImageLocation, $(LOCAL_DEX_PREOPT_IMAGE_LOCATION))
200 $(call add_json_bool, PreoptExtractedApk, $(my_preopt_for_extracted_apk))
201 $(call add_json_bool, NoCreateAppImage, $(filter false,$(LOCAL_DEX_PREOPT_APP_IMAGE)))
202 $(call add_json_bool, ForceCreateAppImage, $(filter true,$(LOCAL_DEX_PREOPT_APP_IMAGE)))
203 $(call add_json_bool, PresignedPrebuilt, $(filter PRESIGNED,$(LOCAL_CERTIFICATE)))
204
205 $(call add_json_bool, NoStripping, $(filter nostripping,$(LOCAL_DEX_PREOPT)))
206 $(call add_json_str, StripInputPath, $$1)
207 $(call add_json_str, StripOutputPath, $$2)
208
209 $(call json_end)
210
211 my_dexpreopt_config := $(intermediates)/dexpreopt.config
212 my_dexpreopt_script := $(intermediates)/dexpreopt.sh
213 my_strip_script := $(intermediates)/strip.sh
214 my_dexpreopt_zip := $(intermediates)/dexpreopt.zip
215
216 $(my_dexpreopt_config): PRIVATE_MODULE := $(LOCAL_MODULE)
217 $(my_dexpreopt_config): PRIVATE_CONTENTS := $(json_contents)
218 $(my_dexpreopt_config):
219 @echo "$(PRIVATE_MODULE) dexpreopt.config"
220 echo -e -n '$(subst $(newline),\n,$(subst ','\'',$(subst \,\\,$(PRIVATE_CONTENTS))))' > $@
221
222 .KATI_RESTAT: $(my_dexpreopt_script) $(my_strip_script)
223 $(my_dexpreopt_script): PRIVATE_MODULE := $(LOCAL_MODULE)
224 $(my_dexpreopt_script): PRIVATE_GLOBAL_CONFIG := $(PRODUCT_OUT)/dexpreopt.config
225 $(my_dexpreopt_script): PRIVATE_MODULE_CONFIG := $(my_dexpreopt_config)
226 $(my_dexpreopt_script): PRIVATE_STRIP_SCRIPT := $(my_strip_script)
227 $(my_dexpreopt_script): .KATI_IMPLICIT_OUTPUTS := $(my_strip_script)
228 $(my_dexpreopt_script): $(DEXPREOPT_GEN)
229 $(my_dexpreopt_script): $(my_dexpreopt_config) $(PRODUCT_OUT)/dexpreopt.config
230 @echo "$(PRIVATE_MODULE) dexpreopt gen"
231 $(DEXPREOPT_GEN) -global $(PRIVATE_GLOBAL_CONFIG) -module $(PRIVATE_MODULE_CONFIG) \
232 -dexpreopt_script $@ -strip_script $(PRIVATE_STRIP_SCRIPT)
233
234 my_dexpreopt_deps := $(my_dex_jar)
235 my_dexpreopt_deps += $(if $(my_process_profile),$(LOCAL_DEX_PREOPT_PROFILE))
236 my_dexpreopt_deps += \
237 $(foreach lib,$(sort $(LOCAL_USES_LIBRARIES) $(LOCAL_OPTIONAL_USES_LIBRARIES) org.apache.http.legacy.impl android.hidl.base-V1.0-java android.hidl.manager-V1.0-java),\
238 $(call intermediates-dir-for,JAVA_LIBRARIES,$(lib),,COMMON)/javalib.jar)
239 my_dexpreopt_deps += $(LOCAL_DEX_PREOPT_IMAGE_LOCATION)
240 # TODO: default boot images
241
242 $(my_dexpreopt_zip): PRIVATE_MODULE := $(LOCAL_MODULE)
243 $(my_dexpreopt_zip): $(my_dexpreopt_deps)
244 $(my_dexpreopt_zip): | $(DEXPREOPT_GEN_DEPS)
245 $(my_dexpreopt_zip): .KATI_DEPFILE := $(my_dexpreopt_zip).d
246 $(my_dexpreopt_zip): PRIVATE_DEX := $(my_dex_jar)
247 $(my_dexpreopt_zip): PRIVATE_SCRIPT := $(my_dexpreopt_script)
248 $(my_dexpreopt_zip): $(my_dexpreopt_script)
249 @echo "$(PRIVATE_MODULE) dexpreopt"
250 bash $(PRIVATE_SCRIPT) $(PRIVATE_DEX) $@
251
252 ifdef LOCAL_POST_INSTALL_CMD
253 # Add a shell command separator
254 LOCAL_POST_INSTALL_CMD += &&
255 endif
428 256
429# Profile doesn't depend on LOCAL_DEX_PREOPT. 257 LOCAL_POST_INSTALL_CMD += \
430ALL_MODULES.$(my_register_name).INSTALLED += $(my_installed_profile) 258 for i in $$(zipinfo -1 $(my_dexpreopt_zip)); \
431ALL_MODULES.$(my_register_name).BUILT_INSTALLED += $(build_installed_profile) 259 do mkdir -p $(PRODUCT_OUT)/$$(dirname $$i); \
260 done && \
261 ( unzip -qo -d $(PRODUCT_OUT) $(my_dexpreopt_zip) 2>&1 | grep -v "zipfile is empty"; exit $${PIPESTATUS[0]} ) || \
262 ( code=$$?; if [ $$code -ne 0 -a $$code -ne 1 ]; then exit $$code; fi )
432 263
433my_process_profile := 264 $(LOCAL_INSTALLED_MODULE): PRIVATE_POST_INSTALL_CMD := $(LOCAL_POST_INSTALL_CMD)
265 $(LOCAL_INSTALLED_MODULE): $(my_dexpreopt_zip)
266
267 $(my_all_targets): $(my_dexpreopt_zip)
434 268
435$(my_all_targets): $(my_installed_profile) 269 my_dexpreopt_config :=
270 my_dexpreopt_script :=
271 my_strip_script :=
272 my_dexpreopt_zip :=
273endif # LOCAL_DEX_PREOPT
diff --git a/core/goma.mk b/core/goma.mk
index 3787dfd19..c265259da 100644
--- a/core/goma.mk
+++ b/core/goma.mk
@@ -16,41 +16,18 @@
16 16
17# Notice: this works only with Google's Goma build infrastructure. 17# Notice: this works only with Google's Goma build infrastructure.
18ifneq ($(filter-out false,$(USE_GOMA)),) 18ifneq ($(filter-out false,$(USE_GOMA)),)
19 # Goma requires a lot of processes and file descriptors.
20 ifeq ($(shell echo $$(($$(ulimit -u) < 2500 || $$(ulimit -n) < 16000))),1)
21 $(warning Max user processes and/or open files are insufficient)
22 ifeq ($(shell uname),Darwin)
23 $(error See go/ma/how-to-use-goma/how-to-use-goma-for-android to relax the limit)
24 else
25 $(error Adjust the limit by ulimit -u and ulimit -n)
26 endif
27 endif
28
29 ifdef GOMA_DIR 19 ifdef GOMA_DIR
30 goma_dir := $(GOMA_DIR) 20 goma_dir := $(GOMA_DIR)
31 else 21 else
32 goma_dir := $(HOME)/goma 22 goma_dir := $(HOME)/goma
33 endif 23 endif
34 goma_ctl := $(goma_dir)/goma_ctl.py
35 GOMA_CC := $(goma_dir)/gomacc 24 GOMA_CC := $(goma_dir)/gomacc
36 25
37 $(if $(wildcard $(goma_ctl)),, \
38 $(warning You should have goma in $$GOMA_DIR or $(HOME)/goma) \
39 $(error See go/ma/how-to-use-goma/how-to-use-goma-for-android for detail))
40
41 # Append gomacc to existing *_WRAPPER variables so it's possible to 26 # Append gomacc to existing *_WRAPPER variables so it's possible to
42 # use both ccache and gomacc. 27 # use both ccache and gomacc.
43 CC_WRAPPER := $(strip $(CC_WRAPPER) $(GOMA_CC)) 28 CC_WRAPPER := $(strip $(CC_WRAPPER) $(GOMA_CC))
44 CXX_WRAPPER := $(strip $(CXX_WRAPPER) $(GOMA_CC)) 29 CXX_WRAPPER := $(strip $(CXX_WRAPPER) $(GOMA_CC))
45 JAVAC_WRAPPER := $(strip $(JAVAC_WRAPPER) $(GOMA_CC)) 30 JAVAC_WRAPPER := $(strip $(JAVAC_WRAPPER) $(GOMA_CC))
46 31
47 # gomacc can start goma client's daemon process automatically, but
48 # it is safer and faster to start up it beforehand. We run this as a
49 # background process so this won't slow down the build.
50 ifndef NOSTART_GOMA
51 $(shell ( $(goma_ctl) ensure_start ) &> /dev/null &)
52 endif
53
54 goma_ctl :=
55 goma_dir := 32 goma_dir :=
56endif 33endif
diff --git a/core/java.mk b/core/java.mk
index 932a4212a..e564db251 100644
--- a/core/java.mk
+++ b/core/java.mk
@@ -109,7 +109,7 @@ ifneq ($(strip $(aidl_sources)),)
109 109
110aidl_preprocess_import := 110aidl_preprocess_import :=
111ifdef LOCAL_SDK_VERSION 111ifdef LOCAL_SDK_VERSION
112ifneq ($(filter current system_current test_current core_current, $(LOCAL_SDK_VERSION)$(TARGET_BUILD_APPS)),) 112ifneq ($(filter current system_current test_current core_current, $(LOCAL_SDK_VERSION)$(TARGET_BUILD_APPS_USE_PREBUILT_SDK)),)
113 # LOCAL_SDK_VERSION is current and no TARGET_BUILD_APPS 113 # LOCAL_SDK_VERSION is current and no TARGET_BUILD_APPS
114 aidl_preprocess_import := $(TARGET_OUT_COMMON_INTERMEDIATES)/framework.aidl 114 aidl_preprocess_import := $(TARGET_OUT_COMMON_INTERMEDIATES)/framework.aidl
115else 115else
diff --git a/core/java_common.mk b/core/java_common.mk
index f4c47c81a..ac26e5e44 100644
--- a/core/java_common.mk
+++ b/core/java_common.mk
@@ -29,7 +29,7 @@ ifeq (,$(LOCAL_JAVA_LANGUAGE_VERSION))
29 LOCAL_JAVA_LANGUAGE_VERSION := 1.7 29 LOCAL_JAVA_LANGUAGE_VERSION := 1.7
30 else ifneq (,$(filter $(LOCAL_SDK_VERSION), $(TARGET_SDK_VERSIONS_WITHOUT_JAVA_19_SUPPORT))) 30 else ifneq (,$(filter $(LOCAL_SDK_VERSION), $(TARGET_SDK_VERSIONS_WITHOUT_JAVA_19_SUPPORT)))
31 LOCAL_JAVA_LANGUAGE_VERSION := 1.8 31 LOCAL_JAVA_LANGUAGE_VERSION := 1.8
32 else ifneq (,$(LOCAL_SDK_VERSION)$(TARGET_BUILD_APPS)) 32 else ifneq (,$(LOCAL_SDK_VERSION)$(TARGET_BUILD_APPS_USE_PREBUILT_SDK))
33 # TODO(ccross): allow 1.9 for current and unbundled once we have SDK system modules 33 # TODO(ccross): allow 1.9 for current and unbundled once we have SDK system modules
34 LOCAL_JAVA_LANGUAGE_VERSION := 1.8 34 LOCAL_JAVA_LANGUAGE_VERSION := 1.8
35 else 35 else
@@ -276,7 +276,7 @@ ifndef LOCAL_IS_HOST_MODULE
276 my_system_modules := $(DEFAULT_SYSTEM_MODULES) 276 my_system_modules := $(DEFAULT_SYSTEM_MODULES)
277 endif # LOCAL_NO_STANDARD_LIBRARIES 277 endif # LOCAL_NO_STANDARD_LIBRARIES
278 278
279 ifneq (,$(TARGET_BUILD_APPS)) 279 ifneq (,$(TARGET_BUILD_APPS_USE_PREBUILT_SDK))
280 sdk_libs := $(foreach lib_name,$(LOCAL_SDK_LIBRARIES),$(call resolve-prebuilt-sdk-module,system_current,$(lib_name))) 280 sdk_libs := $(foreach lib_name,$(LOCAL_SDK_LIBRARIES),$(call resolve-prebuilt-sdk-module,system_current,$(lib_name)))
281 else 281 else
282 # When SDK libraries are referenced from modules built without SDK, provide the all APIs to them 282 # When SDK libraries are referenced from modules built without SDK, provide the all APIs to them
@@ -291,7 +291,7 @@ ifndef LOCAL_IS_HOST_MODULE
291 Choices are: $(TARGET_AVAILABLE_SDK_VERSIONS)) 291 Choices are: $(TARGET_AVAILABLE_SDK_VERSIONS))
292 endif 292 endif
293 293
294 ifneq (,$(TARGET_BUILD_APPS)$(filter-out %current,$(LOCAL_SDK_VERSION))) 294 ifneq (,$(TARGET_BUILD_APPS_USE_PREBUILT_SDK)$(filter-out %current,$(LOCAL_SDK_VERSION)))
295 # TARGET_BUILD_APPS mode or numbered SDK. Use prebuilt modules. 295 # TARGET_BUILD_APPS mode or numbered SDK. Use prebuilt modules.
296 sdk_module := $(call resolve-prebuilt-sdk-module,$(LOCAL_SDK_VERSION)) 296 sdk_module := $(call resolve-prebuilt-sdk-module,$(LOCAL_SDK_VERSION))
297 sdk_libs := $(foreach lib_name,$(LOCAL_SDK_LIBRARIES),$(call resolve-prebuilt-sdk-module,$(LOCAL_SDK_VERSION),$(lib_name))) 297 sdk_libs := $(foreach lib_name,$(LOCAL_SDK_LIBRARIES),$(call resolve-prebuilt-sdk-module,$(LOCAL_SDK_VERSION),$(lib_name)))
@@ -333,7 +333,7 @@ ifndef LOCAL_IS_HOST_MODULE
333 # related classes to be present. This change adds stubs needed for 333 # related classes to be present. This change adds stubs needed for
334 # javac to compile lambdas. 334 # javac to compile lambdas.
335 ifneq ($(LOCAL_NO_STANDARD_LIBRARIES),true) 335 ifneq ($(LOCAL_NO_STANDARD_LIBRARIES),true)
336 ifdef TARGET_BUILD_APPS 336 ifdef TARGET_BUILD_APPS_USE_PREBUILT_SDK
337 full_java_bootclasspath_libs += $(call java-lib-header-files,sdk-core-lambda-stubs) 337 full_java_bootclasspath_libs += $(call java-lib-header-files,sdk-core-lambda-stubs)
338 else 338 else
339 full_java_bootclasspath_libs += $(call java-lib-header-files,core-lambda-stubs) 339 full_java_bootclasspath_libs += $(call java-lib-header-files,core-lambda-stubs)
diff --git a/core/java_library.mk b/core/java_library.mk
index e4e51d85c..3e54b0ecc 100644
--- a/core/java_library.mk
+++ b/core/java_library.mk
@@ -50,6 +50,8 @@ else
50LOCAL_EMMA_INSTRUMENT := false 50LOCAL_EMMA_INSTRUMENT := false
51endif # EMMA_INSTRUMENT 51endif # EMMA_INSTRUMENT
52 52
53my_dex_jar := $(common_javalib.jar)
54
53################################# 55#################################
54include $(BUILD_SYSTEM)/java.mk 56include $(BUILD_SYSTEM)/java.mk
55################################# 57#################################
@@ -90,13 +92,13 @@ $(eval $(call copy-one-file,$(dexpreopted_boot_jar),$(LOCAL_BUILT_MODULE)))
90 92
91# For libart boot jars, we don't have .odex files. 93# For libart boot jars, we don't have .odex files.
92else # ! boot jar 94else # ! boot jar
93$(built_odex): PRIVATE_MODULE := $(LOCAL_MODULE)
94# Use pattern rule - we may have multiple built odex files.
95$(built_odex) : $(dir $(LOCAL_BUILT_MODULE))% : $(common_javalib.jar)
96 @echo "Dexpreopt Jar: $(PRIVATE_MODULE) ($@)"
97 $(call dexpreopt-one-file,$<,$@)
98 95
99$(eval $(call dexpreopt-copy-jar,$(common_javalib.jar),$(LOCAL_BUILT_MODULE),$(LOCAL_STRIP_DEX))) 96$(LOCAL_BUILT_MODULE): PRIVATE_STRIP_SCRIPT := $(intermediates)/strip.sh
97$(LOCAL_BUILT_MODULE): $(intermediates)/strip.sh
98$(LOCAL_BUILT_MODULE): | $(DEXPREOPT_GEN_DEPS)
99$(LOCAL_BUILT_MODULE): .KATI_DEPFILE := $(LOCAL_BUILT_MODULE).d
100$(LOCAL_BUILT_MODULE): $(common_javalib.jar)
101 $(PRIVATE_STRIP_SCRIPT) $< $@
100 102
101endif # ! boot jar 103endif # ! boot jar
102 104
diff --git a/core/java_renderscript.mk b/core/java_renderscript.mk
index 406d679d4..13a6f8e66 100644
--- a/core/java_renderscript.mk
+++ b/core/java_renderscript.mk
@@ -82,8 +82,8 @@ $(rs_generated_src_jar): .KATI_IMPLICIT_OUTPUTS := $(rs_generated_res_zip)
82$(rs_generated_src_jar): $(renderscript_sources_fullpath) $(LOCAL_RENDERSCRIPT_CC) $(SOONG_ZIP) 82$(rs_generated_src_jar): $(renderscript_sources_fullpath) $(LOCAL_RENDERSCRIPT_CC) $(SOONG_ZIP)
83 $(transform-renderscripts-to-java-and-bc) 83 $(transform-renderscripts-to-java-and-bc)
84 84
85# include the dependency files (.d/.P) generated by llvm-rs-cc. 85# include the dependency files (.d) generated by llvm-rs-cc.
86$(call include-depfile,$(rs_generated_src_jar).P,$(rs_generated_src_jar)) 86$(call include-depfile,$(rs_generated_src_jar).d,$(rs_generated_src_jar))
87 87
88ifneq ($(LOCAL_RENDERSCRIPT_COMPATIBILITY),) 88ifneq ($(LOCAL_RENDERSCRIPT_COMPATIBILITY),)
89 89
diff --git a/core/main.mk b/core/main.mk
index 9fd1c35c5..0a99e7c84 100644
--- a/core/main.mk
+++ b/core/main.mk
@@ -80,7 +80,7 @@ endif
80ifeq ($(strip $(HAS_BUILD_NUMBER)),false) 80ifeq ($(strip $(HAS_BUILD_NUMBER)),false)
81 # BUILD_NUMBER has a timestamp in it, which means that 81 # BUILD_NUMBER has a timestamp in it, which means that
82 # it will change every time. Pick a stable value. 82 # it will change every time. Pick a stable value.
83 FILE_NAME_TAG := eng.$(USER) 83 FILE_NAME_TAG := eng.$(BUILD_USERNAME)
84else 84else
85 FILE_NAME_TAG := $(file <$(BUILD_NUMBER_FILE)) 85 FILE_NAME_TAG := $(file <$(BUILD_NUMBER_FILE))
86endif 86endif
@@ -1089,6 +1089,12 @@ ifdef FULL_BUILD
1089 static_whitelist_patterns := $(TARGET_OUT_FAKE)/% $(HOST_OUT)/% 1089 static_whitelist_patterns := $(TARGET_OUT_FAKE)/% $(HOST_OUT)/%
1090 # RROs become REQUIRED by the source module, but are always placed on the vendor partition. 1090 # RROs become REQUIRED by the source module, but are always placed on the vendor partition.
1091 static_whitelist_patterns += %__auto_generated_rro.apk 1091 static_whitelist_patterns += %__auto_generated_rro.apk
1092 # $(PRODUCT_OUT)/apex is where shared libraries in APEXes get installed.
1093 # The path can be considered as a fake path, as the shared libraries
1094 # are installed there just to have symbols files for them under
1095 # $(PRODUCT_OUT)/symbols/apex for debugging purpose. The /apex directory
1096 # is never compiled into a filesystem image.
1097 static_whitelist_patterns += $(PRODUCT_OUT)/apex/%
1092 ifeq (true,$(BOARD_USES_SYSTEM_OTHER_ODEX)) 1098 ifeq (true,$(BOARD_USES_SYSTEM_OTHER_ODEX))
1093 # Allow system_other odex space optimization. 1099 # Allow system_other odex space optimization.
1094 static_whitelist_patterns += \ 1100 static_whitelist_patterns += \
@@ -1096,6 +1102,13 @@ ifdef FULL_BUILD
1096 $(TARGET_OUT_SYSTEM_OTHER)/%.vdex \ 1102 $(TARGET_OUT_SYSTEM_OTHER)/%.vdex \
1097 $(TARGET_OUT_SYSTEM_OTHER)/%.art 1103 $(TARGET_OUT_SYSTEM_OTHER)/%.art
1098 endif 1104 endif
1105
1106CERTIFICATE_VIOLATION_MODULES_FILENAME := $(PRODUCT_OUT)/certificate_violation_modules.txt
1107$(CERTIFICATE_VIOLATION_MODULES_FILENAME):
1108 rm -f $@
1109 $(foreach m,$(sort $(CERTIFICATE_VIOLATION_MODULES)), echo $(m) >> $@;)
1110$(call dist-for-goals,droidcore,$(CERTIFICATE_VIOLATION_MODULES_FILENAME))
1111
1099 all_offending_files := 1112 all_offending_files :=
1100 $(foreach makefile,$(ARTIFACT_PATH_REQUIREMENT_PRODUCTS),\ 1113 $(foreach makefile,$(ARTIFACT_PATH_REQUIREMENT_PRODUCTS),\
1101 $(eval requirements := $(PRODUCTS.$(makefile).ARTIFACT_PATH_REQUIREMENTS)) \ 1114 $(eval requirements := $(PRODUCTS.$(makefile).ARTIFACT_PATH_REQUIREMENTS)) \
diff --git a/core/package_internal.mk b/core/package_internal.mk
index 9327587dd..c657f2edb 100644
--- a/core/package_internal.mk
+++ b/core/package_internal.mk
@@ -87,6 +87,23 @@ else
87 LOCAL_RESOURCE_DIR := $(foreach d,$(LOCAL_RESOURCE_DIR),$(call clean-path,$(d))) 87 LOCAL_RESOURCE_DIR := $(foreach d,$(LOCAL_RESOURCE_DIR),$(call clean-path,$(d)))
88endif 88endif
89 89
90# If LOCAL_MODULE matches a rule in PRODUCT_MANIFEST_PACKAGE_NAME_OVERRIDES,
91# override the manfest package name by the (first) rule matched
92override_manifest_name := $(strip $(word 1,\
93 $(foreach rule,$(PRODUCT_MANIFEST_PACKAGE_NAME_OVERRIDES),\
94 $(eval _pkg_name_pat := $(call word-colon,1,$(rule)))\
95 $(eval _manifest_name_pat := $(call word-colon,2,$(rule)))\
96 $(if $(filter $(_pkg_name_pat),$(LOCAL_MODULE)),\
97 $(patsubst $(_pkg_name_pat),$(_manifest_name_pat),$(LOCAL_MODULE))\
98 )\
99 )\
100))
101
102ifneq (,$(override_manifest_name))
103# Note: this can override LOCAL_MANFEST_PACKAGE_NAME value set in Android.mk
104LOCAL_MANIFEST_PACKAGE_NAME := $(override_manifest_name)
105endif
106
90include $(BUILD_SYSTEM)/force_aapt2.mk 107include $(BUILD_SYSTEM)/force_aapt2.mk
91 108
92# Process Support Library dependencies. 109# Process Support Library dependencies.
@@ -309,23 +326,6 @@ endif # LOCAL_EMMA_INSTRUMENT
309 326
310rs_compatibility_jni_libs := 327rs_compatibility_jni_libs :=
311 328
312ifeq ($(LOCAL_DATA_BINDING),true)
313data_binding_intermediates := $(intermediates.COMMON)/data-binding
314
315LOCAL_JAVACFLAGS += -processorpath $(DATA_BINDING_COMPILER) -s $(data_binding_intermediates)/anno-src
316
317LOCAL_STATIC_JAVA_LIBRARIES += databinding-baselibrary
318LOCAL_STATIC_JAVA_AAR_LIBRARIES += databinding-library databinding-adapters
319
320data_binding_res_in := $(LOCAL_RESOURCE_DIR)
321data_binding_res_out := $(data_binding_intermediates)/res
322
323# Replace with the processed merged res dir.
324LOCAL_RESOURCE_DIR := $(data_binding_res_out)
325
326LOCAL_AAPT_FLAGS += --auto-add-overlay --extra-packages com.android.databinding.library
327endif # LOCAL_DATA_BINDING
328
329# If the module is a compressed module, we don't pre-opt it because its final 329# If the module is a compressed module, we don't pre-opt it because its final
330# installation location will be the data partition. 330# installation location will be the data partition.
331ifdef LOCAL_COMPRESSED_MODULE 331ifdef LOCAL_COMPRESSED_MODULE
@@ -432,6 +432,8 @@ endif # LOCAL_USE_AAPT2
432 432
433endif # need_compile_res 433endif # need_compile_res
434 434
435my_dex_jar := $(intermediates.COMMON)/dex.jar
436
435called_from_package_internal := true 437called_from_package_internal := true
436################################# 438#################################
437include $(BUILD_SYSTEM)/java.mk 439include $(BUILD_SYSTEM)/java.mk
@@ -458,34 +460,6 @@ endif
458$(LOCAL_INTERMEDIATE_TARGETS): \ 460$(LOCAL_INTERMEDIATE_TARGETS): \
459 PRIVATE_ANDROID_MANIFEST := $(full_android_manifest) 461 PRIVATE_ANDROID_MANIFEST := $(full_android_manifest)
460 462
461ifeq ($(LOCAL_DATA_BINDING),true)
462data_binding_stamp := $(data_binding_intermediates)/data-binding.stamp
463$(data_binding_stamp): PRIVATE_INTERMEDIATES := $(data_binding_intermediates)
464$(data_binding_stamp): PRIVATE_MANIFEST := $(full_android_manifest)
465# Generate code into $(LOCAL_INTERMEDIATE_SOURCE_DIR) so that the generated .java files
466# will be automatically picked up by function compile-java.
467$(data_binding_stamp): PRIVATE_SRC_OUT := $(LOCAL_INTERMEDIATE_SOURCE_DIR)/data-binding
468$(data_binding_stamp): PRIVATE_XML_OUT := $(data_binding_intermediates)/xml
469$(data_binding_stamp): PRIVATE_RES_OUT := $(data_binding_res_out)
470$(data_binding_stamp): PRIVATE_RES_IN := $(data_binding_res_in)
471$(data_binding_stamp): PRIVATE_ANNO_SRC_DIR := $(data_binding_intermediates)/anno-src
472
473$(data_binding_stamp) : $(all_res_assets) $(full_android_manifest) \
474 $(DATA_BINDING_COMPILER)
475 @echo "Data-binding process: $@"
476 @rm -rf $(PRIVATE_INTERMEDIATES) $(PRIVATE_SRC_OUT) && \
477 mkdir -p $(PRIVATE_INTERMEDIATES) $(PRIVATE_SRC_OUT) \
478 $(PRIVATE_XML_OUT) $(PRIVATE_RES_OUT) $(PRIVATE_ANNO_SRC_DIR)
479 $(hide) $(JAVA) -classpath $(DATA_BINDING_COMPILER) android.databinding.tool.MakeCopy \
480 $(PRIVATE_MANIFEST) $(PRIVATE_SRC_OUT) $(PRIVATE_XML_OUT) $(PRIVATE_RES_OUT) $(PRIVATE_RES_IN)
481 $(hide) touch $@
482
483# Make sure the data-binding process happens before javac and generation of R.java.
484$(R_file_stamp): $(data_binding_stamp)
485$(java_source_list_file): $(data_binding_stamp)
486$(full_classes_compiled_jar): $(data_binding_stamp)
487endif # LOCAL_DATA_BINDING
488
489framework_res_package_export := 463framework_res_package_export :=
490 464
491ifneq ($(LOCAL_NO_STANDARD_LIBRARIES),true) 465ifneq ($(LOCAL_NO_STANDARD_LIBRARIES),true)
@@ -494,7 +468,7 @@ ifneq ($(LOCAL_NO_STANDARD_LIBRARIES),true)
494# resources. 468# resources.
495ifeq ($(LOCAL_SDK_RES_VERSION),core_current) 469ifeq ($(LOCAL_SDK_RES_VERSION),core_current)
496# core_current doesn't contain any framework resources. 470# core_current doesn't contain any framework resources.
497else ifneq ($(filter-out current system_current test_current,$(LOCAL_SDK_RES_VERSION))$(if $(TARGET_BUILD_APPS),$(filter current system_current test_current,$(LOCAL_SDK_RES_VERSION))),) 471else ifneq ($(filter-out current system_current test_current,$(LOCAL_SDK_RES_VERSION))$(if $(TARGET_BUILD_APPS_USE_PREBUILT_SDK),$(filter current system_current test_current,$(LOCAL_SDK_RES_VERSION))),)
498# for released sdk versions, the platform resources were built into android.jar. 472# for released sdk versions, the platform resources were built into android.jar.
499framework_res_package_export := \ 473framework_res_package_export := \
500 $(call resolve-prebuilt-sdk-jar-path,$(LOCAL_SDK_RES_VERSION)) 474 $(call resolve-prebuilt-sdk-jar-path,$(LOCAL_SDK_RES_VERSION))
@@ -561,6 +535,7 @@ endif
561ifeq ($(dir $(strip $(LOCAL_CERTIFICATE))),./) 535ifeq ($(dir $(strip $(LOCAL_CERTIFICATE))),./)
562 LOCAL_CERTIFICATE := $(dir $(DEFAULT_SYSTEM_DEV_CERTIFICATE))$(LOCAL_CERTIFICATE) 536 LOCAL_CERTIFICATE := $(dir $(DEFAULT_SYSTEM_DEV_CERTIFICATE))$(LOCAL_CERTIFICATE)
563endif 537endif
538include $(BUILD_SYSTEM)/app_certificate_validate.mk
564private_key := $(LOCAL_CERTIFICATE).pk8 539private_key := $(LOCAL_CERTIFICATE).pk8
565certificate := $(LOCAL_CERTIFICATE).x509.pem 540certificate := $(LOCAL_CERTIFICATE).x509.pem
566additional_certificates := $(foreach c,$(LOCAL_ADDITIONAL_CERTIFICATES), $(c).x509.pem $(c).pk8) 541additional_certificates := $(foreach c,$(LOCAL_ADDITIONAL_CERTIFICATES), $(c).x509.pem $(c).pk8)
@@ -631,6 +606,12 @@ endif
631ifneq ($(BUILD_PLATFORM_ZIP),) 606ifneq ($(BUILD_PLATFORM_ZIP),)
632$(LOCAL_BUILT_MODULE) : .KATI_IMPLICIT_OUTPUTS := $(dir $(LOCAL_BUILT_MODULE))package.dex.apk 607$(LOCAL_BUILT_MODULE) : .KATI_IMPLICIT_OUTPUTS := $(dir $(LOCAL_BUILT_MODULE))package.dex.apk
633endif 608endif
609ifdef LOCAL_DEX_PREOPT
610$(LOCAL_BUILT_MODULE) : PRIVATE_STRIP_SCRIPT := $(intermediates)/strip.sh
611$(LOCAL_BUILT_MODULE) : $(intermediates)/strip.sh
612$(LOCAL_BUILT_MODULE) : | $(DEXPREOPT_GEN_DEPS)
613$(LOCAL_BUILT_MODULE): .KATI_DEPFILE := $(LOCAL_BUILT_MODULE).d
614endif
634$(LOCAL_BUILT_MODULE): 615$(LOCAL_BUILT_MODULE):
635 @echo "target Package: $(PRIVATE_MODULE) ($@)" 616 @echo "target Package: $(PRIVATE_MODULE) ($@)"
636 rm -rf $@.parts 617 rm -rf $@.parts
@@ -670,9 +651,8 @@ ifneq ($(BUILD_PLATFORM_ZIP),)
670 @# Keep a copy of apk with classes.dex unstripped 651 @# Keep a copy of apk with classes.dex unstripped
671 $(hide) cp -f $@ $(dir $@)package.dex.apk 652 $(hide) cp -f $@ $(dir $@)package.dex.apk
672endif # BUILD_PLATFORM_ZIP 653endif # BUILD_PLATFORM_ZIP
673ifdef LOCAL_STRIP_DEX 654 mv -f $@ $@.tmp
674 $(call dexpreopt-remove-classes.dex,$@) 655 $(PRIVATE_STRIP_SCRIPT) $@.tmp $@
675endif
676endif # LOCAL_DEX_PREOPT 656endif # LOCAL_DEX_PREOPT
677 $(sign-package) 657 $(sign-package)
678ifdef LOCAL_COMPRESSED_MODULE 658ifdef LOCAL_COMPRESSED_MODULE
@@ -739,23 +719,13 @@ endif
739endif 719endif
740 720
741############################### 721###############################
742## Rule to build the odex file 722## Rule to build a jar containing dex files to dexpreopt without waiting for
723## the APK
743ifdef LOCAL_DEX_PREOPT 724ifdef LOCAL_DEX_PREOPT
744$(built_odex): PRIVATE_DEX_FILE := $(built_dex) 725 $(my_dex_jar): PRIVATE_DEX_FILE := $(built_dex)
745ifeq (true, $(LOCAL_UNCOMPRESS_DEX)) 726 $(my_dex_jar): $(built_dex)
746$(built_odex): $(ZIP2ZIP) $(ZIPALIGN)
747endif
748# Use pattern rule - we may have multiple built odex files.
749$(built_odex) : $(dir $(LOCAL_BUILT_MODULE))% : $(built_dex)
750 $(hide) mkdir -p $(dir $@) && rm -f $@ 727 $(hide) mkdir -p $(dir $@) && rm -f $@
751 $(call create-dex-jar,$@,$(PRIVATE_DEX_FILE)) 728 $(call create-dex-jar,$@,$(PRIVATE_DEX_FILE))
752ifeq (true, $(LOCAL_UNCOMPRESS_DEX))
753 $(uncompress-dexs)
754 $(align-package)
755endif
756 $(hide) mv $@ $@.input
757 $(call dexpreopt-one-file,$@.input,$@)
758 $(hide) rm $@.input
759endif 729endif
760 730
761############################### 731###############################
diff --git a/core/prebuilt_internal.mk b/core/prebuilt_internal.mk
index a4b58fc66..960d8d1c5 100644
--- a/core/prebuilt_internal.mk
+++ b/core/prebuilt_internal.mk
@@ -306,6 +306,8 @@ else
306 $(built_module) : PRIVATE_CERTIFICATE := $(LOCAL_CERTIFICATE).x509.pem 306 $(built_module) : PRIVATE_CERTIFICATE := $(LOCAL_CERTIFICATE).x509.pem
307endif 307endif
308 308
309include $(BUILD_SYSTEM)/app_certificate_validate.mk
310
309# Disable dex-preopt of prebuilts to save space, if requested. 311# Disable dex-preopt of prebuilts to save space, if requested.
310ifndef LOCAL_DEX_PREOPT 312ifndef LOCAL_DEX_PREOPT
311ifeq ($(DONT_DEXPREOPT_PREBUILTS),true) 313ifeq ($(DONT_DEXPREOPT_PREBUILTS),true)
@@ -319,6 +321,8 @@ ifdef LOCAL_COMPRESSED_MODULE
319LOCAL_DEX_PREOPT := false 321LOCAL_DEX_PREOPT := false
320endif 322endif
321 323
324my_dex_jar := $(my_prebuilt_src_file)
325
322####################################### 326#######################################
323# defines built_odex along with rule to install odex 327# defines built_odex along with rule to install odex
324include $(BUILD_SYSTEM)/dex_preopt_odex_install.mk 328include $(BUILD_SYSTEM)/dex_preopt_odex_install.mk
@@ -342,7 +346,6 @@ ifndef embedded_prebuilt_jni_libs
342embedded_prebuilt_jni_libs := 346embedded_prebuilt_jni_libs :=
343endif 347endif
344$(built_module): PRIVATE_EMBEDDED_JNI_LIBS := $(embedded_prebuilt_jni_libs) 348$(built_module): PRIVATE_EMBEDDED_JNI_LIBS := $(embedded_prebuilt_jni_libs)
345$(built_module): $(ZIP2ZIP)
346 349
347ifdef LOCAL_COMPRESSED_MODULE 350ifdef LOCAL_COMPRESSED_MODULE
348$(built_module) : $(MINIGZIP) 351$(built_module) : $(MINIGZIP)
@@ -356,7 +359,15 @@ endif
356ifneq ($(BUILD_PLATFORM_ZIP),) 359ifneq ($(BUILD_PLATFORM_ZIP),)
357$(built_module) : .KATI_IMPLICIT_OUTPUTS := $(dir $(LOCAL_BUILT_MODULE))package.dex.apk 360$(built_module) : .KATI_IMPLICIT_OUTPUTS := $(dir $(LOCAL_BUILT_MODULE))package.dex.apk
358endif 361endif
359$(built_module) : $(my_prebuilt_src_file) | $(ZIPALIGN) $(SIGNAPK_JAR) 362ifneq ($(LOCAL_CERTIFICATE),PRESIGNED)
363ifdef LOCAL_DEX_PREOPT
364$(built_module) : PRIVATE_STRIP_SCRIPT := $(intermediates)/strip.sh
365$(built_module) : $(intermediates)/strip.sh
366$(built_module) : | $(DEXPREOPT_GEN_DEPS)
367$(built_module) : .KATI_DEPFILE := $(built_module).d
368endif
369endif
370$(built_module) : $(my_prebuilt_src_file) | $(ZIPALIGN) $(ZIP2ZIP) $(SIGNAPK_JAR)
360 $(transform-prebuilt-to-target) 371 $(transform-prebuilt-to-target)
361 $(uncompress-prebuilt-embedded-jni-libs) 372 $(uncompress-prebuilt-embedded-jni-libs)
362ifeq (true, $(LOCAL_UNCOMPRESS_DEX)) 373ifeq (true, $(LOCAL_UNCOMPRESS_DEX))
@@ -380,9 +391,8 @@ endif
380 $(run-appcompat) 391 $(run-appcompat)
381endif # module_run_appcompat 392endif # module_run_appcompat
382ifdef LOCAL_DEX_PREOPT 393ifdef LOCAL_DEX_PREOPT
383ifdef LOCAL_STRIP_DEX 394 mv -f $@ $@.tmp
384 $(call dexpreopt-remove-classes.dex,$@) 395 $(PRIVATE_STRIP_SCRIPT) $@.tmp $@
385endif # LOCAL_STRIP_DEX
386endif # LOCAL_DEX_PREOPT 396endif # LOCAL_DEX_PREOPT
387 $(sign-package) 397 $(sign-package)
388 # No need for align-package because sign-package takes care of alignment 398 # No need for align-package because sign-package takes care of alignment
@@ -394,20 +404,6 @@ ifdef LOCAL_COMPRESSED_MODULE
394endif # LOCAL_COMPRESSED_MODULE 404endif # LOCAL_COMPRESSED_MODULE
395endif # ! LOCAL_REPLACE_PREBUILT_APK_INSTALLED 405endif # ! LOCAL_REPLACE_PREBUILT_APK_INSTALLED
396 406
397###############################
398## Rule to build the odex file.
399# In case we don't strip the built module, use it, as dexpreopt
400# can do optimizations based on whether the built module only
401# contains uncompressed dex code.
402ifdef LOCAL_DEX_PREOPT
403ifndef LOCAL_STRIP_DEX
404$(built_odex) : $(built_module)
405 $(call dexpreopt-one-file,$<,$@)
406else
407$(built_odex) : $(my_prebuilt_src_file)
408 $(call dexpreopt-one-file,$<,$@)
409endif
410endif
411 407
412############################### 408###############################
413## Install split apks. 409## Install split apks.
@@ -450,6 +446,7 @@ $(my_all_targets): $(installed_apk_splits)
450endif # LOCAL_PACKAGE_SPLITS 446endif # LOCAL_PACKAGE_SPLITS
451 447
452else ifeq ($(prebuilt_module_is_dex_javalib),true) # ! LOCAL_MODULE_CLASS != APPS 448else ifeq ($(prebuilt_module_is_dex_javalib),true) # ! LOCAL_MODULE_CLASS != APPS
449my_dex_jar := $(my_prebuilt_src_file)
453# This is a target shared library, i.e. a jar with classes.dex. 450# This is a target shared library, i.e. a jar with classes.dex.
454####################################### 451#######################################
455# defines built_odex along with rule to install odex 452# defines built_odex along with rule to install odex
@@ -464,13 +461,14 @@ $(built_module) : $(dexpreopted_boot_jar)
464 461
465# For libart boot jars, we don't have .odex files. 462# For libart boot jars, we don't have .odex files.
466else # ! boot jar 463else # ! boot jar
467$(built_odex): PRIVATE_MODULE := $(LOCAL_MODULE)
468# Use pattern rule - we may have multiple built odex files.
469$(built_odex) : $(dir $(LOCAL_BUILT_MODULE))% : $(my_prebuilt_src_file)
470 @echo "Dexpreopt Jar: $(PRIVATE_MODULE) ($@)"
471 $(call dexpreopt-one-file,$<,$@)
472 464
473$(eval $(call dexpreopt-copy-jar,$(my_prebuilt_src_file),$(built_module),$(LOCAL_STRIP_DEX))) 465$(built_module): PRIVATE_STRIP_SCRIPT := $(intermediates)/strip.sh
466$(built_module): $(intermediates)/strip.sh
467$(built_module): | $(DEXPREOPT_GEN_DEPS)
468$(built_module): .KATI_DEPFILE := $(built_module).d
469$(built_module): $(my_prebuilt_src_file)
470 $(PRIVATE_STRIP_SCRIPT) $< $@
471
474endif # boot jar 472endif # boot jar
475else # ! LOCAL_DEX_PREOPT 473else # ! LOCAL_DEX_PREOPT
476$(built_module) : $(my_prebuilt_src_file) 474$(built_module) : $(my_prebuilt_src_file)
diff --git a/core/product.mk b/core/product.mk
index 8497b2830..2d7ace2fa 100644
--- a/core/product.mk
+++ b/core/product.mk
@@ -204,6 +204,8 @@ _product_var_list := \
204 PRODUCT_COMPATIBLE_PROPERTY_OVERRIDE \ 204 PRODUCT_COMPATIBLE_PROPERTY_OVERRIDE \
205 PRODUCT_ACTIONABLE_COMPATIBLE_PROPERTY_DISABLE \ 205 PRODUCT_ACTIONABLE_COMPATIBLE_PROPERTY_DISABLE \
206 PRODUCT_ENFORCE_ARTIFACT_PATH_REQUIREMENTS \ 206 PRODUCT_ENFORCE_ARTIFACT_PATH_REQUIREMENTS \
207 PRODUCT_ENFORCE_ARTIFACT_SYSTEM_CERTIFICATE_REQUIREMENT \
208 PRODUCT_ARTIFACT_SYSTEM_CERTIFICATE_REQUIREMENT_WHITELIST \
207 PRODUCT_ARTIFACT_PATH_REQUIREMENT_HINT \ 209 PRODUCT_ARTIFACT_PATH_REQUIREMENT_HINT \
208 PRODUCT_ARTIFACT_PATH_REQUIREMENT_WHITELIST \ 210 PRODUCT_ARTIFACT_PATH_REQUIREMENT_WHITELIST \
209 PRODUCT_USE_DYNAMIC_PARTITION_SIZE \ 211 PRODUCT_USE_DYNAMIC_PARTITION_SIZE \
@@ -213,6 +215,7 @@ _product_var_list := \
213 PRODUCT_RETROFIT_DYNAMIC_PARTITIONS \ 215 PRODUCT_RETROFIT_DYNAMIC_PARTITIONS \
214 PRODUCT_OTA_ENFORCE_VINTF_KERNEL_REQUIREMENTS \ 216 PRODUCT_OTA_ENFORCE_VINTF_KERNEL_REQUIREMENTS \
215 PRODUCT_XOM_EXCLUDE_PATHS \ 217 PRODUCT_XOM_EXCLUDE_PATHS \
218 PRODUCT_MANIFEST_PACKAGE_NAME_OVERRIDES \
216 219
217define dump-product 220define dump-product
218$(info ==== $(1) ====)\ 221$(info ==== $(1) ====)\
diff --git a/core/product_config.mk b/core/product_config.mk
index ac7fe9108..c58405cb2 100644
--- a/core/product_config.mk
+++ b/core/product_config.mk
@@ -175,15 +175,9 @@ include $(BUILD_SYSTEM)/node_fns.mk
175include $(BUILD_SYSTEM)/product.mk 175include $(BUILD_SYSTEM)/product.mk
176include $(BUILD_SYSTEM)/device.mk 176include $(BUILD_SYSTEM)/device.mk
177 177
178ifneq ($(strip $(TARGET_BUILD_APPS)),)
179# An unbundled app build needs only the core product makefiles.
180all_product_configs := $(call get-product-makefiles,\
181 $(SRC_TARGET_DIR)/product/AndroidProducts.mk)
182else
183# Read in all of the product definitions specified by the AndroidProducts.mk 178# Read in all of the product definitions specified by the AndroidProducts.mk
184# files in the tree. 179# files in the tree.
185all_product_configs := $(get-all-product-makefiles) 180all_product_configs := $(get-all-product-makefiles)
186endif
187 181
188all_named_products := 182all_named_products :=
189 183
@@ -352,6 +346,11 @@ PRODUCT_SHIPPING_API_LEVEL := $(strip $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SHI
352# used for adding properties to default.prop 346# used for adding properties to default.prop
353PRODUCT_DEFAULT_PROPERTY_OVERRIDES := \ 347PRODUCT_DEFAULT_PROPERTY_OVERRIDES := \
354 $(strip $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_DEFAULT_PROPERTY_OVERRIDES)) 348 $(strip $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_DEFAULT_PROPERTY_OVERRIDES))
349
350$(foreach rule,$(PRODUCT_MANIFEST_PACKAGE_NAME_OVERRIDES),\
351 $(if $(filter 2,$(words $(subst :,$(space),$(rule)))),,\
352 $(error Rule "$(rule)" in PRODUCT_MANIFEST_PACKAGE_NAME_OVERRIDE is not <module_name>:<manifest_name>)))
353
355.KATI_READONLY := PRODUCT_DEFAULT_PROPERTY_OVERRIDES 354.KATI_READONLY := PRODUCT_DEFAULT_PROPERTY_OVERRIDES
356 355
357# A list of property assignments, like "key = value", with zero or more 356# A list of property assignments, like "key = value", with zero or more
@@ -368,6 +367,11 @@ PRODUCT_PRODUCT_PROPERTIES := \
368 $(strip $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_PRODUCT_PROPERTIES)) 367 $(strip $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_PRODUCT_PROPERTIES))
369.KATI_READONLY := PRODUCT_PRODUCT_PROPERTIES 368.KATI_READONLY := PRODUCT_PRODUCT_PROPERTIES
370 369
370ENFORCE_SYSTEM_CERTIFICATE := \
371 $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_ENFORCE_ARTIFACT_SYSTEM_CERTIFICATE_REQUIREMENT)
372
373ENFORCE_SYSTEM_CERTIFICATE_WHITELIST := \
374 $(strip $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_ARTIFACT_SYSTEM_CERTIFICATE_REQUIREMENT_WHITELIST))
371 375
372# A list of property assignments, like "key = value", with zero or more 376# A list of property assignments, like "key = value", with zero or more
373# whitespace characters on either side of the '='. 377# whitespace characters on either side of the '='.
@@ -555,3 +559,10 @@ PRODUCT_FORCE_PRODUCT_MODULES_TO_SYSTEM_PARTITION := \
555# set this variable to prevent OTA failures. 559# set this variable to prevent OTA failures.
556PRODUCT_OTA_ENFORCE_VINTF_KERNEL_REQUIREMENTS := \ 560PRODUCT_OTA_ENFORCE_VINTF_KERNEL_REQUIREMENTS := \
557 $(strip $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_OTA_ENFORCE_VINTF_KERNEL_REQUIREMENTS)) 561 $(strip $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_OTA_ENFORCE_VINTF_KERNEL_REQUIREMENTS))
562
563# List of <module_name>:<manifest_name> pairs to override the manifest package name
564# of a module <module_name> to <manifest_name>. Patterns can be used as in
565# com.android.%:com.acme.android.%.release
566PRODUCT_MANIFEST_PACKAGE_NAME_OVERRIDES := \
567 $(strip $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_MANIFEST_PACKAGE_NAME_OVERRIDES))
568.KATI_READONLY := PRODUCT_MANIFEST_PACKAGE_NAME_OVERRIDES
diff --git a/core/setup_one_odex.mk b/core/setup_one_odex.mk
deleted file mode 100644
index 92f58b2c5..000000000
--- a/core/setup_one_odex.mk
+++ /dev/null
@@ -1,140 +0,0 @@
1#
2# Copyright (C) 2014 The Android Open Source Project
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8# http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15#
16
17# Set up variables and dependency for one odex file
18# Input variables: my_2nd_arch_prefix
19# Output(modified) variables: built_odex, installed_odex, built_installed_odex
20
21my_built_odex := $(call get-odex-file-path,$($(my_2nd_arch_prefix)DEX2OAT_TARGET_ARCH),$(LOCAL_BUILT_MODULE))
22ifdef LOCAL_DEX_PREOPT_IMAGE_LOCATION
23my_dex_preopt_image_location := $(LOCAL_DEX_PREOPT_IMAGE_LOCATION)
24else
25my_dex_preopt_image_location := $($(my_2nd_arch_prefix)DEFAULT_DEX_PREOPT_BUILT_IMAGE_LOCATION)
26endif
27my_dex_preopt_image_filename := $(call get-image-file-path,$($(my_2nd_arch_prefix)DEX2OAT_TARGET_ARCH),$(my_dex_preopt_image_location))
28
29# If LOCAL_ENFORCE_USES_LIBRARIES is not set, default to true if either of LOCAL_USES_LIBRARIES or
30# LOCAL_OPTIONAL_USES_LIBRARIES are specified.
31ifeq (,$(LOCAL_ENFORCE_USES_LIBRARIES))
32# Will change the default to true unconditionally in the future.
33ifneq (,$(LOCAL_OPTIONAL_USES_LIBRARIES))
34LOCAL_ENFORCE_USES_LIBRARIES := true
35endif
36ifneq (,$(LOCAL_USES_LIBRARIES))
37LOCAL_ENFORCE_USES_LIBRARIES := true
38endif
39endif
40
41my_uses_libraries := $(LOCAL_USES_LIBRARIES)
42my_optional_uses_libraries := $(LOCAL_OPTIONAL_USES_LIBRARIES)
43my_missing_uses_libraries := $(INTERNAL_PLATFORM_MISSING_USES_LIBRARIES)
44
45# If we have either optional or required uses-libraries, set up the class loader context
46# accordingly.
47my_lib_names :=
48my_optional_lib_names :=
49my_filtered_optional_uses_libraries :=
50my_system_dependencies :=
51my_stored_preopt_class_loader_context_libs :=
52my_conditional_uses_libraries_host :=
53my_conditional_uses_libraries_target :=
54
55ifneq (true,$(LOCAL_ENFORCE_USES_LIBRARIES))
56 # Pass special class loader context to skip the classpath and collision check.
57 # This will get removed once LOCAL_USES_LIBRARIES is enforced.
58 # Right now LOCAL_USES_LIBRARIES is opt in, for the case where it's not specified we still default
59 # to the &.
60 my_dex_preopt_class_loader_context := \&
61else
62 # Compute the filtered optional uses libraries by removing ones that are not supposed to exist.
63 my_filtered_optional_uses_libraries := \
64 $(filter-out $(my_missing_uses_libraries), $(my_optional_uses_libraries))
65 my_filtered_uses_libraries := $(my_uses_libraries) $(my_filtered_optional_uses_libraries)
66
67 # These are the ones we are verifying in the make rule, use the unfiltered libraries.
68 my_lib_names := $(my_uses_libraries)
69 my_optional_lib_names := $(my_optional_uses_libraries)
70
71 # Calculate system build dependencies based on the filtered libraries.
72 my_intermediate_libs := $(foreach lib_name, $(my_lib_names) $(my_filtered_optional_uses_libraries), \
73 $(call intermediates-dir-for,JAVA_LIBRARIES,$(lib_name),,COMMON)/javalib.jar)
74 my_dex_preopt_system_dependencies := $(my_intermediate_libs)
75 my_dex_preopt_class_loader_context := $(call normalize-path-list,$(my_intermediate_libs))
76
77 # The class loader context checksums are filled in by dex2oat.
78 my_stored_preopt_class_loader_context_libs := $(call normalize-path-list, \
79 $(foreach lib_name,$(my_filtered_uses_libraries),/system/framework/$(lib_name).jar))
80
81 # Fix up org.apache.http.legacy.impl since it should be org.apache.http.legacy in the manifest.
82 my_lib_names := $(patsubst org.apache.http.legacy.impl,org.apache.http.legacy,$(my_lib_names))
83 my_optional_lib_names := $(patsubst org.apache.http.legacy.impl,org.apache.http.legacy,$(my_optional_lib_names))
84 ifeq (,$(filter org.apache.http.legacy,$(my_lib_names) $(my_optional_lib_names)))
85 my_conditional_uses_libraries_host := $(call intermediates-dir-for,JAVA_LIBRARIES,org.apache.http.legacy.impl,,COMMON)/javalib.jar
86 my_conditional_uses_libraries_target := /system/framework/org.apache.http.legacy.impl.jar
87 endif
88endif
89
90$(my_built_odex): $(AAPT)
91$(my_built_odex): $(my_conditional_uses_libraries_host)
92$(my_built_odex): $(my_dex_preopt_system_dependencies)
93$(my_built_odex): PRIVATE_ENFORCE_USES_LIBRARIES := $(LOCAL_ENFORCE_USES_LIBRARIES)
94$(my_built_odex): PRIVATE_CONDITIONAL_USES_LIBRARIES_HOST := $(my_conditional_uses_libraries_host)
95$(my_built_odex): PRIVATE_CONDITIONAL_USES_LIBRARIES_TARGET := $(my_conditional_uses_libraries_target)
96$(my_built_odex): PRIVATE_USES_LIBRARY_NAMES := $(my_lib_names)
97$(my_built_odex): PRIVATE_OPTIONAL_USES_LIBRARY_NAMES := $(my_optional_lib_names)
98$(my_built_odex): PRIVATE_2ND_ARCH_VAR_PREFIX := $(my_2nd_arch_prefix)
99$(my_built_odex): PRIVATE_DEX_LOCATION := $(patsubst $(PRODUCT_OUT)%,%,$(LOCAL_INSTALLED_MODULE))
100$(my_built_odex): PRIVATE_DEX_PREOPT_IMAGE_LOCATION := $(my_dex_preopt_image_location)
101$(my_built_odex): PRIVATE_DEX2OAT_CLASS_LOADER_CONTEXT := $(my_dex_preopt_class_loader_context)
102$(my_built_odex): PRIVATE_DEX2OAT_STORED_CLASS_LOADER_CONTEXT_LIBS := $(my_stored_preopt_class_loader_context_libs)
103$(my_built_odex) : $($(my_2nd_arch_prefix)DEXPREOPT_ONE_FILE_DEPENDENCY_BUILT_BOOT_PREOPT) \
104 $(DEXPREOPT_ONE_FILE_DEPENDENCY_TOOLS) \
105 $(my_dex_preopt_image_filename)
106
107my_installed_odex := $(call get-odex-installed-file-path,$($(my_2nd_arch_prefix)DEX2OAT_TARGET_ARCH),$(LOCAL_INSTALLED_MODULE))
108
109my_built_vdex := $(patsubst %.odex,%.vdex,$(my_built_odex))
110my_installed_vdex := $(patsubst %.odex,%.vdex,$(my_installed_odex))
111my_installed_art := $(patsubst %.odex,%.art,$(my_installed_odex))
112
113ifndef LOCAL_DEX_PREOPT_APP_IMAGE
114# Local override not defined, use the global one.
115ifeq (true,$(WITH_DEX_PREOPT_APP_IMAGE))
116 LOCAL_DEX_PREOPT_APP_IMAGE := true
117endif
118endif
119
120ifeq (true,$(LOCAL_DEX_PREOPT_APP_IMAGE))
121my_built_art := $(patsubst %.odex,%.art,$(my_built_odex))
122$(my_built_odex): PRIVATE_ART_FILE_PREOPT_FLAGS := --app-image-file=$(my_built_art) \
123 --image-format=lz4
124$(eval $(call copy-one-file,$(my_built_art),$(my_installed_art)))
125built_art += $(my_built_art)
126installed_art += $(my_installed_art)
127built_installed_art += $(my_built_art):$(my_installed_art)
128endif
129
130$(eval $(call copy-one-file,$(my_built_odex),$(my_installed_odex)))
131$(eval $(call copy-one-file,$(my_built_vdex),$(my_installed_vdex)))
132
133built_odex += $(my_built_odex)
134built_vdex += $(my_built_vdex)
135
136installed_odex += $(my_installed_odex)
137installed_vdex += $(my_installed_vdex)
138
139built_installed_odex += $(my_built_odex):$(my_installed_odex)
140built_installed_vdex += $(my_built_vdex):$(my_installed_vdex)
diff --git a/core/soong_app_prebuilt.mk b/core/soong_app_prebuilt.mk
index 1440806c5..f7236335b 100644
--- a/core/soong_app_prebuilt.mk
+++ b/core/soong_app_prebuilt.mk
@@ -1,6 +1,16 @@
1# App prebuilt coming from Soong. 1# App prebuilt coming from Soong.
2# Extra inputs: 2# Extra inputs:
3# LOCAL_SOONG_BUILT_INSTALLED
4# LOCAL_SOONG_BUNDLE
5# LOCAL_SOONG_CLASSES_JAR
6# LOCAL_SOONG_DEX_JAR
7# LOCAL_SOONG_HEADER_JAR
8# LOCAL_SOONG_JACOCO_REPORT_CLASSES_JAR
9# LOCAL_SOONG_PROGUARD_DICT
3# LOCAL_SOONG_RESOURCE_EXPORT_PACKAGE 10# LOCAL_SOONG_RESOURCE_EXPORT_PACKAGE
11# LOCAL_SOONG_RRO_DIRS
12# LOCAL_SOONG_JNI_LIBS_$(TARGET_ARCH)
13# LOCAL_SOONG_JNI_LIBS_$(TARGET_2ND_ARCH)
4 14
5ifneq ($(LOCAL_MODULE_MAKEFILE),$(SOONG_ANDROID_MK)) 15ifneq ($(LOCAL_MODULE_MAKEFILE),$(SOONG_ANDROID_MK))
6 $(call pretty-error,soong_app_prebuilt.mk may only be used from Soong) 16 $(call pretty-error,soong_app_prebuilt.mk may only be used from Soong)
@@ -59,28 +69,19 @@ endif # LOCAL_SOONG_RESOURCE_EXPORT_PACKAGE
59 69
60java-dex: $(LOCAL_SOONG_DEX_JAR) 70java-dex: $(LOCAL_SOONG_DEX_JAR)
61 71
62# defines built_odex along with rule to install odex
63include $(BUILD_SYSTEM)/dex_preopt_odex_install.mk
64 72
65ifneq ($(BUILD_PLATFORM_ZIP),) 73ifneq ($(BUILD_PLATFORM_ZIP),)
66 $(eval $(call copy-one-file,$(LOCAL_SOONG_DEX_JAR),$(dir $(LOCAL_BUILT_MODULE))package.dex.apk)) 74 $(eval $(call copy-one-file,$(LOCAL_SOONG_DEX_JAR),$(dir $(LOCAL_BUILT_MODULE))package.dex.apk))
67endif 75endif
68 76
69ifdef LOCAL_DEX_PREOPT 77$(eval $(call copy-one-file,$(LOCAL_PREBUILT_MODULE_FILE),$(LOCAL_BUILT_MODULE)))
70ifdef LOCAL_STRIP_DEX 78
71 # If we have stripped the final APK, use the original jar generated by soong. 79my_built_installed := $(foreach f,$(LOCAL_SOONG_BUILT_INSTALLED),\
72 $(built_odex): $(LOCAL_SOONG_DEX_JAR) 80 $(call word-colon,1,$(f)):$(PRODUCT_OUT)$(call word-colon,2,$(f)))
73 $(call dexpreopt-one-file,$<,$@) 81my_installed := $(call copy-many-files, $(my_built_installed))
74else 82ALL_MODULES.$(my_register_name).INSTALLED += $(my_installed)
75 # If we haven't stripped, use the final APK for dexpreopt, as this may affect how the dex 83ALL_MODULES.$(my_register_name).BUILT_INSTALLED += $(my_built_installed)
76 # code is compiled. 84$(my_register_name): $(my_installed)
77 $(built_odex): $(LOCAL_PREBUILT_MODULE_FILE)
78 $(call dexpreopt-one-file,$<,$@)
79endif # LOCAL_STRIP_DEX
80 $(eval $(call dexpreopt-copy-jar,$(LOCAL_PREBUILT_MODULE_FILE),$(LOCAL_BUILT_MODULE),$(LOCAL_STRIP_DEX)))
81else
82 $(eval $(call copy-one-file,$(LOCAL_PREBUILT_MODULE_FILE),$(LOCAL_BUILT_MODULE)))
83endif
84 85
85# embedded JNI will already have been handled by soong 86# embedded JNI will already have been handled by soong
86my_embed_jni := 87my_embed_jni :=
@@ -107,7 +108,7 @@ ifdef LOCAL_CERTIFICATE
107 PACKAGES.$(LOCAL_MODULE).CERTIFICATE := $(LOCAL_CERTIFICATE) 108 PACKAGES.$(LOCAL_MODULE).CERTIFICATE := $(LOCAL_CERTIFICATE)
108 PACKAGES.$(LOCAL_MODULE).PRIVATE_KEY := $(patsubst %.x509.pem,%.pk8,$(LOCAL_CERTIFICATE)) 109 PACKAGES.$(LOCAL_MODULE).PRIVATE_KEY := $(patsubst %.x509.pem,%.pk8,$(LOCAL_CERTIFICATE))
109endif 110endif
110 111include $(BUILD_SYSTEM)/app_certificate_validate.mk
111PACKAGES.$(LOCAL_MODULE).OVERRIDES := $(strip $(LOCAL_OVERRIDES_PACKAGES)) 112PACKAGES.$(LOCAL_MODULE).OVERRIDES := $(strip $(LOCAL_OVERRIDES_PACKAGES))
112 113
113ifdef LOCAL_SOONG_BUNDLE 114ifdef LOCAL_SOONG_BUNDLE
diff --git a/core/soong_config.mk b/core/soong_config.mk
index 279a612fc..58e1a03ae 100644
--- a/core/soong_config.mk
+++ b/core/soong_config.mk
@@ -13,9 +13,9 @@ BINDER32BIT := true
13endif 13endif
14endif 14endif
15 15
16ifeq ($(WRITE_SOONG_VARIABLES),true) 16include $(BUILD_SYSTEM)/dex_preopt_config.mk
17 17
18include $(BUILD_SYSTEM)/json.mk 18ifeq ($(WRITE_SOONG_VARIABLES),true)
19 19
20# Create soong.variables with copies of makefile settings. Runs every build, 20# Create soong.variables with copies of makefile settings. Runs every build,
21# but only updates soong.variables if it changes 21# but only updates soong.variables if it changes
@@ -36,6 +36,7 @@ $(call add_json_csv, Platform_version_future_codenames, $(PLATFORM_VERSION_FUTU
36 36
37$(call add_json_bool, Allow_missing_dependencies, $(ALLOW_MISSING_DEPENDENCIES)) 37$(call add_json_bool, Allow_missing_dependencies, $(ALLOW_MISSING_DEPENDENCIES))
38$(call add_json_bool, Unbundled_build, $(TARGET_BUILD_APPS)) 38$(call add_json_bool, Unbundled_build, $(TARGET_BUILD_APPS))
39$(call add_json_bool, Unbundled_build_sdks_from_source, $(UNBUNDLED_BUILD_SDKS_FROM_SOURCE))
39$(call add_json_bool, Pdk, $(filter true,$(TARGET_BUILD_PDK))) 40$(call add_json_bool, Pdk, $(filter true,$(TARGET_BUILD_PDK)))
40 41
41$(call add_json_bool, Debuggable, $(filter userdebug eng,$(TARGET_BUILD_VARIANT))) 42$(call add_json_bool, Debuggable, $(filter userdebug eng,$(TARGET_BUILD_VARIANT)))
@@ -106,11 +107,13 @@ $(call add_json_list, DeviceSystemSdkVersions, $(BOARD_SYSTEMSDK_VERSI
106$(call add_json_list, Platform_systemsdk_versions, $(PLATFORM_SYSTEMSDK_VERSIONS)) 107$(call add_json_list, Platform_systemsdk_versions, $(PLATFORM_SYSTEMSDK_VERSIONS))
107$(call add_json_bool, Malloc_not_svelte, $(call invert_bool,$(filter true,$(MALLOC_SVELTE)))) 108$(call add_json_bool, Malloc_not_svelte, $(call invert_bool,$(filter true,$(MALLOC_SVELTE))))
108$(call add_json_str, Override_rs_driver, $(OVERRIDE_RS_DRIVER)) 109$(call add_json_str, Override_rs_driver, $(OVERRIDE_RS_DRIVER))
110
109$(call add_json_bool, UncompressPrivAppDex, $(call invert_bool,$(filter true,$(DONT_UNCOMPRESS_PRIV_APPS_DEXS)))) 111$(call add_json_bool, UncompressPrivAppDex, $(call invert_bool,$(filter true,$(DONT_UNCOMPRESS_PRIV_APPS_DEXS))))
110$(call add_json_list, ModulesLoadedByPrivilegedModules, $(PRODUCT_LOADED_BY_PRIVILEGED_MODULES)) 112$(call add_json_list, ModulesLoadedByPrivilegedModules, $(PRODUCT_LOADED_BY_PRIVILEGED_MODULES))
111$(call add_json_bool, DefaultStripDex, $(call invert_bool,$(filter nostripping,$(DEX_PREOPT_DEFAULT)))) 113
112$(call add_json_bool, DisableDexPreopt, $(filter false,$(WITH_DEXPREOPT))) 114$(call add_json_bool, DisableDexPreopt, $(call invert_bool,$(filter true,$(WITH_DEXPREOPT))))
113$(call add_json_list, DisableDexPreoptModules, $(DEXPREOPT_DISABLED_MODULES)) 115$(call add_json_list, DisableDexPreoptModules, $(DEXPREOPT_DISABLED_MODULES))
116$(call add_json_str, DexPreoptProfileDir, $(PRODUCT_DEX_PREOPT_PROFILE_DIR))
114 117
115$(call add_json_bool, Product_is_iot, $(filter true,$(PRODUCT_IOT))) 118$(call add_json_bool, Product_is_iot, $(filter true,$(PRODUCT_IOT)))
116 119
@@ -139,6 +142,13 @@ $(call add_json_list, BoardPlatPrivateSepolicyDirs, $(BOARD_PLAT_PRIVATE_SE
139 142
140$(call add_json_bool, FlattenApex, $(filter true,$(TARGET_FLATTEN_APEX))) 143$(call add_json_bool, FlattenApex, $(filter true,$(TARGET_FLATTEN_APEX)))
141 144
145$(call add_json_str, DexpreoptGlobalConfig, $(DEX_PREOPT_CONFIG))
146
147$(call add_json_list, ManifestPackageNameOverrides, $(PRODUCT_MANIFEST_PACKAGE_NAME_OVERRIDES))
148
149$(call add_json_bool, EnforceSystemCertificate, $(ENFORCE_SYSTEM_CERTIFICATE))
150$(call add_json_list, EnforceSystemCertificateWhitelist, $(ENFORCE_SYSTEM_CERTIFICATE_WHITELIST))
151
142$(call add_json_map, VendorVars) 152$(call add_json_map, VendorVars)
143$(foreach namespace,$(SOONG_CONFIG_NAMESPACES),\ 153$(foreach namespace,$(SOONG_CONFIG_NAMESPACES),\
144 $(call add_json_map, $(namespace))\ 154 $(call add_json_map, $(namespace))\
diff --git a/core/soong_java_prebuilt.mk b/core/soong_java_prebuilt.mk
index 1642ba7fb..a62590d84 100644
--- a/core/soong_java_prebuilt.mk
+++ b/core/soong_java_prebuilt.mk
@@ -1,5 +1,7 @@
1# Java prebuilt coming from Soong. 1# Java prebuilt coming from Soong.
2# Extra inputs: 2# Extra inputs:
3# LOCAL_SOONG_BUILT_INSTALLED
4# LOCAL_SOONG_CLASSES_JAR
3# LOCAL_SOONG_HEADER_JAR 5# LOCAL_SOONG_HEADER_JAR
4# LOCAL_SOONG_DEX_JAR 6# LOCAL_SOONG_DEX_JAR
5# LOCAL_SOONG_JACOCO_REPORT_CLASSES_JAR 7# LOCAL_SOONG_JACOCO_REPORT_CLASSES_JAR
@@ -22,8 +24,8 @@ common_javalib.jar := $(intermediates.COMMON)/javalib.jar
22hiddenapi_flags_csv := $(intermediates.COMMON)/hiddenapi/flags.csv 24hiddenapi_flags_csv := $(intermediates.COMMON)/hiddenapi/flags.csv
23hiddenapi_metadata_csv := $(intermediates.COMMON)/hiddenapi/greylist.csv 25hiddenapi_metadata_csv := $(intermediates.COMMON)/hiddenapi/greylist.csv
24 26
25$(eval $(call copy-one-file,$(LOCAL_PREBUILT_MODULE_FILE),$(full_classes_jar))) 27$(eval $(call copy-one-file,$(LOCAL_SOONG_CLASSES_JAR),$(full_classes_jar)))
26$(eval $(call copy-one-file,$(LOCAL_PREBUILT_MODULE_FILE),$(full_classes_pre_proguard_jar))) 28$(eval $(call copy-one-file,$(LOCAL_SOONG_CLASSES_JAR),$(full_classes_pre_proguard_jar)))
27 29
28ifdef LOCAL_SOONG_JACOCO_REPORT_CLASSES_JAR 30ifdef LOCAL_SOONG_JACOCO_REPORT_CLASSES_JAR
29 $(eval $(call copy-one-file,$(LOCAL_SOONG_JACOCO_REPORT_CLASSES_JAR),\ 31 $(eval $(call copy-one-file,$(LOCAL_SOONG_JACOCO_REPORT_CLASSES_JAR),\
@@ -80,37 +82,24 @@ ifdef LOCAL_SOONG_DEX_JAR
80 # java.mk. 82 # java.mk.
81 $(eval $(call hiddenapi-generate-csv,$(full_classes_jar),$(hiddenapi_flags_csv),$(hiddenapi_metadata_csv))) 83 $(eval $(call hiddenapi-generate-csv,$(full_classes_jar),$(hiddenapi_flags_csv),$(hiddenapi_metadata_csv)))
82 $(eval $(call hiddenapi-copy-soong-jar,$(LOCAL_SOONG_DEX_JAR),$(common_javalib.jar))) 84 $(eval $(call hiddenapi-copy-soong-jar,$(LOCAL_SOONG_DEX_JAR),$(common_javalib.jar)))
85
86 ifeq (true,$(WITH_DEXPREOPT))
87 # For libart, the boot jars' odex files are replaced by $(DEFAULT_DEX_PREOPT_INSTALLED_IMAGE).
88 # We use this installed_odex trick to get boot.art installed.
89 installed_odex := $(DEFAULT_DEX_PREOPT_INSTALLED_IMAGE)
90 # Append the odex for the 2nd arch if we have one.
91 installed_odex += $($(TARGET_2ND_ARCH_VAR_PREFIX)DEFAULT_DEX_PREOPT_INSTALLED_IMAGE)
92 ALL_MODULES.$(my_register_name).INSTALLED += $(installed_odex)
93 # Make sure to install the .odex and .vdex when you run "make <module_name>"
94 $(my_all_targets): $(installed_odex)
95 endif
83 else # !is_boot_jar 96 else # !is_boot_jar
84 $(eval $(call copy-one-file,$(LOCAL_SOONG_DEX_JAR),$(common_javalib.jar))) 97 $(eval $(call copy-one-file,$(LOCAL_SOONG_DEX_JAR),$(common_javalib.jar)))
85 endif # is_boot_jar 98 endif # is_boot_jar
86 $(eval $(call add-dependency,$(common_javalib.jar),$(full_classes_jar) $(full_classes_header_jar))) 99 $(eval $(call add-dependency,$(common_javalib.jar),$(full_classes_jar) $(full_classes_header_jar)))
87 100
88 dex_preopt_profile_src_file := $(common_javalib.jar) 101 $(eval $(call copy-one-file,$(LOCAL_PREBUILT_MODULE_FILE),$(LOCAL_BUILT_MODULE)))
89 102 $(eval $(call add-dependency,$(LOCAL_BUILT_MODULE),$(common_javalib.jar)))
90 # defines built_odex along with rule to install odex
91 include $(BUILD_SYSTEM)/dex_preopt_odex_install.mk
92
93 dex_preopt_profile_src_file :=
94
95 ifdef LOCAL_DEX_PREOPT
96 ifneq ($(dexpreopt_boot_jar_module),) # boot jar
97 # boot jar's rules are defined in dex_preopt.mk
98 dexpreopted_boot_jar := $(DEXPREOPT_BOOT_JAR_DIR_FULL_PATH)/$(dexpreopt_boot_jar_module)_nodex.jar
99 $(eval $(call copy-one-file,$(dexpreopted_boot_jar),$(LOCAL_BUILT_MODULE)))
100
101 # For libart boot jars, we don't have .odex files.
102 else # ! boot jar
103 $(built_odex): PRIVATE_MODULE := $(LOCAL_MODULE)
104 # Use pattern rule - we may have multiple built odex files.
105$(built_odex) : $(dir $(LOCAL_BUILT_MODULE))% : $(common_javalib.jar)
106 @echo "Dexpreopt Jar: $(PRIVATE_MODULE) ($@)"
107 $(call dexpreopt-one-file,$<,$@)
108
109 $(eval $(call dexpreopt-copy-jar,$(common_javalib.jar),$(LOCAL_BUILT_MODULE),$(LOCAL_STRIP_DEX)))
110 endif # ! boot jar
111 else # LOCAL_DEX_PREOPT
112 $(eval $(call copy-one-file,$(common_javalib.jar),$(LOCAL_BUILT_MODULE)))
113 endif # LOCAL_DEX_PREOPT
114 else # LOCAL_IS_HOST_MODULE 103 else # LOCAL_IS_HOST_MODULE
115 $(eval $(call copy-one-file,$(LOCAL_SOONG_DEX_JAR),$(LOCAL_BUILT_MODULE))) 104 $(eval $(call copy-one-file,$(LOCAL_SOONG_DEX_JAR),$(LOCAL_BUILT_MODULE)))
116 $(eval $(call add-dependency,$(LOCAL_BUILT_MODULE),$(full_classes_jar) $(full_classes_header_jar))) 105 $(eval $(call add-dependency,$(LOCAL_BUILT_MODULE),$(full_classes_jar) $(full_classes_header_jar)))
@@ -135,6 +124,13 @@ else # LOCAL_SOONG_DEX_JAR
135 $(eval $(call copy-one-file,$(full_classes_jar),$(LOCAL_BUILT_MODULE))) 124 $(eval $(call copy-one-file,$(full_classes_jar),$(LOCAL_BUILT_MODULE)))
136endif # LOCAL_SOONG_DEX_JAR 125endif # LOCAL_SOONG_DEX_JAR
137 126
127my_built_installed := $(foreach f,$(LOCAL_SOONG_BUILT_INSTALLED),\
128 $(call word-colon,1,$(f)):$(PRODUCT_OUT)$(call word-colon,2,$(f)))
129my_installed := $(call copy-many-files, $(my_built_installed))
130ALL_MODULES.$(my_register_name).INSTALLED += $(my_installed)
131ALL_MODULES.$(my_register_name).BUILT_INSTALLED += $(my_built_installed)
132$(my_register_name): $(my_installed)
133
138ifdef LOCAL_SOONG_AAR 134ifdef LOCAL_SOONG_AAR
139 ALL_MODULES.$(LOCAL_MODULE).AAR := $(LOCAL_SOONG_AAR) 135 ALL_MODULES.$(LOCAL_MODULE).AAR := $(LOCAL_SOONG_AAR)
140endif 136endif
diff --git a/core/static_java_library.mk b/core/static_java_library.mk
index 2a8770503..cee7c9edf 100644
--- a/core/static_java_library.mk
+++ b/core/static_java_library.mk
@@ -110,7 +110,7 @@ endif
110framework_res_package_export := 110framework_res_package_export :=
111# Please refer to package.mk 111# Please refer to package.mk
112ifneq ($(LOCAL_NO_STANDARD_LIBRARIES),true) 112ifneq ($(LOCAL_NO_STANDARD_LIBRARIES),true)
113ifneq ($(filter-out current system_current test_current,$(LOCAL_SDK_RES_VERSION))$(if $(TARGET_BUILD_APPS),$(filter current system_current test_current,$(LOCAL_SDK_RES_VERSION))),) 113ifneq ($(filter-out current system_current test_current,$(LOCAL_SDK_RES_VERSION))$(if $(TARGET_BUILD_APPS_USE_PREBUILT_SDK),$(filter current system_current test_current,$(LOCAL_SDK_RES_VERSION))),)
114framework_res_package_export := \ 114framework_res_package_export := \
115 $(call resolve-prebuilt-sdk-jar-path,$(LOCAL_SDK_RES_VERSION)) 115 $(call resolve-prebuilt-sdk-jar-path,$(LOCAL_SDK_RES_VERSION))
116else 116else
diff --git a/core/version_defaults.mk b/core/version_defaults.mk
index 42a3beab6..c4f9a5229 100644
--- a/core/version_defaults.mk
+++ b/core/version_defaults.mk
@@ -179,8 +179,11 @@ else
179 # SDK version the package was built for, otherwise it should fall back to 179 # SDK version the package was built for, otherwise it should fall back to
180 # assuming the device can only support APIs as of the previous official 180 # assuming the device can only support APIs as of the previous official
181 # public release. 181 # public release.
182 # This value will always be 0 for release builds. 182 # This value will always be forced to 0 for release builds by the logic
183 PLATFORM_PREVIEW_SDK_VERSION := 0 183 # in the "ifeq" block above, so the value below will be used on any
184 # non-release builds, and it should always be at least 1, to indicate that
185 # APIs may have changed since the claimed PLATFORM_SDK_VERSION.
186 PLATFORM_PREVIEW_SDK_VERSION := 1
184 endif 187 endif
185endif 188endif
186.KATI_READONLY := PLATFORM_PREVIEW_SDK_VERSION 189.KATI_READONLY := PLATFORM_PREVIEW_SDK_VERSION
@@ -249,7 +252,7 @@ ifndef PLATFORM_SECURITY_PATCH
249 # It must be of the form "YYYY-MM-DD" on production devices. 252 # It must be of the form "YYYY-MM-DD" on production devices.
250 # It must match one of the Android Security Patch Level strings of the Public Security Bulletins. 253 # It must match one of the Android Security Patch Level strings of the Public Security Bulletins.
251 # If there is no $PLATFORM_SECURITY_PATCH set, keep it empty. 254 # If there is no $PLATFORM_SECURITY_PATCH set, keep it empty.
252 PLATFORM_SECURITY_PATCH := 2018-09-05 255 PLATFORM_SECURITY_PATCH := 2018-12-05
253endif 256endif
254.KATI_READONLY := PLATFORM_SECURITY_PATCH 257.KATI_READONLY := PLATFORM_SECURITY_PATCH
255 258
@@ -311,7 +314,7 @@ ifndef BUILD_NUMBER
311 # If no BUILD_NUMBER is set, create a useful "I am an engineering build 314 # If no BUILD_NUMBER is set, create a useful "I am an engineering build
312 # from this date/time" value. Make it start with a non-digit so that 315 # from this date/time" value. Make it start with a non-digit so that
313 # anyone trying to parse it as an integer will probably get "0". 316 # anyone trying to parse it as an integer will probably get "0".
314 BUILD_NUMBER := eng.$(shell echo $${USER:0:6}).$(shell $(DATE) +%Y%m%d.%H%M%S) 317 BUILD_NUMBER := eng.$(shell echo $${BUILD_USERNAME:0:6}).$(shell $(DATE) +%Y%m%d.%H%M%S)
315 HAS_BUILD_NUMBER := false 318 HAS_BUILD_NUMBER := false
316endif 319endif
317.KATI_READONLY := BUILD_NUMBER HAS_BUILD_NUMBER 320.KATI_READONLY := BUILD_NUMBER HAS_BUILD_NUMBER
diff --git a/envsetup.sh b/envsetup.sh
index a1d6e39c0..62a64b605 100644
--- a/envsetup.sh
+++ b/envsetup.sh
@@ -266,7 +266,14 @@ function setpaths()
266 fi 266 fi
267 267
268 export PATH=$ANDROID_BUILD_PATHS$PATH 268 export PATH=$ANDROID_BUILD_PATHS$PATH
269 export PYTHONPATH=$T/development/python-packages:$PYTHONPATH 269
270 # out with the duplicate old
271 if [ -n $ANDROID_PYTHONPATH ]; then
272 export PYTHONPATH=${PYTHONPATH//$ANDROID_PYTHONPATH/}
273 fi
274 # and in with the new
275 export ANDROID_PYTHONPATH=$T/development/python-packages:
276 export PYTHONPATH=$ANDROID_PYTHONPATH$PYTHONPATH
270 277
271 export ANDROID_JAVA_HOME=$(get_abs_build_var ANDROID_JAVA_HOME) 278 export ANDROID_JAVA_HOME=$(get_abs_build_var ANDROID_JAVA_HOME)
272 export JAVA_HOME=$ANDROID_JAVA_HOME 279 export JAVA_HOME=$ANDROID_JAVA_HOME
@@ -363,8 +370,8 @@ function addcompletions()
363 fi 370 fi
364 complete -F _lunch lunch 371 complete -F _lunch lunch
365 372
366 complete -F _complete-android-module-names gomod 373 complete -F _complete_android_module_names gomod
367 complete -F _complete-android-module-names m 374 complete -F _complete_android_module_names m
368} 375}
369 376
370function choosetype() 377function choosetype()
@@ -765,6 +772,9 @@ function findmakefile()
765{ 772{
766 local TOPFILE=build/make/core/envsetup.mk 773 local TOPFILE=build/make/core/envsetup.mk
767 local HERE=$PWD 774 local HERE=$PWD
775 if [ "$1" ]; then
776 \cd $1
777 fi;
768 local T= 778 local T=
769 while [ \( ! \( -f $TOPFILE \) \) -a \( $PWD != "/" \) ]; do 779 while [ \( ! \( -f $TOPFILE \) \) -a \( $PWD != "/" \) ]; do
770 T=`PWD= /bin/pwd` 780 T=`PWD= /bin/pwd`
@@ -845,24 +855,29 @@ function mmm()
845 # Remove the leading ./ and trailing / if any exists. 855 # Remove the leading ./ and trailing / if any exists.
846 DIR=${DIR#./} 856 DIR=${DIR#./}
847 DIR=${DIR%/} 857 DIR=${DIR%/}
848 if [ -f $DIR/Android.mk -o -f $DIR/Android.bp ]; then 858 local M
849 local TO_CHOP=`(\cd -P -- $T && pwd -P) | wc -c | tr -d ' '` 859 if [ "$DIR_MODULES" = "" ]; then
850 local TO_CHOP=`expr $TO_CHOP + 1` 860 M=$(findmakefile $DIR)
851 local START=`PWD= /bin/pwd` 861 else
852 local MDIR=`echo $START | cut -c${TO_CHOP}-` 862 # Only check the target directory if a module is specified.
853 if [ "$MDIR" = "" ] ; then 863 if [ -f $DIR/Android.mk -o -f $DIR/Android.bp ]; then
854 MDIR=$DIR 864 local HERE=$PWD
855 else 865 cd $DIR
856 MDIR=$MDIR/$DIR 866 M=`PWD= /bin/pwd`
867 M=$M/Android.mk
868 cd $HERE
857 fi 869 fi
858 MDIR=${MDIR%/.} 870 fi
871 if [ "$M" ]; then
872 # Remove the path to top as the makefilepath needs to be relative
873 local M=`echo $M|sed 's:'$T'/::'`
859 if [ "$DIR_MODULES" = "" ]; then 874 if [ "$DIR_MODULES" = "" ]; then
860 MODULES_IN_PATHS="$MODULES_IN_PATHS MODULES-IN-$MDIR" 875 MODULES_IN_PATHS="$MODULES_IN_PATHS MODULES-IN-$(dirname ${M})"
861 GET_INSTALL_PATHS="$GET_INSTALL_PATHS GET-INSTALL-PATH-IN-$MDIR" 876 GET_INSTALL_PATHS="$GET_INSTALL_PATHS GET-INSTALL-PATH-IN-$(dirname ${M})"
862 else 877 else
863 MODULES="$MODULES $DIR_MODULES" 878 MODULES="$MODULES $DIR_MODULES"
864 fi 879 fi
865 MAKEFILE="$MAKEFILE $MDIR/Android.mk" 880 MAKEFILE="$MAKEFILE $M"
866 else 881 else
867 case $DIR in 882 case $DIR in
868 showcommands | snod | dist | *=*) ARGS="$ARGS $DIR";; 883 showcommands | snod | dist | *=*) ARGS="$ARGS $DIR";;
@@ -1535,7 +1550,7 @@ print module_info[module]['path'][0]" 2>/dev/null)
1535 fi 1550 fi
1536} 1551}
1537 1552
1538function _complete-android-module-names() { 1553function _complete_android_module_names() {
1539 local word=${COMP_WORDS[COMP_CWORD]} 1554 local word=${COMP_WORDS[COMP_CWORD]}
1540 COMPREPLY=( $(allmod | grep -E "^$word") ) 1555 COMPREPLY=( $(allmod | grep -E "^$word") )
1541} 1556}
diff --git a/target/Android.mk b/target/Android.mk
deleted file mode 100644
index 9929b0096..000000000
--- a/target/Android.mk
+++ /dev/null
@@ -1,23 +0,0 @@
1#
2# Copyright (C) 2017 The Android Open Source Project
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8# http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15#
16
17LOCAL_PATH := $(call my-dir)
18
19# Only if this Android.mk was included not by a symlink should it be used.
20# This facilitates the transition away from symlinks: b/64397960
21ifeq ($(LOCAL_PATH),build/make/target)
22include $(call first-makefiles-under,$(LOCAL_PATH))
23endif
diff --git a/target/OWNERS b/target/OWNERS
new file mode 100644
index 000000000..feb274262
--- /dev/null
+++ b/target/OWNERS
@@ -0,0 +1 @@
hansson@google.com
diff --git a/target/board/BoardConfigEmuCommon.mk b/target/board/BoardConfigEmuCommon.mk
index 38f79fdcd..1e325b949 100644
--- a/target/board/BoardConfigEmuCommon.mk
+++ b/target/board/BoardConfigEmuCommon.mk
@@ -20,8 +20,6 @@ BUILD_QEMU_IMAGES := true
20# the GLES renderer disables itself if host GL acceleration isn't available. 20# the GLES renderer disables itself if host GL acceleration isn't available.
21USE_OPENGL_RENDERER := true 21USE_OPENGL_RENDERER := true
22 22
23TARGET_COPY_OUT_VENDOR := vendor
24
25# ~100 MB vendor image. Please adjust system image / vendor image sizes 23# ~100 MB vendor image. Please adjust system image / vendor image sizes
26# when finalizing them. The partition size needs to be a multiple of image 24# when finalizing them. The partition size needs to be a multiple of image
27# block size: 4096. 25# block size: 4096.
@@ -31,4 +29,4 @@ BOARD_FLASH_BLOCK_SIZE := 512
31DEVICE_MATRIX_FILE := device/generic/goldfish/compatibility_matrix.xml 29DEVICE_MATRIX_FILE := device/generic/goldfish/compatibility_matrix.xml
32 30
33BOARD_SEPOLICY_DIRS += device/generic/goldfish/sepolicy/common 31BOARD_SEPOLICY_DIRS += device/generic/goldfish/sepolicy/common
34BOARD_PROPERTY_OVERRIDES_SPLIT_ENABLED := true 32
diff --git a/target/board/BoardConfigGsiCommon.mk b/target/board/BoardConfigGsiCommon.mk
index 73af0201a..f9e9ee100 100644
--- a/target/board/BoardConfigGsiCommon.mk
+++ b/target/board/BoardConfigGsiCommon.mk
@@ -6,6 +6,9 @@
6 6
7include build/make/target/board/BoardConfigMainlineCommon.mk 7include build/make/target/board/BoardConfigMainlineCommon.mk
8 8
9# Enable system property split for Treble
10BOARD_PROPERTY_OVERRIDES_SPLIT_ENABLED := true
11
9# This flag is set by mainline but isn't desired for GSI. 12# This flag is set by mainline but isn't desired for GSI.
10BOARD_USES_SYSTEM_OTHER_ODEX := 13BOARD_USES_SYSTEM_OTHER_ODEX :=
11 14
@@ -14,9 +17,21 @@ BOARD_USES_SYSTEM_OTHER_ODEX :=
14# we explicit specify this need below (even though it's the current default). 17# we explicit specify this need below (even though it's the current default).
15TARGET_USERIMAGES_SPARSE_EXT_DISABLED := false 18TARGET_USERIMAGES_SPARSE_EXT_DISABLED := false
16 19
20# system.img is always ext4 with sparse option
21# GSI also includes make_f2fs to support userdata parition in f2fs
22# for some devices
23TARGET_USERIMAGES_USE_F2FS := true
24
17# Enable dynamic system image size and reserved 64MB in it. 25# Enable dynamic system image size and reserved 64MB in it.
18BOARD_SYSTEMIMAGE_PARTITION_RESERVED_SIZE := 67108864 26BOARD_SYSTEMIMAGE_PARTITION_RESERVED_SIZE := 67108864
19 27
28# GSI always requires separate vendor packages to vendor.img
29TARGET_COPY_OUT_VENDOR := vendor
30
31# Creates metadata partition mount point under root for
32# the devices with metadata parition
33BOARD_USES_METADATA_PARTITION := true
34
20# Android Verified Boot (AVB): 35# Android Verified Boot (AVB):
21# Set AVB_VBMETA_IMAGE_FLAGS_VERIFICATION_DISABLED (--flag 2) in 36# Set AVB_VBMETA_IMAGE_FLAGS_VERIFICATION_DISABLED (--flag 2) in
22# vbmeta.img to disable AVB verification. 37# vbmeta.img to disable AVB verification.
@@ -32,15 +47,13 @@ BOARD_AVB_SYSTEM_ALGORITHM := SHA256_RSA2048
32BOARD_AVB_SYSTEM_ROLLBACK_INDEX := $(PLATFORM_SECURITY_PATCH_TIMESTAMP) 47BOARD_AVB_SYSTEM_ROLLBACK_INDEX := $(PLATFORM_SECURITY_PATCH_TIMESTAMP)
33BOARD_AVB_SYSTEM_ROLLBACK_INDEX_LOCATION := 1 48BOARD_AVB_SYSTEM_ROLLBACK_INDEX_LOCATION := 1
34 49
50# GSI specific System Properties
35ifneq (,$(filter userdebug eng,$(TARGET_BUILD_VARIANT))) 51ifneq (,$(filter userdebug eng,$(TARGET_BUILD_VARIANT)))
36# GSI is always userdebug and needs a couple of properties taking precedence 52# GSI is always userdebug and needs a couple of properties taking precedence
37# over those set by the vendor. 53# over those set by the vendor.
38TARGET_SYSTEM_PROP := build/make/target/board/gsi_system.prop 54TARGET_SYSTEM_PROP := build/make/target/board/gsi_system.prop
39endif 55endif
40 56
41# Android generic system image always create metadata partition
42BOARD_USES_METADATA_PARTITION := true
43
44# Set this to create /cache mount point for non-A/B devices that mounts /cache. 57# Set this to create /cache mount point for non-A/B devices that mounts /cache.
45# The partition size doesn't matter, just to make build pass. 58# The partition size doesn't matter, just to make build pass.
46BOARD_CACHEIMAGE_FILE_SYSTEM_TYPE := ext4 59BOARD_CACHEIMAGE_FILE_SYSTEM_TYPE := ext4
diff --git a/target/board/generic/BoardConfig.mk b/target/board/generic/BoardConfig.mk
index 738c03731..cdb1d298c 100644
--- a/target/board/generic/BoardConfig.mk
+++ b/target/board/generic/BoardConfig.mk
@@ -16,9 +16,10 @@
16# arm emulator specific definitions 16# arm emulator specific definitions
17TARGET_ARCH := arm 17TARGET_ARCH := arm
18 18
19# Note: Before Pi, we built the platform images for ARMv7-A _without_ NEON. 19# Note: Before P, we built the platform images for ARMv7-A _without_ NEON.
20# Note: Before Q, we built the CTS and SDK images for ARMv7-A _without_ NEON.
20# 21#
21ifneq ($(TARGET_BUILD_APPS)$(filter cts sdk,$(MAKECMDGOALS)),) 22ifneq ($(TARGET_BUILD_APPS),)
22# DO NOT USE 23# DO NOT USE
23# 24#
24# This architecture variant should NOT be used for 32 bit arm platform 25# This architecture variant should NOT be used for 32 bit arm platform
diff --git a/target/board/generic_arm64/BoardConfig.mk b/target/board/generic_arm64/BoardConfig.mk
index 1b6429c31..3331d1827 100644
--- a/target/board/generic_arm64/BoardConfig.mk
+++ b/target/board/generic_arm64/BoardConfig.mk
@@ -23,7 +23,7 @@ TARGET_2ND_ARCH := arm
23TARGET_2ND_CPU_ABI := armeabi-v7a 23TARGET_2ND_CPU_ABI := armeabi-v7a
24TARGET_2ND_CPU_ABI2 := armeabi 24TARGET_2ND_CPU_ABI2 := armeabi
25 25
26ifneq ($(TARGET_BUILD_APPS)$(filter cts vts sdk,$(MAKECMDGOALS)),) 26ifneq ($(TARGET_BUILD_APPS)$(filter cts sdk vts,$(MAKECMDGOALS)),)
27# DO NOT USE 27# DO NOT USE
28# DO NOT USE 28# DO NOT USE
29# 29#
@@ -41,7 +41,11 @@ ifneq ($(TARGET_BUILD_APPS)$(filter cts vts sdk,$(MAKECMDGOALS)),)
41# 41#
42# DO NOT USE 42# DO NOT USE
43# DO NOT USE 43# DO NOT USE
44ifneq ($(filter cts sdk vts,$(MAKECMDGOALS)),)
45TARGET_2ND_ARCH_VARIANT := armv7-a-neon
46else
44TARGET_2ND_ARCH_VARIANT := armv7-a 47TARGET_2ND_ARCH_VARIANT := armv7-a
48endif
45# DO NOT USE 49# DO NOT USE
46# DO NOT USE 50# DO NOT USE
47TARGET_2ND_CPU_VARIANT := generic 51TARGET_2ND_CPU_VARIANT := generic
diff --git a/target/board/generic_arm64_a/BoardConfig.mk b/target/board/generic_arm64_a/BoardConfig.mk
index 34a8ac001..68aedfc1a 100644
--- a/target/board/generic_arm64_a/BoardConfig.mk
+++ b/target/board/generic_arm64_a/BoardConfig.mk
@@ -14,7 +14,7 @@
14# limitations under the License. 14# limitations under the License.
15# 15#
16 16
17include build/make/target/board/treble_common_64.mk 17include build/make/target/board/BoardConfigGsiCommon.mk
18 18
19TARGET_ARCH := arm64 19TARGET_ARCH := arm64
20TARGET_ARCH_VARIANT := armv8-a 20TARGET_ARCH_VARIANT := armv8-a
@@ -27,3 +27,6 @@ TARGET_2ND_ARCH_VARIANT := armv8-a
27TARGET_2ND_CPU_ABI := armeabi-v7a 27TARGET_2ND_CPU_ABI := armeabi-v7a
28TARGET_2ND_CPU_ABI2 := armeabi 28TARGET_2ND_CPU_ABI2 := armeabi
29TARGET_2ND_CPU_VARIANT := generic 29TARGET_2ND_CPU_VARIANT := generic
30
31# This is a non-system-as-root Legacy GSI build target
32BOARD_BUILD_SYSTEM_ROOT_IMAGE := false
diff --git a/target/board/generic_arm64_ab/BoardConfig.mk b/target/board/generic_arm64_ab/BoardConfig.mk
index 88b90a8fb..6e54d810b 100644
--- a/target/board/generic_arm64_ab/BoardConfig.mk
+++ b/target/board/generic_arm64_ab/BoardConfig.mk
@@ -14,7 +14,7 @@
14# limitations under the License. 14# limitations under the License.
15# 15#
16 16
17include build/make/target/board/treble_common_64.mk 17include build/make/target/board/BoardConfigGsiCommon.mk
18 18
19TARGET_ARCH := arm64 19TARGET_ARCH := arm64
20TARGET_ARCH_VARIANT := armv8-a 20TARGET_ARCH_VARIANT := armv8-a
@@ -28,21 +28,12 @@ TARGET_2ND_CPU_ABI := armeabi-v7a
28TARGET_2ND_CPU_ABI2 := armeabi 28TARGET_2ND_CPU_ABI2 := armeabi
29TARGET_2ND_CPU_VARIANT := generic 29TARGET_2ND_CPU_VARIANT := generic
30 30
31# Enable A/B update
32TARGET_NO_RECOVERY := true
33BOARD_BUILD_SYSTEM_ROOT_IMAGE := true
34
35# TODO(jiyong) These might be SoC specific. 31# TODO(jiyong) These might be SoC specific.
36BOARD_ROOT_EXTRA_FOLDERS += firmware firmware/radio persist 32BOARD_ROOT_EXTRA_FOLDERS += firmware firmware/radio persist
37BOARD_ROOT_EXTRA_SYMLINKS += /vendor/lib/dsp:/dsp 33BOARD_ROOT_EXTRA_SYMLINKS += /vendor/lib/dsp:/dsp
38BOARD_ROOT_EXTRA_SYMLINKS += /vendor/firmware_mnt/image:/firmware/image 34BOARD_ROOT_EXTRA_SYMLINKS += /vendor/firmware_mnt/image:/firmware/image
39BOARD_ROOT_EXTRA_SYMLINKS += /vendor/firmware_mnt/verinfo:/firmware/verinfo 35BOARD_ROOT_EXTRA_SYMLINKS += /vendor/firmware_mnt/verinfo:/firmware/verinfo
40 36
41# Set this to create /cache mount point for non-A/B devices that mounts /cache.
42# The partition size doesn't matter, just to make build pass.
43BOARD_CACHEIMAGE_FILE_SYSTEM_TYPE := ext4
44BOARD_CACHEIMAGE_PARTITION_SIZE := 16777216
45
46# TODO(b/36764215): remove this setting when the generic system image 37# TODO(b/36764215): remove this setting when the generic system image
47# no longer has QCOM-specific directories under /. 38# no longer has QCOM-specific directories under /.
48BOARD_SEPOLICY_DIRS += build/target/board/generic_arm64_ab/sepolicy 39BOARD_SEPOLICY_DIRS += build/target/board/generic_arm64_ab/sepolicy
diff --git a/target/board/generic_arm_a/BoardConfig.mk b/target/board/generic_arm_a/BoardConfig.mk
index 57a5196a9..464a74f1e 100644
--- a/target/board/generic_arm_a/BoardConfig.mk
+++ b/target/board/generic_arm_a/BoardConfig.mk
@@ -14,10 +14,16 @@
14# limitations under the License. 14# limitations under the License.
15# 15#
16 16
17include build/make/target/board/treble_common_32.mk 17include build/make/target/board/BoardConfigGsiCommon.mk
18 18
19TARGET_ARCH := arm 19TARGET_ARCH := arm
20TARGET_ARCH_VARIANT := armv7-a-neon 20TARGET_ARCH_VARIANT := armv7-a-neon
21TARGET_CPU_ABI := armeabi-v7a 21TARGET_CPU_ABI := armeabi-v7a
22TARGET_CPU_ABI2 := armeabi 22TARGET_CPU_ABI2 := armeabi
23TARGET_CPU_VARIANT := generic 23TARGET_CPU_VARIANT := generic
24
25# Legacy GSI keeps 32 bits binder for 32 bits CPU Arch
26TARGET_USES_64_BIT_BINDER := false
27
28# This is a non-system-as-root Legacy GSI build target
29BOARD_BUILD_SYSTEM_ROOT_IMAGE := false
diff --git a/target/board/generic_arm_ab/BoardConfig.mk b/target/board/generic_arm_ab/BoardConfig.mk
index 3d1484290..9100094f8 100644
--- a/target/board/generic_arm_ab/BoardConfig.mk
+++ b/target/board/generic_arm_ab/BoardConfig.mk
@@ -14,7 +14,7 @@
14# limitations under the License. 14# limitations under the License.
15# 15#
16 16
17include build/make/target/board/treble_common_32.mk 17include build/make/target/board/BoardConfigGsiCommon.mk
18 18
19TARGET_ARCH := arm 19TARGET_ARCH := arm
20TARGET_ARCH_VARIANT := armv7-a-neon 20TARGET_ARCH_VARIANT := armv7-a-neon
@@ -22,9 +22,8 @@ TARGET_CPU_ABI := armeabi-v7a
22TARGET_CPU_ABI2 := armeabi 22TARGET_CPU_ABI2 := armeabi
23TARGET_CPU_VARIANT := generic 23TARGET_CPU_VARIANT := generic
24 24
25# Enable A/B update 25# Legacy GSI keeps 32 bits binder for 32 bits CPU Arch
26TARGET_NO_RECOVERY := true 26TARGET_USES_64_BIT_BINDER := false
27BOARD_BUILD_SYSTEM_ROOT_IMAGE := true
28 27
29# TODO(jiyong) These might be SoC specific. 28# TODO(jiyong) These might be SoC specific.
30BOARD_ROOT_EXTRA_FOLDERS += firmware firmware/radio persist 29BOARD_ROOT_EXTRA_FOLDERS += firmware firmware/radio persist
@@ -32,11 +31,6 @@ BOARD_ROOT_EXTRA_SYMLINKS += /vendor/lib/dsp:/dsp
32BOARD_ROOT_EXTRA_SYMLINKS += /vendor/firmware_mnt/image:/firmware/image 31BOARD_ROOT_EXTRA_SYMLINKS += /vendor/firmware_mnt/image:/firmware/image
33BOARD_ROOT_EXTRA_SYMLINKS += /vendor/firmware_mnt/verinfo:/firmware/verinfo 32BOARD_ROOT_EXTRA_SYMLINKS += /vendor/firmware_mnt/verinfo:/firmware/verinfo
34 33
35# Set this to create /cache mount point for non-A/B devices that mounts /cache.
36# The partition size doesn't matter, just to make build pass.
37BOARD_CACHEIMAGE_FILE_SYSTEM_TYPE := ext4
38BOARD_CACHEIMAGE_PARTITION_SIZE := 16777216
39
40# TODO(b/36764215): remove this setting when the generic system image 34# TODO(b/36764215): remove this setting when the generic system image
41# no longer has QCOM-specific directories under /. 35# no longer has QCOM-specific directories under /.
42BOARD_SEPOLICY_DIRS += build/target/board/generic_arm64_ab/sepolicy 36BOARD_SEPOLICY_DIRS += build/target/board/generic_arm64_ab/sepolicy
diff --git a/target/board/generic_x86_64_a/BoardConfig.mk b/target/board/generic_x86_64_a/BoardConfig.mk
index 2c0260439..07eef4f42 100644
--- a/target/board/generic_x86_64_a/BoardConfig.mk
+++ b/target/board/generic_x86_64_a/BoardConfig.mk
@@ -14,7 +14,7 @@
14# limitations under the License. 14# limitations under the License.
15# 15#
16 16
17include build/make/target/board/treble_common_64.mk 17include build/make/target/board/BoardConfigGsiCommon.mk
18 18
19TARGET_CPU_ABI := x86_64 19TARGET_CPU_ABI := x86_64
20TARGET_ARCH := x86_64 20TARGET_ARCH := x86_64
@@ -23,3 +23,6 @@ TARGET_ARCH_VARIANT := x86_64
23TARGET_2ND_CPU_ABI := x86 23TARGET_2ND_CPU_ABI := x86
24TARGET_2ND_ARCH := x86 24TARGET_2ND_ARCH := x86
25TARGET_2ND_ARCH_VARIANT := x86_64 25TARGET_2ND_ARCH_VARIANT := x86_64
26
27# This is a non-system-as-root Legacy GSI build target
28BOARD_BUILD_SYSTEM_ROOT_IMAGE := false
diff --git a/target/board/generic_x86_64_ab/BoardConfig.mk b/target/board/generic_x86_64_ab/BoardConfig.mk
index a098dfe2a..1dd5e4898 100644
--- a/target/board/generic_x86_64_ab/BoardConfig.mk
+++ b/target/board/generic_x86_64_ab/BoardConfig.mk
@@ -14,7 +14,7 @@
14# limitations under the License. 14# limitations under the License.
15# 15#
16 16
17include build/make/target/board/treble_common_64.mk 17include build/make/target/board/BoardConfigGsiCommon.mk
18 18
19TARGET_CPU_ABI := x86_64 19TARGET_CPU_ABI := x86_64
20TARGET_ARCH := x86_64 20TARGET_ARCH := x86_64
@@ -23,12 +23,3 @@ TARGET_ARCH_VARIANT := x86_64
23TARGET_2ND_CPU_ABI := x86 23TARGET_2ND_CPU_ABI := x86
24TARGET_2ND_ARCH := x86 24TARGET_2ND_ARCH := x86
25TARGET_2ND_ARCH_VARIANT := x86_64 25TARGET_2ND_ARCH_VARIANT := x86_64
26
27# Set this to create /cache mount point for non-A/B devices that mounts /cache.
28# The partition size doesn't matter, just to make build pass.
29BOARD_CACHEIMAGE_FILE_SYSTEM_TYPE := ext4
30BOARD_CACHEIMAGE_PARTITION_SIZE := 16777216
31
32# Enable A/B update
33TARGET_NO_RECOVERY := true
34BOARD_BUILD_SYSTEM_ROOT_IMAGE := true
diff --git a/target/board/generic_x86_a/BoardConfig.mk b/target/board/generic_x86_a/BoardConfig.mk
index 67cb07d7f..e3e8a3afe 100644
--- a/target/board/generic_x86_a/BoardConfig.mk
+++ b/target/board/generic_x86_a/BoardConfig.mk
@@ -14,8 +14,14 @@
14# limitations under the License. 14# limitations under the License.
15# 15#
16 16
17include build/make/target/board/treble_common_32.mk 17include build/make/target/board/BoardConfigGsiCommon.mk
18 18
19TARGET_CPU_ABI := x86 19TARGET_CPU_ABI := x86
20TARGET_ARCH := x86 20TARGET_ARCH := x86
21TARGET_ARCH_VARIANT := x86 21TARGET_ARCH_VARIANT := x86
22
23# Legacy GSI keeps 32 bits binder for 32 bits CPU Arch
24TARGET_USES_64_BIT_BINDER := false
25
26# This is a non-system-as-root Legacy GSI build target
27BOARD_BUILD_SYSTEM_ROOT_IMAGE := false
diff --git a/target/board/generic_x86_ab/BoardConfig.mk b/target/board/generic_x86_ab/BoardConfig.mk
index db4dacd96..53acffd23 100644
--- a/target/board/generic_x86_ab/BoardConfig.mk
+++ b/target/board/generic_x86_ab/BoardConfig.mk
@@ -14,17 +14,11 @@
14# limitations under the License. 14# limitations under the License.
15# 15#
16 16
17include build/make/target/board/treble_common_32.mk 17include build/make/target/board/BoardConfigGsiCommon.mk
18 18
19TARGET_CPU_ABI := x86 19TARGET_CPU_ABI := x86
20TARGET_ARCH := x86 20TARGET_ARCH := x86
21TARGET_ARCH_VARIANT := x86 21TARGET_ARCH_VARIANT := x86
22 22
23# Set this to create /cache mount point for non-A/B devices that mounts /cache. 23# Legacy GSI keeps 32 bits binder for 32 bits CPU Arch
24# The partition size doesn't matter, just to make build pass. 24TARGET_USES_64_BIT_BINDER := false
25BOARD_CACHEIMAGE_FILE_SYSTEM_TYPE := ext4
26BOARD_CACHEIMAGE_PARTITION_SIZE := 16777216
27
28# Enable A/B update
29TARGET_NO_RECOVERY := true
30BOARD_BUILD_SYSTEM_ROOT_IMAGE := true
diff --git a/target/board/treble_common.mk b/target/board/treble_common.mk
deleted file mode 100644
index eda5b3770..000000000
--- a/target/board/treble_common.mk
+++ /dev/null
@@ -1,69 +0,0 @@
1#
2# Copyright (C) 2017 The Android Open-Source Project
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8# http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15#
16
17# Common boardconfig settings for generic AOSP products targetting mobile
18# (phone/table) devices.
19
20# VNDK
21BOARD_VNDK_VERSION := current
22
23# Properties
24TARGET_SYSTEM_PROP := build/make/target/board/treble_system.prop
25BOARD_PROPERTY_OVERRIDES_SPLIT_ENABLED := true
26
27# Bootloader, kernel and recovery are not part of generic AOSP image
28TARGET_NO_BOOTLOADER := true
29TARGET_NO_KERNEL := true
30
31# system.img is always ext4 with sparse option
32# GSI also includes make_f2fs to support userdata parition in f2fs
33# for some devices
34TARGET_USERIMAGES_USE_EXT4 := true
35TARGET_USERIMAGES_USE_F2FS := true
36TARGET_USERIMAGES_SPARSE_EXT_DISABLED := false
37
38# Enable dynamic system image size and reserved 64MB in it.
39BOARD_SYSTEMIMAGE_PARTITION_RESERVED_SIZE := 67108864
40
41# Generic AOSP image always requires separate vendor.img
42TARGET_COPY_OUT_VENDOR := vendor
43
44# Android generic system image always create metadata partition
45BOARD_USES_METADATA_PARTITION := true
46
47# Set emulator framebuffer display device buffer count to 3
48NUM_FRAMEBUFFER_SURFACE_BUFFERS := 3
49
50# Audio
51USE_XML_AUDIO_POLICY_CONF := 1
52
53# Android Verified Boot (AVB):
54# 1) Sets BOARD_AVB_ENABLE to sign the GSI image.
55# 2) Sets AVB_VBMETA_IMAGE_FLAGS_VERIFICATION_DISABLED (--flag 2) in
56# vbmeta.img to disable AVB verification.
57#
58# To disable AVB for GSI, use the vbmeta.img and the GSI together.
59# To enable AVB for GSI, include the GSI public key into the device-specific
60# vbmeta.img.
61BOARD_AVB_ENABLE := true
62BOARD_AVB_ROLLBACK_INDEX := $(PLATFORM_SECURITY_PATCH_TIMESTAMP)
63BOARD_AVB_MAKE_VBMETA_IMAGE_ARGS += --flag 2
64
65# Enable chain partition for system.
66BOARD_AVB_SYSTEM_KEY_PATH := external/avb/test/data/testkey_rsa2048.pem
67BOARD_AVB_SYSTEM_ALGORITHM := SHA256_RSA2048
68BOARD_AVB_SYSTEM_ROLLBACK_INDEX := $(PLATFORM_SECURITY_PATCH_TIMESTAMP)
69BOARD_AVB_SYSTEM_ROLLBACK_INDEX_LOCATION := 1
diff --git a/target/board/treble_common_64.mk b/target/board/treble_common_64.mk
deleted file mode 100644
index 8980dfde1..000000000
--- a/target/board/treble_common_64.mk
+++ /dev/null
@@ -1,20 +0,0 @@
1#
2# Copyright (C) 2017 The Android Open-Source Project
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8# http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15#
16
17include build/make/target/board/treble_common.mk
18
19# Enable 64-bits binder
20TARGET_USES_64_BIT_BINDER := true
diff --git a/target/board/treble_system.prop b/target/board/treble_system.prop
deleted file mode 100644
index 0c04a9529..000000000
--- a/target/board/treble_system.prop
+++ /dev/null
@@ -1,8 +0,0 @@
1# GSI always generate dex pre-opt in system image
2ro.cp_system_other_odex=0
3
4# GSI always disables adb authentication
5ro.adb.secure=0
6
7# TODO(b/78105955): disable privapp_permissions checking before the bug solved
8ro.control_privapp_permissions=disable
diff --git a/target/product/aosp_arm.mk b/target/product/aosp_arm.mk
index 5a6a092c0..98114c15a 100644
--- a/target/product/aosp_arm.mk
+++ b/target/product/aosp_arm.mk
@@ -40,7 +40,8 @@ PRODUCT_COMPATIBLE_PROPERTY_OVERRIDE := true
40 40
41# GSI specific tasks on boot 41# GSI specific tasks on boot
42PRODUCT_COPY_FILES += \ 42PRODUCT_COPY_FILES += \
43 build/make/target/product/vndk/init.gsi.rc:system/etc/init/init.gsi.rc 43 build/make/target/product/gsi/skip_mount.cfg:system/etc/init/config/skip_mount.cfg \
44 build/make/target/product/gsi/init.gsi.rc:system/etc/init/init.gsi.rc \
44 45
45# Support addtional P vendor interface 46# Support addtional P vendor interface
46PRODUCT_EXTRA_VNDK_VERSIONS := 28 47PRODUCT_EXTRA_VNDK_VERSIONS := 28
diff --git a/target/product/aosp_arm64.mk b/target/product/aosp_arm64.mk
index 90c159f2f..87e14d7c2 100644
--- a/target/product/aosp_arm64.mk
+++ b/target/product/aosp_arm64.mk
@@ -56,7 +56,8 @@ PRODUCT_COMPATIBLE_PROPERTY_OVERRIDE := true
56 56
57# GSI specific tasks on boot 57# GSI specific tasks on boot
58PRODUCT_COPY_FILES += \ 58PRODUCT_COPY_FILES += \
59 build/make/target/product/vndk/init.gsi.rc:system/etc/init/init.gsi.rc 59 build/make/target/product/gsi/skip_mount.cfg:system/etc/init/config/skip_mount.cfg \
60 build/make/target/product/gsi/init.gsi.rc:system/etc/init/init.gsi.rc \
60 61
61# Support addtional P vendor interface 62# Support addtional P vendor interface
62PRODUCT_EXTRA_VNDK_VERSIONS := 28 63PRODUCT_EXTRA_VNDK_VERSIONS := 28
diff --git a/target/product/aosp_arm64_a.mk b/target/product/aosp_arm64_a.mk
index 3c7af334d..b1c4b7dba 100644
--- a/target/product/aosp_arm64_a.mk
+++ b/target/product/aosp_arm64_a.mk
@@ -17,7 +17,7 @@
17# PRODUCT_PROPERTY_OVERRIDES cannot be used here because sysprops will be at 17# PRODUCT_PROPERTY_OVERRIDES cannot be used here because sysprops will be at
18# /vendor/[build|default].prop when build split is on. In order to have sysprops 18# /vendor/[build|default].prop when build split is on. In order to have sysprops
19# on the generic system image, place them in build/make/target/board/ 19# on the generic system image, place them in build/make/target/board/
20# treble_system.prop. 20# gsi_system.prop.
21 21
22include build/make/target/product/treble_common_64.mk 22include build/make/target/product/treble_common_64.mk
23 23
diff --git a/target/product/aosp_arm64_ab.mk b/target/product/aosp_arm64_ab.mk
index d389c74d0..92f50553a 100644
--- a/target/product/aosp_arm64_ab.mk
+++ b/target/product/aosp_arm64_ab.mk
@@ -17,7 +17,7 @@
17# PRODUCT_PROPERTY_OVERRIDES cannot be used here because sysprops will be at 17# PRODUCT_PROPERTY_OVERRIDES cannot be used here because sysprops will be at
18# /vendor/[build|default].prop when build split is on. In order to have sysprops 18# /vendor/[build|default].prop when build split is on. In order to have sysprops
19# on the generic system image, place them in build/make/target/board/ 19# on the generic system image, place them in build/make/target/board/
20# treble_system.prop. 20# gsi_system.prop.
21 21
22# aosp_arm64_ab-userdebug is a Legacy GSI for the devices with: 22# aosp_arm64_ab-userdebug is a Legacy GSI for the devices with:
23# - ARM 64 bits user space 23# - ARM 64 bits user space
diff --git a/target/product/aosp_arm_a.mk b/target/product/aosp_arm_a.mk
index 3060fa920..d89a326c9 100644
--- a/target/product/aosp_arm_a.mk
+++ b/target/product/aosp_arm_a.mk
@@ -17,7 +17,7 @@
17# PRODUCT_PROPERTY_OVERRIDES cannot be used here because sysprops will be at 17# PRODUCT_PROPERTY_OVERRIDES cannot be used here because sysprops will be at
18# /vendor/[build|default].prop when build split is on. In order to have sysprops 18# /vendor/[build|default].prop when build split is on. In order to have sysprops
19# on the generic system image, place them in build/make/target/board/ 19# on the generic system image, place them in build/make/target/board/
20# treble_system.prop. 20# gsi_system.prop.
21 21
22include build/make/target/product/treble_common_32.mk 22include build/make/target/product/treble_common_32.mk
23 23
diff --git a/target/product/aosp_arm_ab.mk b/target/product/aosp_arm_ab.mk
index 5845d3ba8..b35e51775 100644
--- a/target/product/aosp_arm_ab.mk
+++ b/target/product/aosp_arm_ab.mk
@@ -17,7 +17,7 @@
17# PRODUCT_PROPERTY_OVERRIDES cannot be used here because sysprops will be at 17# PRODUCT_PROPERTY_OVERRIDES cannot be used here because sysprops will be at
18# /vendor/[build|default].prop when build split is on. In order to have sysprops 18# /vendor/[build|default].prop when build split is on. In order to have sysprops
19# on the generic system image, place them in build/make/target/board/ 19# on the generic system image, place them in build/make/target/board/
20# treble_system.prop. 20# gsi_system.prop.
21 21
22# aosp_arm_ab-userdebug is a Legacy GSI for the devices with: 22# aosp_arm_ab-userdebug is a Legacy GSI for the devices with:
23# - ARM 32 bits user space 23# - ARM 32 bits user space
diff --git a/target/product/aosp_x86.mk b/target/product/aosp_x86.mk
index da31e2417..50d735556 100644
--- a/target/product/aosp_x86.mk
+++ b/target/product/aosp_x86.mk
@@ -40,7 +40,8 @@ PRODUCT_COMPATIBLE_PROPERTY_OVERRIDE := true
40 40
41# GSI specific tasks on boot 41# GSI specific tasks on boot
42PRODUCT_COPY_FILES += \ 42PRODUCT_COPY_FILES += \
43 build/make/target/product/vndk/init.gsi.rc:system/etc/init/init.gsi.rc 43 build/make/target/product/gsi/skip_mount.cfg:system/etc/init/config/skip_mount.cfg \
44 build/make/target/product/gsi/init.gsi.rc:system/etc/init/init.gsi.rc \
44 45
45# Support addtional P vendor interface 46# Support addtional P vendor interface
46PRODUCT_EXTRA_VNDK_VERSIONS := 28 47PRODUCT_EXTRA_VNDK_VERSIONS := 28
diff --git a/target/product/aosp_x86_64.mk b/target/product/aosp_x86_64.mk
index 4ce40cc71..499831b3c 100644
--- a/target/product/aosp_x86_64.mk
+++ b/target/product/aosp_x86_64.mk
@@ -56,7 +56,8 @@ PRODUCT_COMPATIBLE_PROPERTY_OVERRIDE := true
56 56
57# GSI specific tasks on boot 57# GSI specific tasks on boot
58PRODUCT_COPY_FILES += \ 58PRODUCT_COPY_FILES += \
59 build/make/target/product/vndk/init.gsi.rc:system/etc/init/init.gsi.rc 59 build/make/target/product/gsi/skip_mount.cfg:system/etc/init/config/skip_mount.cfg \
60 build/make/target/product/gsi/init.gsi.rc:system/etc/init/init.gsi.rc \
60 61
61# Support addtional P vendor interface 62# Support addtional P vendor interface
62PRODUCT_EXTRA_VNDK_VERSIONS := 28 63PRODUCT_EXTRA_VNDK_VERSIONS := 28
diff --git a/target/product/aosp_x86_64_a.mk b/target/product/aosp_x86_64_a.mk
index a7fb74097..6b6785a49 100644
--- a/target/product/aosp_x86_64_a.mk
+++ b/target/product/aosp_x86_64_a.mk
@@ -17,7 +17,7 @@
17# PRODUCT_PROPERTY_OVERRIDES cannot be used here because sysprops will be at 17# PRODUCT_PROPERTY_OVERRIDES cannot be used here because sysprops will be at
18# /vendor/[build|default].prop when build split is on. In order to have sysprops 18# /vendor/[build|default].prop when build split is on. In order to have sysprops
19# on the generic system image, place them in build/make/target/board/ 19# on the generic system image, place them in build/make/target/board/
20# treble_system.prop. 20# gsi_system.prop.
21 21
22include build/make/target/product/treble_common_64.mk 22include build/make/target/product/treble_common_64.mk
23 23
diff --git a/target/product/aosp_x86_64_ab.mk b/target/product/aosp_x86_64_ab.mk
index d9163d76b..35bf61a1f 100644
--- a/target/product/aosp_x86_64_ab.mk
+++ b/target/product/aosp_x86_64_ab.mk
@@ -17,7 +17,7 @@
17# PRODUCT_PROPERTY_OVERRIDES cannot be used here because sysprops will be at 17# PRODUCT_PROPERTY_OVERRIDES cannot be used here because sysprops will be at
18# /vendor/[build|default].prop when build split is on. In order to have sysprops 18# /vendor/[build|default].prop when build split is on. In order to have sysprops
19# on the generic system image, place them in build/make/target/board/ 19# on the generic system image, place them in build/make/target/board/
20# treble_system.prop. 20# gsi_system.prop.
21 21
22# aosp_x86_64_ab-userdebug is a Legacy GSI for the devices with: 22# aosp_x86_64_ab-userdebug is a Legacy GSI for the devices with:
23# - x86 64 bits user space 23# - x86 64 bits user space
diff --git a/target/product/aosp_x86_a.mk b/target/product/aosp_x86_a.mk
index 9ed29955e..99ed7e441 100644
--- a/target/product/aosp_x86_a.mk
+++ b/target/product/aosp_x86_a.mk
@@ -17,7 +17,7 @@
17# PRODUCT_PROPERTY_OVERRIDES cannot be used here because sysprops will be at 17# PRODUCT_PROPERTY_OVERRIDES cannot be used here because sysprops will be at
18# /vendor/[build|default].prop when build split is on. In order to have sysprops 18# /vendor/[build|default].prop when build split is on. In order to have sysprops
19# on the generic system image, place them in build/make/target/board/ 19# on the generic system image, place them in build/make/target/board/
20# treble_system.prop. 20# gsi_system.prop.
21 21
22include build/make/target/product/treble_common_32.mk 22include build/make/target/product/treble_common_32.mk
23 23
diff --git a/target/product/aosp_x86_ab.mk b/target/product/aosp_x86_ab.mk
index 4fff3d155..185e2f0a3 100644
--- a/target/product/aosp_x86_ab.mk
+++ b/target/product/aosp_x86_ab.mk
@@ -17,7 +17,7 @@
17# PRODUCT_PROPERTY_OVERRIDES cannot be used here because sysprops will be at 17# PRODUCT_PROPERTY_OVERRIDES cannot be used here because sysprops will be at
18# /vendor/[build|default].prop when build split is on. In order to have sysprops 18# /vendor/[build|default].prop when build split is on. In order to have sysprops
19# on the generic system image, place them in build/make/target/board/ 19# on the generic system image, place them in build/make/target/board/
20# treble_system.prop. 20# gsi_system.prop.
21 21
22# aosp_x86_ab-userdebug is a Legacy GSI for the devices with: 22# aosp_x86_ab-userdebug is a Legacy GSI for the devices with:
23# - x86 32 bits user space 23# - x86 32 bits user space
diff --git a/target/product/base_system.mk b/target/product/base_system.mk
index 3d5c51225..7c3ac3b3d 100644
--- a/target/product/base_system.mk
+++ b/target/product/base_system.mk
@@ -16,6 +16,7 @@
16 16
17# Base modules and settings for the system partition. 17# Base modules and settings for the system partition.
18PRODUCT_PACKAGES += \ 18PRODUCT_PACKAGES += \
19 abb \
19 adb \ 20 adb \
20 adbd \ 21 adbd \
21 am \ 22 am \
@@ -48,9 +49,9 @@ PRODUCT_PACKAGES += \
48 bu \ 49 bu \
49 bugreport \ 50 bugreport \
50 bugreportz \ 51 bugreportz \
51 cameraserver \
52 charger \ 52 charger \
53 cmd \ 53 cmd \
54 com.android.conscrypt \
54 com.android.location.provider \ 55 com.android.location.provider \
55 com.android.resolv \ 56 com.android.resolv \
56 com.android.tzdata \ 57 com.android.tzdata \
@@ -61,6 +62,7 @@ PRODUCT_PACKAGES += \
61 CtsShimPrivPrebuilt \ 62 CtsShimPrivPrebuilt \
62 debuggerd\ 63 debuggerd\
63 DefaultContainerService \ 64 DefaultContainerService \
65 dmctl \
64 dnsmasq \ 66 dnsmasq \
65 DownloadProvider \ 67 DownloadProvider \
66 dpm \ 68 dpm \
@@ -81,7 +83,6 @@ PRODUCT_PACKAGES += \
81 heapprofd_client \ 83 heapprofd_client \
82 gatekeeperd \ 84 gatekeeperd \
83 gpuservice \ 85 gpuservice \
84 healthd \
85 hid \ 86 hid \
86 hwservicemanager \ 87 hwservicemanager \
87 idmap \ 88 idmap \
@@ -117,14 +118,14 @@ PRODUCT_PACKAGES += \
117 libaudioutils \ 118 libaudioutils \
118 libbinder \ 119 libbinder \
119 libbinder_ndk \ 120 libbinder_ndk \
120 libc \ 121 libc.bootstrap \
121 libcamera2ndk \ 122 libcamera2ndk \
122 libcamera_client \ 123 libcamera_client \
123 libcameraservice \ 124 libcameraservice \
124 libc_malloc_debug \ 125 libc_malloc_debug \
125 libc_malloc_hooks \ 126 libc_malloc_hooks \
126 libcutils \ 127 libcutils \
127 libdl \ 128 libdl.bootstrap \
128 libdrmframework \ 129 libdrmframework \
129 libdrmframework_jni \ 130 libdrmframework_jni \
130 libEGL \ 131 libEGL \
@@ -144,7 +145,7 @@ PRODUCT_PACKAGES += \
144 libjnigraphics \ 145 libjnigraphics \
145 libjpeg \ 146 libjpeg \
146 liblog \ 147 liblog \
147 libm \ 148 libm.bootstrap \
148 libmdnssd \ 149 libmdnssd \
149 libmedia \ 150 libmedia \
150 libmedia_jni \ 151 libmedia_jni \
@@ -194,6 +195,7 @@ PRODUCT_PACKAGES += \
194 locksettings \ 195 locksettings \
195 logcat \ 196 logcat \
196 logd \ 197 logd \
198 lpdump \
197 lshal \ 199 lshal \
198 mdnsd \ 200 mdnsd \
199 media \ 201 media \
@@ -205,10 +207,12 @@ PRODUCT_PACKAGES += \
205 MediaProvider \ 207 MediaProvider \
206 mediaserver \ 208 mediaserver \
207 mke2fs \ 209 mke2fs \
210 ModuleMetadata \
208 monkey \ 211 monkey \
209 mtpd \ 212 mtpd \
210 ndc \ 213 ndc \
211 netd \ 214 netd \
215 NetworkStack \
212 org.apache.http.legacy \ 216 org.apache.http.legacy \
213 perfetto \ 217 perfetto \
214 ping \ 218 ping \
@@ -220,6 +224,7 @@ PRODUCT_PACKAGES += \
220 racoon \ 224 racoon \
221 recovery-persist \ 225 recovery-persist \
222 resize2fs \ 226 resize2fs \
227 rss_hwm_reset \
223 run-as \ 228 run-as \
224 schedtest \ 229 schedtest \
225 screencap \ 230 screencap \
@@ -312,14 +317,10 @@ PRODUCT_SYSTEM_DEFAULT_PROPERTIES += debug.atrace.tags.enableflags=0
312# Packages included only for eng or userdebug builds, previously debug tagged 317# Packages included only for eng or userdebug builds, previously debug tagged
313PRODUCT_PACKAGES_DEBUG := \ 318PRODUCT_PACKAGES_DEBUG := \
314 adb_keys \ 319 adb_keys \
315 apex.test.key \
316 arping \ 320 arping \
317 com.android.apex.test_package.key \
318 com.android.apex.test_package.preinstall.key \
319 iotop \ 321 iotop \
320 iw \ 322 iw \
321 logpersist.start \ 323 logpersist.start \
322 perfprofd \
323 procrank \ 324 procrank \
324 showmap \ 325 showmap \
325 sqlite3 \ 326 sqlite3 \
diff --git a/target/product/base_vendor.mk b/target/product/base_vendor.mk
index 9bb45d158..1bb4beede 100644
--- a/target/product/base_vendor.mk
+++ b/target/product/base_vendor.mk
@@ -53,6 +53,10 @@ PRODUCT_PACKAGES += \
53 vndservice \ 53 vndservice \
54 vndservicemanager \ 54 vndservicemanager \
55 55
56# Base modules and settings for the product partition.
57PRODUCT_PACKAGES += \
58 healthd \
59
56# VINTF data for vendor image 60# VINTF data for vendor image
57PRODUCT_PACKAGES += \ 61PRODUCT_PACKAGES += \
58 device_manifest.xml \ 62 device_manifest.xml \
diff --git a/target/product/go_defaults_common.mk b/target/product/go_defaults_common.mk
index 18907c142..06bdec97e 100644
--- a/target/product/go_defaults_common.mk
+++ b/target/product/go_defaults_common.mk
@@ -61,6 +61,10 @@ PRODUCT_PROPERTY_OVERRIDES += dalvik.vm.heapsize=256m
61# Do not generate libartd. 61# Do not generate libartd.
62PRODUCT_ART_TARGET_INCLUDE_DEBUG_BUILD := false 62PRODUCT_ART_TARGET_INCLUDE_DEBUG_BUILD := false
63 63
64# Do not spin up a separate process for the network stack on go devices, use an in-process lib.
65PRODUCT_PACKAGES += NetworkStackLib
66PRODUCT_SYSTEM_SERVER_JARS += NetworkStackLib
67
64# Strip the local variable table and the local variable type table to reduce 68# Strip the local variable table and the local variable type table to reduce
65# the size of the system image. This has no bearing on stack traces, but will 69# the size of the system image. This has no bearing on stack traces, but will
66# leave less information available via JDWP. 70# leave less information available via JDWP.
diff --git a/target/product/vndk/28.txt b/target/product/gsi/28.txt
index 712e91c58..712e91c58 100644
--- a/target/product/vndk/28.txt
+++ b/target/product/gsi/28.txt
diff --git a/target/product/vndk/Android.mk b/target/product/gsi/Android.mk
index 7953db04f..7953db04f 100644
--- a/target/product/vndk/Android.mk
+++ b/target/product/gsi/Android.mk
diff --git a/target/product/vndk/OWNERS b/target/product/gsi/OWNERS
index 3fdd5af54..3fdd5af54 100644
--- a/target/product/vndk/OWNERS
+++ b/target/product/gsi/OWNERS
diff --git a/target/product/vndk/current.txt b/target/product/gsi/current.txt
index e8f61a448..17d2f1bd5 100644
--- a/target/product/vndk/current.txt
+++ b/target/product/gsi/current.txt
@@ -43,7 +43,6 @@ VNDK-SP: libhwbinder.so
43VNDK-SP: libhwbinder_noltopgo.so 43VNDK-SP: libhwbinder_noltopgo.so
44VNDK-SP: libion.so 44VNDK-SP: libion.so
45VNDK-SP: liblzma.so 45VNDK-SP: liblzma.so
46VNDK-SP: libunwind.so
47VNDK-SP: libunwindstack.so 46VNDK-SP: libunwindstack.so
48VNDK-SP: libutils.so 47VNDK-SP: libutils.so
49VNDK-SP: libutilscallstack.so 48VNDK-SP: libutilscallstack.so
@@ -119,7 +118,9 @@ VNDK-core: android.hardware.neuralnetworks@1.1.so
119VNDK-core: android.hardware.neuralnetworks@1.2.so 118VNDK-core: android.hardware.neuralnetworks@1.2.so
120VNDK-core: android.hardware.nfc@1.0.so 119VNDK-core: android.hardware.nfc@1.0.so
121VNDK-core: android.hardware.nfc@1.1.so 120VNDK-core: android.hardware.nfc@1.1.so
121VNDK-core: android.hardware.nfc@1.2.so
122VNDK-core: android.hardware.oemlock@1.0.so 122VNDK-core: android.hardware.oemlock@1.0.so
123VNDK-core: android.hardware.power.stats@1.0.so
123VNDK-core: android.hardware.power@1.0.so 124VNDK-core: android.hardware.power@1.0.so
124VNDK-core: android.hardware.power@1.1.so 125VNDK-core: android.hardware.power@1.1.so
125VNDK-core: android.hardware.power@1.2.so 126VNDK-core: android.hardware.power@1.2.so
@@ -262,4 +263,3 @@ VNDK-private: libblas.so
262VNDK-private: libcompiler_rt.so 263VNDK-private: libcompiler_rt.so
263VNDK-private: libft2.so 264VNDK-private: libft2.so
264VNDK-private: libgui.so 265VNDK-private: libgui.so
265VNDK-private: libunwind.so
diff --git a/target/product/gsi/init.gsi.rc b/target/product/gsi/init.gsi.rc
new file mode 100644
index 000000000..c6faba78d
--- /dev/null
+++ b/target/product/gsi/init.gsi.rc
@@ -0,0 +1,3 @@
1#
2# Android init script for GSI required initialization
3#
diff --git a/target/product/vndk/init.legacy-gsi.rc b/target/product/gsi/init.legacy-gsi.rc
index 00dd576fc..00dd576fc 100644
--- a/target/product/vndk/init.legacy-gsi.rc
+++ b/target/product/gsi/init.legacy-gsi.rc
diff --git a/target/product/vndk/init.vndk-27.rc b/target/product/gsi/init.vndk-27.rc
index d464a2f39..d464a2f39 100644
--- a/target/product/vndk/init.vndk-27.rc
+++ b/target/product/gsi/init.vndk-27.rc
diff --git a/target/product/gsi/skip_mount.cfg b/target/product/gsi/skip_mount.cfg
new file mode 100644
index 000000000..549767edf
--- /dev/null
+++ b/target/product/gsi/skip_mount.cfg
@@ -0,0 +1,2 @@
1/product
2/product_services
diff --git a/target/product/handheld_system.mk b/target/product/handheld_system.mk
index a961d1e8b..0a763fb2a 100644
--- a/target/product/handheld_system.mk
+++ b/target/product/handheld_system.mk
@@ -36,52 +36,33 @@ PRODUCT_PACKAGES += \
36 Bluetooth \ 36 Bluetooth \
37 BluetoothMidiService \ 37 BluetoothMidiService \
38 BookmarkProvider \ 38 BookmarkProvider \
39 Browser2 \
40 BuiltInPrintService \ 39 BuiltInPrintService \
41 Calendar \
42 CalendarProvider \ 40 CalendarProvider \
43 Camera2 \ 41 cameraserver \
44 CaptivePortalLogin \ 42 CaptivePortalLogin \
45 CertInstaller \ 43 CertInstaller \
46 clatd \ 44 clatd \
47 clatd.conf \ 45 clatd.conf \
48 Contacts \
49 DeskClock \
50 DocumentsUI \ 46 DocumentsUI \
51 DownloadProviderUi \ 47 DownloadProviderUi \
52 EasterEgg \ 48 EasterEgg \
53 Email \
54 ExactCalculator \
55 ExternalStorageProvider \ 49 ExternalStorageProvider \
56 FusedLocation \ 50 FusedLocation \
57 Gallery2 \
58 Home \
59 InputDevices \ 51 InputDevices \
60 KeyChain \ 52 KeyChain \
61 LatinIME \
62 Launcher3QuickStep \
63 librs_jni \ 53 librs_jni \
64 ManagedProvisioning \ 54 ManagedProvisioning \
65 MmsService \ 55 MmsService \
66 MtpDocumentsProvider \ 56 MtpDocumentsProvider \
67 Music \
68 MusicFX \ 57 MusicFX \
69 NfcNci \ 58 NfcNci \
70 OneTimeInitializer \
71 PacProcessor \ 59 PacProcessor \
72 PrintRecommendationService \
73 PrintSpooler \ 60 PrintSpooler \
74 Provision \
75 ProxyHandler \ 61 ProxyHandler \
76 QuickSearchBox \
77 screenrecord \ 62 screenrecord \
78 SecureElement \ 63 SecureElement \
79 Settings \
80 SettingsIntelligence \
81 SharedStorageBackup \ 64 SharedStorageBackup \
82 SimAppDialog \ 65 SimAppDialog \
83 StorageManager \
84 SystemUI \
85 Telecom \ 66 Telecom \
86 TelephonyProvider \ 67 TelephonyProvider \
87 TeleService \ 68 TeleService \
@@ -89,7 +70,6 @@ PRODUCT_PACKAGES += \
89 UserDictionaryProvider \ 70 UserDictionaryProvider \
90 VpnDialogs \ 71 VpnDialogs \
91 vr \ 72 vr \
92 WallpaperCropper \
93 73
94 74
95PRODUCT_SYSTEM_SERVER_APPS += \ 75PRODUCT_SYSTEM_SERVER_APPS += \
@@ -105,4 +85,3 @@ PRODUCT_PROPERTY_OVERRIDES += \
105 ro.carrier=unknown \ 85 ro.carrier=unknown \
106 ro.config.notification_sound=OnTheHunt.ogg \ 86 ro.config.notification_sound=OnTheHunt.ogg \
107 ro.config.alarm_alert=Alarm_Classic.ogg 87 ro.config.alarm_alert=Alarm_Classic.ogg
108
diff --git a/target/product/handheld_vendor.mk b/target/product/handheld_vendor.mk
index 0f7387559..b9970e9dd 100644
--- a/target/product/handheld_vendor.mk
+++ b/target/product/handheld_vendor.mk
@@ -19,6 +19,8 @@
19# it definitely doesn't belong on other types of devices (if it 19# it definitely doesn't belong on other types of devices (if it
20# does, use base_vendor.mk). 20# does, use base_vendor.mk).
21$(call inherit-product, $(SRC_TARGET_DIR)/product/media_vendor.mk) 21$(call inherit-product, $(SRC_TARGET_DIR)/product/media_vendor.mk)
22
23# /vendor packages
22PRODUCT_PACKAGES += \ 24PRODUCT_PACKAGES += \
23 audio.primary.default \ 25 audio.primary.default \
24 DisplayCutoutEmulationCornerOverlay \ 26 DisplayCutoutEmulationCornerOverlay \
@@ -28,3 +30,25 @@ PRODUCT_PACKAGES += \
28 power.default \ 30 power.default \
29 SysuiDarkThemeOverlay \ 31 SysuiDarkThemeOverlay \
30 vibrator.default \ 32 vibrator.default \
33
34# /product packages
35PRODUCT_PACKAGES += \
36 Browser2 \
37 Calendar \
38 Camera2 \
39 Contacts \
40 DeskClock \
41 Email \
42 Gallery2 \
43 LatinIME \
44 Launcher3QuickStep \
45 Music \
46 OneTimeInitializer \
47 PrintRecommendationService \
48 Provision \
49 QuickSearchBox \
50 Settings \
51 SettingsIntelligence \
52 StorageManager \
53 SystemUI \
54 WallpaperCropper \
diff --git a/target/product/languages_default.mk b/target/product/languages_default.mk
new file mode 100644
index 000000000..a13a23c56
--- /dev/null
+++ b/target/product/languages_default.mk
@@ -0,0 +1,105 @@
1#
2# Copyright (C) 2009 The Android Open Source Project
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8# http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15#
16
17# This is a build configuration that just contains a list of languages, with
18# en_US set as the default language.
19PRODUCT_LOCALES := \
20 en_US \
21 af_ZA \
22 am_ET \
23 ar_EG \
24 ar_XB \
25 as_IN \
26 az_AZ \
27 be_BY \
28 bg_BG \
29 bn_BD \
30 bs_BA \
31 ca_ES \
32 cs_CZ \
33 da_DK \
34 de_DE \
35 el_GR \
36 en_AU \
37 en_CA \
38 en_GB \
39 en_IN \
40 en_XA \
41 es_ES \
42 es_US \
43 et_EE \
44 eu_ES \
45 fa_IR \
46 fi_FI \
47 fr_CA \
48 fr_FR \
49 gl_ES \
50 gu_IN \
51 hi_IN \
52 hr_HR \
53 hu_HU \
54 hy_AM \
55 in_ID \
56 is_IS \
57 it_IT \
58 iw_IL \
59 ja_JP \
60 ka_GE \
61 kk_KZ \
62 km_KH \
63 kn_IN \
64 ko_KR \
65 ky_KG \
66 lo_LA \
67 lt_LT \
68 lv_LV \
69 mk_MK \
70 ml_IN \
71 mn_MN \
72 mr_IN \
73 ms_MY \
74 my_MM \
75 nb_NO \
76 ne_NP \
77 nl_NL \
78 or_IN \
79 pa_IN \
80 pl_PL \
81 pt_BR \
82 pt_PT \
83 ro_RO \
84 ru_RU \
85 si_LK \
86 sk_SK \
87 sl_SI \
88 sq_AL \
89 sr_Latn_RS \
90 sr_RS \
91 sv_SE \
92 sw_TZ \
93 ta_IN \
94 te_IN \
95 th_TH \
96 tl_PH \
97 tr_TR \
98 uk_UA \
99 ur_PK \
100 uz_UZ \
101 vi_VN \
102 zh_CN \
103 zh_HK \
104 zh_TW \
105 zu_ZA \
diff --git a/target/product/languages_full.mk b/target/product/languages_full.mk
index 5f3795f21..43a40a7e9 100644
--- a/target/product/languages_full.mk
+++ b/target/product/languages_full.mk
@@ -14,94 +14,9 @@
14# limitations under the License. 14# limitations under the License.
15# 15#
16 16
17# This is a build configuration that just contains a list of languages. 17# This is a build configuration that contains the default list of languages,
18# 18# as well as the en_XC pseudo-locale, which is useful for localization test
19# These are all the locales that have translations. 19# builds.
20PRODUCT_LOCALES := \ 20
21 en_US \ 21$(call inherit-product, $(SRC_TARGET_DIR)/product/languages_default.mk)
22 af_ZA \ 22PRODUCT_LOCALES += en_XC
23 am_ET \
24 ar_EG \
25 ar_XB \
26 as_IN \
27 az_AZ \
28 be_BY \
29 bg_BG \
30 bn_BD \
31 bs_BA \
32 ca_ES \
33 cs_CZ \
34 da_DK \
35 de_DE \
36 el_GR \
37 en_AU \
38 en_CA \
39 en_GB \
40 en_IN \
41 en_XA \
42 en_XC \
43 es_ES \
44 es_US \
45 et_EE \
46 eu_ES \
47 fa_IR \
48 fi_FI \
49 fr_CA \
50 fr_FR \
51 gl_ES \
52 gu_IN \
53 hi_IN \
54 hr_HR \
55 hu_HU \
56 hy_AM \
57 in_ID \
58 is_IS \
59 it_IT \
60 iw_IL \
61 ja_JP \
62 ka_GE \
63 kk_KZ \
64 km_KH \
65 kn_IN \
66 ko_KR \
67 ky_KG \
68 lo_LA \
69 lt_LT \
70 lv_LV \
71 mk_MK \
72 ml_IN \
73 mn_MN \
74 mr_IN \
75 ms_MY \
76 my_MM \
77 nb_NO \
78 ne_NP \
79 nl_NL \
80 or_IN \
81 pa_IN \
82 pl_PL \
83 pt_BR \
84 pt_PT \
85 ro_RO \
86 ru_RU \
87 si_LK \
88 sk_SK \
89 sl_SI \
90 sq_AL \
91 sr_Latn_RS \
92 sr_RS \
93 sv_SE \
94 sw_TZ \
95 ta_IN \
96 te_IN \
97 th_TH \
98 tl_PH \
99 tr_TR \
100 uk_UA \
101 ur_PK \
102 uz_UZ \
103 vi_VN \
104 zh_CN \
105 zh_HK \
106 zh_TW \
107 zu_ZA
diff --git a/target/product/languages_small.mk b/target/product/languages_small.mk
deleted file mode 100644
index d695ca8da..000000000
--- a/target/product/languages_small.mk
+++ /dev/null
@@ -1,24 +0,0 @@
1#
2# Copyright (C) 2009 The Android Open Source Project
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8# http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15#
16
17# This is a build configuration that just contains a list of languages.
18# It helps in situations where laugnages must come first in the list,
19# mostly because screen densities interfere with the list of locales and
20# the system misbehaves when a density is the first locale.
21
22# This is the list of languages that originally shipped on ADP1
23
24PRODUCT_LOCALES := en_US en_GB fr_FR it_IT de_DE es_ES
diff --git a/target/board/treble_common_32.mk b/target/product/mainline.mk
index b66c41eb0..44dcd6083 100644
--- a/target/board/treble_common_32.mk
+++ b/target/product/mainline.mk
@@ -1,5 +1,5 @@
1# 1#
2# Copyright (C) 2017 The Android Open-Source Project 2# Copyright (C) 2019 The Android Open Source Project
3# 3#
4# Licensed under the Apache License, Version 2.0 (the "License"); 4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License. 5# you may not use this file except in compliance with the License.
@@ -14,4 +14,8 @@
14# limitations under the License. 14# limitations under the License.
15# 15#
16 16
17include build/make/target/board/treble_common.mk 17# Makefile including the mainline system image, and the relevant AOSP portions
18# for the other partitions.
19$(call inherit-product, $(SRC_TARGET_DIR)/product/mainline_system.mk)
20$(call inherit-product, $(SRC_TARGET_DIR)/product/handheld_vendor.mk)
21$(call inherit-product, $(SRC_TARGET_DIR)/product/telephony_vendor.mk)
diff --git a/target/product/mainline_arm64.mk b/target/product/mainline_arm64.mk
index cc048442f..6122ac1d9 100644
--- a/target/product/mainline_arm64.mk
+++ b/target/product/mainline_arm64.mk
@@ -15,9 +15,7 @@
15# 15#
16 16
17$(call inherit-product, $(SRC_TARGET_DIR)/product/core_64_bit.mk) 17$(call inherit-product, $(SRC_TARGET_DIR)/product/core_64_bit.mk)
18$(call inherit-product, $(SRC_TARGET_DIR)/product/mainline_system.mk) 18$(call inherit-product, $(SRC_TARGET_DIR)/product/mainline.mk)
19$(call inherit-product, $(SRC_TARGET_DIR)/product/handheld_vendor.mk)
20$(call inherit-product, $(SRC_TARGET_DIR)/product/telephony_vendor.mk)
21 19
22PRODUCT_NAME := mainline_arm64 20PRODUCT_NAME := mainline_arm64
23PRODUCT_DEVICE := generic_arm64 21PRODUCT_DEVICE := generic_arm64
@@ -25,8 +23,47 @@ PRODUCT_BRAND := generic
25PRODUCT_SHIPPING_API_LEVEL := 28 23PRODUCT_SHIPPING_API_LEVEL := 28
26PRODUCT_RESTRICT_VENDOR_FILES := all 24PRODUCT_RESTRICT_VENDOR_FILES := all
27 25
28PRODUCT_ENFORCE_ARTIFACT_PATH_REQUIREMENTS := true 26PRODUCT_ENFORCE_ARTIFACT_PATH_REQUIREMENTS := relaxed
29PRODUCT_ARTIFACT_PATH_REQUIREMENT_WHITELIST := \ 27# Target device doesn't have a product partition, so whitelist the /system/ fallback path.
28PRODUCT_ARTIFACT_PATH_REQUIREMENT_WHITELIST := system/product/%
29PRODUCT_ARTIFACT_PATH_REQUIREMENT_WHITELIST += \
30 root/init.zygote64_32.rc \ 30 root/init.zygote64_32.rc \
31 system/etc/seccomp_policy/crash_dump.arm.policy \ 31 system/etc/seccomp_policy/crash_dump.arm.policy \
32 system/etc/seccomp_policy/mediacodec.policy \ 32 system/etc/seccomp_policy/mediacodec.policy \
33
34# Modules that are to be moved to /product
35PRODUCT_ARTIFACT_PATH_REQUIREMENT_WHITELIST += \
36 system/app/Browser2/Browser2.apk \
37 system/app/Calendar/Calendar.apk \
38 system/app/Camera2/Camera2.apk \
39 system/app/DeskClock/DeskClock.apk \
40 system/app/Email/Email.apk \
41 system/app/Gallery2/Gallery2.apk \
42 system/app/LatinIME/LatinIME.apk \
43 system/app/LatinIME/oat/arm64/LatinIME.odex \
44 system/app/LatinIME/oat/arm64/LatinIME.vdex \
45 system/app/Music/Music.apk \
46 system/app/PrintRecommendationService/PrintRecommendationService.apk \
47 system/app/QuickSearchBox/QuickSearchBox.apk \
48 system/bin/healthd \
49 system/etc/init/healthd.rc \
50 system/etc/vintf/manifest/manifest_healthd.xml \
51 system/lib64/libjni_eglfence.so \
52 system/lib64/libjni_filtershow_filters.so \
53 system/lib64/libjni_jpegstream.so \
54 system/lib64/libjni_jpegutil.so \
55 system/lib64/libjni_latinime.so \
56 system/lib64/libjni_tinyplanet.so \
57 system/priv-app/CarrierConfig/CarrierConfig.apk \
58 system/priv-app/Contacts/Contacts.apk \
59 system/priv-app/Dialer/Dialer.apk \
60 system/priv-app/Launcher3QuickStep/Launcher3QuickStep.apk \
61 system/priv-app/OneTimeInitializer/OneTimeInitializer.apk \
62 system/priv-app/Provision/Provision.apk \
63 system/priv-app/Settings/Settings.apk \
64 system/priv-app/SettingsIntelligence/SettingsIntelligence.apk \
65 system/priv-app/StorageManager/StorageManager.apk \
66 system/priv-app/SystemUI/SystemUI.apk \
67 system/priv-app/SystemUI/oat/arm64/SystemUI.odex \
68 system/priv-app/SystemUI/oat/arm64/SystemUI.vdex \
69 system/priv-app/WallpaperCropper/WallpaperCropper.apk \
diff --git a/target/product/mainline_system.mk b/target/product/mainline_system.mk
index c41e1d7c6..b9b422f24 100644
--- a/target/product/mainline_system.mk
+++ b/target/product/mainline_system.mk
@@ -17,6 +17,9 @@
17# This makefile is the basis of a generic system image for a handheld device. 17# This makefile is the basis of a generic system image for a handheld device.
18$(call inherit-product, $(SRC_TARGET_DIR)/product/handheld_system.mk) 18$(call inherit-product, $(SRC_TARGET_DIR)/product/handheld_system.mk)
19$(call inherit-product, $(SRC_TARGET_DIR)/product/telephony_system.mk) 19$(call inherit-product, $(SRC_TARGET_DIR)/product/telephony_system.mk)
20$(call inherit-product, $(SRC_TARGET_DIR)/product/languages_default.mk)
21# Add adb keys to debuggable AOSP builds (if they exist)
22$(call inherit-product-if-exists, vendor/google/security/adb/vendor_key.mk)
20 23
21# Shared java libs 24# Shared java libs
22PRODUCT_PACKAGES += \ 25PRODUCT_PACKAGES += \
@@ -31,6 +34,7 @@ PRODUCT_PACKAGES += \
31 RcsService \ 34 RcsService \
32 SafetyRegulatoryInfo \ 35 SafetyRegulatoryInfo \
33 Stk \ 36 Stk \
37 Tag \
34 TimeZoneUpdater \ 38 TimeZoneUpdater \
35 39
36# Binaries 40# Binaries
@@ -71,6 +75,7 @@ PRODUCT_PACKAGES += \
71 android.hardware.radio.deprecated@1.0 \ 75 android.hardware.radio.deprecated@1.0 \
72 android.hardware.secure_element@1.0 \ 76 android.hardware.secure_element@1.0 \
73 android.hardware.tests.libhwbinder@1.0-impl \ 77 android.hardware.tests.libhwbinder@1.0-impl \
78 android.hardware.wifi@1.0 \
74 android.hidl.base@1.0 \ 79 android.hidl.base@1.0 \
75 libaudio-resampler \ 80 libaudio-resampler \
76 liblogwrap \ 81 liblogwrap \
@@ -97,8 +102,6 @@ PRODUCT_SYSTEM_DEFAULT_PROPERTIES += \
97# Enable dynamic partition size 102# Enable dynamic partition size
98PRODUCT_USE_DYNAMIC_PARTITION_SIZE := true 103PRODUCT_USE_DYNAMIC_PARTITION_SIZE := true
99 104
100PRODUCT_LOCALES := en_US af_ZA am_ET ar_EG as_IN az_AZ be_BY bg_BG bn_BD bs_BA ca_ES cs_CZ da_DK de_DE el_GR en_AU en_CA en_GB en_IN es_ES es_US et_EE eu_ES fa_IR fi_FI fr_CA fr_FR gl_ES gu_IN hi_IN hr_HR hu_HU hy_AM in_ID is_IS it_IT iw_IL ja_JP ka_GE kk_KZ km_KH ko_KR ky_KG lo_LA lt_LT lv_LV km_MH kn_IN mn_MN ml_IN mk_MK mr_IN ms_MY my_MM ne_NP nb_NO nl_NL or_IN pa_IN pl_PL pt_BR pt_PT ro_RO ru_RU si_LK sk_SK sl_SI sq_AL sr_Latn_RS sr_RS sv_SE sw_TZ ta_IN te_IN th_TH tl_PH tr_TR uk_UA ur_PK uz_UZ vi_VN zh_CN zh_HK zh_TW zu_ZA en_XA ar_XB
101
102PRODUCT_NAME := mainline_system 105PRODUCT_NAME := mainline_system
103PRODUCT_BRAND := generic 106PRODUCT_BRAND := generic
104 107
diff --git a/target/product/media_vendor.mk b/target/product/media_vendor.mk
index 1db0b587e..f30e6f361 100644
--- a/target/product/media_vendor.mk
+++ b/target/product/media_vendor.mk
@@ -20,6 +20,11 @@
20# base_vendor.mk. 20# base_vendor.mk.
21$(call inherit-product, $(SRC_TARGET_DIR)/product/base_vendor.mk) 21$(call inherit-product, $(SRC_TARGET_DIR)/product/base_vendor.mk)
22 22
23# /vendor packages
23PRODUCT_PACKAGES += \ 24PRODUCT_PACKAGES += \
24 libaudiopreprocessing \ 25 libaudiopreprocessing \
25 libwebrtc_audio_preprocessing \ 26 libwebrtc_audio_preprocessing \
27
28# /product packages
29PRODUCT_PACKAGES += \
30 webview \
diff --git a/target/product/product_launched_with_k.mk b/target/product/product_launched_with_k.mk
new file mode 100644
index 000000000..87faa12a6
--- /dev/null
+++ b/target/product/product_launched_with_k.mk
@@ -0,0 +1,2 @@
1#PRODUCT_SHIPPING_API_LEVEL indicates the first api level, device has been commercially launched on.
2PRODUCT_SHIPPING_API_LEVEL := 19
diff --git a/target/product/product_launched_with_l.mk b/target/product/product_launched_with_l.mk
index 6e782f798..4e79749a3 100644
--- a/target/product/product_launched_with_l.mk
+++ b/target/product/product_launched_with_l.mk
@@ -1,3 +1,2 @@
1#PRODUCT_SHIPPING_API_LEVEL indicates the first api level, device has been commercially launched on. 1#PRODUCT_SHIPPING_API_LEVEL indicates the first api level, device has been commercially launched on.
2PRODUCT_SHIPPING_API_LEVEL := 21 2PRODUCT_SHIPPING_API_LEVEL := 21
3
diff --git a/target/product/runtime_libart.mk b/target/product/runtime_libart.mk
index 6d835fd42..71834aa5e 100644
--- a/target/product/runtime_libart.mk
+++ b/target/product/runtime_libart.mk
@@ -100,4 +100,5 @@ PRODUCT_SYSTEM_DEFAULT_PROPERTIES += \
100 100
101# Enable minidebuginfo generation unless overridden. 101# Enable minidebuginfo generation unless overridden.
102PRODUCT_SYSTEM_DEFAULT_PROPERTIES += \ 102PRODUCT_SYSTEM_DEFAULT_PROPERTIES += \
103 dalvik.vm.minidebuginfo=true \
103 dalvik.vm.dex2oat-minidebuginfo=true 104 dalvik.vm.dex2oat-minidebuginfo=true
diff --git a/target/product/telephony_system.mk b/target/product/telephony_system.mk
index 0b1e8a2a6..e30f0364f 100644
--- a/target/product/telephony_system.mk
+++ b/target/product/telephony_system.mk
@@ -19,9 +19,7 @@
19 19
20PRODUCT_PACKAGES := \ 20PRODUCT_PACKAGES := \
21 ANS \ 21 ANS \
22 CarrierConfig \
23 CarrierDefaultApp \ 22 CarrierDefaultApp \
24 Dialer \
25 CallLogBackup \ 23 CallLogBackup \
26 CellBroadcastReceiver \ 24 CellBroadcastReceiver \
27 EmergencyInfo \ 25 EmergencyInfo \
diff --git a/target/product/telephony_vendor.mk b/target/product/telephony_vendor.mk
index bddd3834e..4cff16dc8 100644
--- a/target/product/telephony_vendor.mk
+++ b/target/product/telephony_vendor.mk
@@ -17,7 +17,13 @@
17# This is the list of modules that are specific to products that have telephony 17# This is the list of modules that are specific to products that have telephony
18# hardware, and install outside the system partition. 18# hardware, and install outside the system partition.
19 19
20# /vendor packages
20PRODUCT_PACKAGES := \ 21PRODUCT_PACKAGES := \
21 rild \ 22 rild \
22 23
24# /product packages
25PRODUCT_PACKAGES += \
26 CarrierConfig \
27 Dialer \
28
23PRODUCT_COPY_FILES := \ 29PRODUCT_COPY_FILES := \
diff --git a/target/product/treble_common.mk b/target/product/treble_common.mk
index bbad48451..7642876af 100644
--- a/target/product/treble_common.mk
+++ b/target/product/treble_common.mk
@@ -38,7 +38,7 @@ PRODUCT_PACKAGES += \
38# Telephony: 38# Telephony:
39# Provide a default APN configuration 39# Provide a default APN configuration
40PRODUCT_COPY_FILES += \ 40PRODUCT_COPY_FILES += \
41 device/generic/goldfish/data/etc/apns-conf.xml:system/etc/apns-conf.xml 41 device/sample/etc/apns-full-conf.xml:system/etc/apns-conf.xml
42 42
43# NFC: 43# NFC:
44# Provide default libnfc-nci.conf file for devices that does not have one in 44# Provide default libnfc-nci.conf file for devices that does not have one in
@@ -48,12 +48,13 @@ PRODUCT_COPY_FILES += \
48 48
49# GSI specific tasks on boot 49# GSI specific tasks on boot
50PRODUCT_COPY_FILES += \ 50PRODUCT_COPY_FILES += \
51 build/make/target/product/vndk/init.gsi.rc:system/etc/init/init.gsi.rc 51 build/make/target/product/gsi/skip_mount.cfg:system/etc/init/config/skip_mount.cfg \
52 build/make/target/product/gsi/init.gsi.rc:system/etc/init/init.gsi.rc \
52 53
53# Support for the O-MR1 devices 54# Support for the O-MR1 devices
54PRODUCT_COPY_FILES += \ 55PRODUCT_COPY_FILES += \
55 build/make/target/product/vndk/init.legacy-gsi.rc:system/etc/init/init.legacy-gsi.rc \ 56 build/make/target/product/gsi/init.legacy-gsi.rc:system/etc/init/init.legacy-gsi.rc \
56 build/make/target/product/vndk/init.vndk-27.rc:system/etc/init/gsi/init.vndk-27.rc 57 build/make/target/product/gsi/init.vndk-27.rc:system/etc/init/gsi/init.vndk-27.rc
57 58
58# Name space configuration file for non-enforcing VNDK 59# Name space configuration file for non-enforcing VNDK
59PRODUCT_PACKAGES += \ 60PRODUCT_PACKAGES += \
diff --git a/target/product/vndk/init.gsi.rc b/target/product/vndk/init.gsi.rc
deleted file mode 100644
index 695820e87..000000000
--- a/target/product/vndk/init.gsi.rc
+++ /dev/null
@@ -1,2 +0,0 @@
1on early-init
2 umount /product # TODO(b/119391482): workaround for /system/product
diff --git a/tools/Android.mk b/tools/Android.mk
deleted file mode 100644
index c05d68155..000000000
--- a/tools/Android.mk
+++ /dev/null
@@ -1,23 +0,0 @@
1#
2# Copyright (C) 2010 The Android Open Source Project
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8# http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15#
16
17LOCAL_PATH := $(call my-dir)
18
19# Only if this Android.mk was included not by a symlink should it be used.
20# This facilitates the transition away from symlinks: b/64397960
21ifeq ($(LOCAL_PATH),build/make/tools)
22include $(call all-makefiles-under,$(LOCAL_PATH))
23endif
diff --git a/tools/buildinfo.sh b/tools/buildinfo.sh
index c2e6f8528..7286f95b3 100755
--- a/tools/buildinfo.sh
+++ b/tools/buildinfo.sh
@@ -8,6 +8,7 @@ echo "ro.build.display.id=$BUILD_DISPLAY_ID"
8echo "ro.build.version.incremental=$BUILD_NUMBER" 8echo "ro.build.version.incremental=$BUILD_NUMBER"
9echo "ro.build.version.sdk=$PLATFORM_SDK_VERSION" 9echo "ro.build.version.sdk=$PLATFORM_SDK_VERSION"
10echo "ro.build.version.preview_sdk=$PLATFORM_PREVIEW_SDK_VERSION" 10echo "ro.build.version.preview_sdk=$PLATFORM_PREVIEW_SDK_VERSION"
11echo "ro.build.version.preview_sdk_fingerprint=$PLATFORM_PREVIEW_SDK_FINGERPRINT"
11echo "ro.build.version.codename=$PLATFORM_VERSION_CODENAME" 12echo "ro.build.version.codename=$PLATFORM_VERSION_CODENAME"
12echo "ro.build.version.all_codenames=$PLATFORM_VERSION_ALL_CODENAMES" 13echo "ro.build.version.all_codenames=$PLATFORM_VERSION_ALL_CODENAMES"
13echo "ro.build.version.release=$PLATFORM_VERSION" 14echo "ro.build.version.release=$PLATFORM_VERSION"
@@ -17,8 +18,8 @@ echo "ro.build.version.min_supported_target_sdk=$PLATFORM_MIN_SUPPORTED_TARGET_S
17echo "ro.build.date=`$DATE`" 18echo "ro.build.date=`$DATE`"
18echo "ro.build.date.utc=`$DATE +%s`" 19echo "ro.build.date.utc=`$DATE +%s`"
19echo "ro.build.type=$TARGET_BUILD_TYPE" 20echo "ro.build.type=$TARGET_BUILD_TYPE"
20echo "ro.build.user=$USER" 21echo "ro.build.user=$BUILD_USERNAME"
21echo "ro.build.host=`hostname`" 22echo "ro.build.host=$BUILD_HOSTNAME"
22echo "ro.build.tags=$BUILD_VERSION_TAGS" 23echo "ro.build.tags=$BUILD_VERSION_TAGS"
23echo "ro.build.flavor=$TARGET_BUILD_FLAVOR" 24echo "ro.build.flavor=$TARGET_BUILD_FLAVOR"
24if [ -n "$BOARD_BUILD_SYSTEM_ROOT_IMAGE" ] ; then 25if [ -n "$BOARD_BUILD_SYSTEM_ROOT_IMAGE" ] ; then
diff --git a/tools/droiddoc/Android.mk b/tools/droiddoc/Android.mk
deleted file mode 100644
index ff08edc10..000000000
--- a/tools/droiddoc/Android.mk
+++ /dev/null
@@ -1,17 +0,0 @@
1# Copyright (C) 2008 The Android Open Source Project
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7# http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14
15LOCAL_PATH := $(call my-dir)
16
17# Droiddoc is now Doclava -- See external/doclava.
diff --git a/tools/fs_config/OWNERS b/tools/fs_config/OWNERS
new file mode 100644
index 000000000..55996449c
--- /dev/null
+++ b/tools/fs_config/OWNERS
@@ -0,0 +1,2 @@
1tomcherry@google.com
2salyzyn@google.com
diff --git a/tools/fs_config/fs_config_generate.c b/tools/fs_config/fs_config_generate.c
index 0f0603b23..dddd33174 100644
--- a/tools/fs_config/fs_config_generate.c
+++ b/tools/fs_config/fs_config_generate.c
@@ -41,22 +41,7 @@ static const struct fs_path_config android_device_dirs[] = { };
41#endif 41#endif
42 42
43#ifdef NO_ANDROID_FILESYSTEM_CONFIG_DEVICE_FILES 43#ifdef NO_ANDROID_FILESYSTEM_CONFIG_DEVICE_FILES
44static const struct fs_path_config android_device_files[] = { 44static const struct fs_path_config android_device_files[] = { };
45#ifdef NO_ANDROID_FILESYSTEM_CONFIG_DEVICE_DIRS
46 {0000, AID_ROOT, AID_ROOT, 0, "system/etc/fs_config_dirs"},
47 {0000, AID_ROOT, AID_ROOT, 0, "vendor/etc/fs_config_dirs"},
48 {0000, AID_ROOT, AID_ROOT, 0, "oem/etc/fs_config_dirs"},
49 {0000, AID_ROOT, AID_ROOT, 0, "odm/etc/fs_config_dirs"},
50 {0000, AID_ROOT, AID_ROOT, 0, "product/etc/fs_config_dirs"},
51 {0000, AID_ROOT, AID_ROOT, 0, "product_services/etc/fs_config_dirs"},
52#endif
53 {0000, AID_ROOT, AID_ROOT, 0, "system/etc/fs_config_files"},
54 {0000, AID_ROOT, AID_ROOT, 0, "vendor/etc/fs_config_files"},
55 {0000, AID_ROOT, AID_ROOT, 0, "oem/etc/fs_config_files"},
56 {0000, AID_ROOT, AID_ROOT, 0, "odm/etc/fs_config_files"},
57 {0000, AID_ROOT, AID_ROOT, 0, "product/etc/fs_config_files"},
58 {0000, AID_ROOT, AID_ROOT, 0, "product_services/etc/fs_config_files"},
59};
60#endif 45#endif
61 46
62static void usage() { 47static void usage() {
diff --git a/tools/fs_config/fs_config_generator.py b/tools/fs_config/fs_config_generator.py
index f7e3eb2c1..0a8def8e0 100755
--- a/tools/fs_config/fs_config_generator.py
+++ b/tools/fs_config/fs_config_generator.py
@@ -909,22 +909,6 @@ class FSConfigGen(BaseGenerator):
909 '#warning No device-supplied android_filesystem_config.h,' 909 '#warning No device-supplied android_filesystem_config.h,'
910 ' using empty default.') 910 ' using empty default.')
911 911
912 # Long names.
913 # pylint: disable=invalid-name
914 _NO_ANDROID_FILESYSTEM_CONFIG_DEVICE_DIRS_ENTRY = (
915 '{ 00000, AID_ROOT, AID_ROOT, 0,'
916 '"system/etc/fs_config_dirs" },')
917
918 _NO_ANDROID_FILESYSTEM_CONFIG_DEVICE_FILES_ENTRY = (
919 '{ 00000, AID_ROOT, AID_ROOT, 0,'
920 '"system/etc/fs_config_files" },')
921
922 _IFDEF_ANDROID_FILESYSTEM_CONFIG_DEVICE_DIRS = (
923 '#ifdef NO_ANDROID_FILESYSTEM_CONFIG_DEVICE_DIRS')
924 # pylint: enable=invalid-name
925
926 _ENDIF = '#endif'
927
928 _OPEN_FILE_STRUCT = ( 912 _OPEN_FILE_STRUCT = (
929 'static const struct fs_path_config android_device_files[] = {') 913 'static const struct fs_path_config android_device_files[] = {')
930 914
@@ -1082,12 +1066,6 @@ class FSConfigGen(BaseGenerator):
1082 for fs_config in files: 1066 for fs_config in files:
1083 self._to_fs_entry(fs_config) 1067 self._to_fs_entry(fs_config)
1084 1068
1085 if not are_dirs:
1086 print FSConfigGen._IFDEF_ANDROID_FILESYSTEM_CONFIG_DEVICE_DIRS
1087 print(
1088 ' ' +
1089 FSConfigGen._NO_ANDROID_FILESYSTEM_CONFIG_DEVICE_DIRS_ENTRY)
1090 print FSConfigGen._ENDIF
1091 print FSConfigGen._CLOSE_FILE_STRUCT 1069 print FSConfigGen._CLOSE_FILE_STRUCT
1092 1070
1093 if are_dirs: 1071 if are_dirs:
@@ -1316,6 +1294,28 @@ class GroupGen(PasswdGen):
1316 1294
1317 print "%s::%s:" % (logon, uid) 1295 print "%s::%s:" % (logon, uid)
1318 1296
1297@generator('print')
1298class PrintGen(BaseGenerator):
1299 """Prints just the constants and values, separated by spaces, in an easy to
1300 parse format for use by other scripts.
1301
1302 Each line is just the identifier and the value, separated by a space.
1303 """
1304
1305 def add_opts(self, opt_group):
1306 opt_group.add_argument(
1307 'aid-header', help='An android_filesystem_config.h file.')
1308
1309 def __call__(self, args):
1310
1311 hdr_parser = AIDHeaderParser(args['aid-header'])
1312 aids = hdr_parser.aids
1313
1314 aids.sort(key=lambda item: int(item.normalized_value))
1315
1316 for aid in aids:
1317 print '%s %s' % (aid.identifier, aid.normalized_value)
1318
1319 1319
1320def main(): 1320def main():
1321 """Main entry point for execution.""" 1321 """Main entry point for execution."""
diff --git a/tools/releasetools/add_img_to_target_files.py b/tools/releasetools/add_img_to_target_files.py
index 1872a5812..da5ea4aa1 100755
--- a/tools/releasetools/add_img_to_target_files.py
+++ b/tools/releasetools/add_img_to_target_files.py
@@ -859,11 +859,12 @@ def AddImagesToTargetFiles(filename):
859 banner("vbmeta") 859 banner("vbmeta")
860 AddVBMeta(output_zip, partitions, "vbmeta", vbmeta_partitions) 860 AddVBMeta(output_zip, partitions, "vbmeta", vbmeta_partitions)
861 861
862 if OPTIONS.info_dict.get("build_super_partition"): 862 if OPTIONS.info_dict.get("build_super_partition") == "true":
863 banner("super_empty") 863 banner("super_empty")
864 AddSuperEmpty(output_zip) 864 AddSuperEmpty(output_zip)
865 865
866 if OPTIONS.info_dict.get("dynamic_partition_retrofit") == "true": 866 if OPTIONS.info_dict.get(
867 "build_retrofit_dynamic_partitions_ota_package") == "true":
867 banner("super split images") 868 banner("super split images")
868 AddSuperSplit(output_zip) 869 AddSuperSplit(output_zip)
869 870
diff --git a/tools/releasetools/blockimgdiff.py b/tools/releasetools/blockimgdiff.py
index 2d20e23fd..80d402371 100644
--- a/tools/releasetools/blockimgdiff.py
+++ b/tools/releasetools/blockimgdiff.py
@@ -26,7 +26,8 @@ import os.path
26import re 26import re
27import sys 27import sys
28import threading 28import threading
29from collections import deque, OrderedDict 29import zlib
30from collections import deque, namedtuple, OrderedDict
30from hashlib import sha1 31from hashlib import sha1
31 32
32import common 33import common
@@ -36,8 +37,12 @@ __all__ = ["EmptyImage", "DataImage", "BlockImageDiff"]
36 37
37logger = logging.getLogger(__name__) 38logger = logging.getLogger(__name__)
38 39
40# The tuple contains the style and bytes of a bsdiff|imgdiff patch.
41PatchInfo = namedtuple("PatchInfo", ["imgdiff", "content"])
42
39 43
40def compute_patch(srcfile, tgtfile, imgdiff=False): 44def compute_patch(srcfile, tgtfile, imgdiff=False):
45 """Calls bsdiff|imgdiff to compute the patch data, returns a PatchInfo."""
41 patchfile = common.MakeTempFile(prefix='patch-') 46 patchfile = common.MakeTempFile(prefix='patch-')
42 47
43 cmd = ['imgdiff', '-z'] if imgdiff else ['bsdiff'] 48 cmd = ['imgdiff', '-z'] if imgdiff else ['bsdiff']
@@ -52,7 +57,7 @@ def compute_patch(srcfile, tgtfile, imgdiff=False):
52 raise ValueError(output) 57 raise ValueError(output)
53 58
54 with open(patchfile, 'rb') as f: 59 with open(patchfile, 'rb') as f:
55 return f.read() 60 return PatchInfo(imgdiff, f.read())
56 61
57 62
58class Image(object): 63class Image(object):
@@ -203,17 +208,17 @@ class Transfer(object):
203 self.id = len(by_id) 208 self.id = len(by_id)
204 by_id.append(self) 209 by_id.append(self)
205 210
206 self._patch = None 211 self._patch_info = None
207 212
208 @property 213 @property
209 def patch(self): 214 def patch_info(self):
210 return self._patch 215 return self._patch_info
211 216
212 @patch.setter 217 @patch_info.setter
213 def patch(self, patch): 218 def patch_info(self, info):
214 if patch: 219 if info:
215 assert self.style == "diff" 220 assert self.style == "diff"
216 self._patch = patch 221 self._patch_info = info
217 222
218 def NetStashChange(self): 223 def NetStashChange(self):
219 return (sum(sr.size() for (_, sr) in self.stash_before) - 224 return (sum(sr.size() for (_, sr) in self.stash_before) -
@@ -224,7 +229,7 @@ class Transfer(object):
224 self.use_stash = [] 229 self.use_stash = []
225 self.style = "new" 230 self.style = "new"
226 self.src_ranges = RangeSet() 231 self.src_ranges = RangeSet()
227 self.patch = None 232 self.patch_info = None
228 233
229 def __str__(self): 234 def __str__(self):
230 return (str(self.id) + ": <" + str(self.src_ranges) + " " + self.style + 235 return (str(self.id) + ": <" + str(self.src_ranges) + " " + self.style +
@@ -462,19 +467,27 @@ class BlockImageDiff(object):
462 self.AbbreviateSourceNames() 467 self.AbbreviateSourceNames()
463 self.FindTransfers() 468 self.FindTransfers()
464 469
465 # Find the ordering dependencies among transfers (this is O(n^2) 470 self.FindSequenceForTransfers()
466 # in the number of transfers).
467 self.GenerateDigraph()
468 # Find a sequence of transfers that satisfies as many ordering
469 # dependencies as possible (heuristically).
470 self.FindVertexSequence()
471 # Fix up the ordering dependencies that the sequence didn't
472 # satisfy.
473 self.ReverseBackwardEdges()
474 self.ImproveVertexSequence()
475 471
476 # Ensure the runtime stash size is under the limit. 472 # Ensure the runtime stash size is under the limit.
477 if common.OPTIONS.cache_size is not None: 473 if common.OPTIONS.cache_size is not None:
474 stash_limit = (common.OPTIONS.cache_size *
475 common.OPTIONS.stash_threshold / self.tgt.blocksize)
476 # Ignore the stash limit and calculate the maximum simultaneously stashed
477 # blocks needed.
478 _, max_stashed_blocks = self.ReviseStashSize(ignore_stash_limit=True)
479
480 # We cannot stash more blocks than the stash limit simultaneously. As a
481 # result, some 'diff' commands will be converted to new; leading to an
482 # unintended large package. To mitigate this issue, we can carefully
483 # choose the transfers for conversion. The number '1024' can be further
484 # tweaked here to balance the package size and build time.
485 if max_stashed_blocks > stash_limit + 1024:
486 self.SelectAndConvertDiffTransfersToNew()
487 # Regenerate the sequence as the graph has changed.
488 self.FindSequenceForTransfers()
489
490 # Revise the stash size again to keep the size under limit.
478 self.ReviseStashSize() 491 self.ReviseStashSize()
479 492
480 # Double-check our work. 493 # Double-check our work.
@@ -704,7 +717,21 @@ class BlockImageDiff(object):
704 "max stashed blocks: %d (%d bytes), limit: <unknown>\n", 717 "max stashed blocks: %d (%d bytes), limit: <unknown>\n",
705 max_stashed_blocks, self._max_stashed_size) 718 max_stashed_blocks, self._max_stashed_size)
706 719
707 def ReviseStashSize(self): 720 def ReviseStashSize(self, ignore_stash_limit=False):
721 """ Revises the transfers to keep the stash size within the size limit.
722
723 Iterates through the transfer list and calculates the stash size each
724 transfer generates. Converts the affected transfers to new if we reach the
725 stash limit.
726
727 Args:
728 ignore_stash_limit: Ignores the stash limit and calculates the max
729 simultaneous stashed blocks instead. No change will be made to the
730 transfer list with this flag.
731
732 Return:
733 A tuple of (tgt blocks converted to new, max stashed blocks)
734 """
708 logger.info("Revising stash size...") 735 logger.info("Revising stash size...")
709 stash_map = {} 736 stash_map = {}
710 737
@@ -719,16 +746,19 @@ class BlockImageDiff(object):
719 for stash_raw_id, _ in xf.use_stash: 746 for stash_raw_id, _ in xf.use_stash:
720 stash_map[stash_raw_id] += (xf,) 747 stash_map[stash_raw_id] += (xf,)
721 748
722 # Compute the maximum blocks available for stash based on /cache size and 749 max_allowed_blocks = None
723 # the threshold. 750 if not ignore_stash_limit:
724 cache_size = common.OPTIONS.cache_size 751 # Compute the maximum blocks available for stash based on /cache size and
725 stash_threshold = common.OPTIONS.stash_threshold 752 # the threshold.
726 max_allowed = cache_size * stash_threshold / self.tgt.blocksize 753 cache_size = common.OPTIONS.cache_size
754 stash_threshold = common.OPTIONS.stash_threshold
755 max_allowed_blocks = cache_size * stash_threshold / self.tgt.blocksize
727 756
728 # See the comments for 'stashes' in WriteTransfers(). 757 # See the comments for 'stashes' in WriteTransfers().
729 stashes = {} 758 stashes = {}
730 stashed_blocks = 0 759 stashed_blocks = 0
731 new_blocks = 0 760 new_blocks = 0
761 max_stashed_blocks = 0
732 762
733 # Now go through all the commands. Compute the required stash size on the 763 # Now go through all the commands. Compute the required stash size on the
734 # fly. If a command requires excess stash than available, it deletes the 764 # fly. If a command requires excess stash than available, it deletes the
@@ -745,7 +775,7 @@ class BlockImageDiff(object):
745 if sh not in stashes: 775 if sh not in stashes:
746 stashed_blocks_after += sr.size() 776 stashed_blocks_after += sr.size()
747 777
748 if stashed_blocks_after > max_allowed: 778 if max_allowed_blocks and stashed_blocks_after > max_allowed_blocks:
749 # We cannot stash this one for a later command. Find out the command 779 # We cannot stash this one for a later command. Find out the command
750 # that will use this stash and replace the command with "new". 780 # that will use this stash and replace the command with "new".
751 use_cmd = stash_map[stash_raw_id][2] 781 use_cmd = stash_map[stash_raw_id][2]
@@ -758,15 +788,21 @@ class BlockImageDiff(object):
758 else: 788 else:
759 stashes[sh] = 1 789 stashes[sh] = 1
760 stashed_blocks = stashed_blocks_after 790 stashed_blocks = stashed_blocks_after
791 max_stashed_blocks = max(max_stashed_blocks, stashed_blocks)
761 792
762 # "move" and "diff" may introduce implicit stashes in BBOTA v3. Prior to 793 # "move" and "diff" may introduce implicit stashes in BBOTA v3. Prior to
763 # ComputePatches(), they both have the style of "diff". 794 # ComputePatches(), they both have the style of "diff".
764 if xf.style == "diff": 795 if xf.style == "diff":
765 assert xf.tgt_ranges and xf.src_ranges 796 assert xf.tgt_ranges and xf.src_ranges
766 if xf.src_ranges.overlaps(xf.tgt_ranges): 797 if xf.src_ranges.overlaps(xf.tgt_ranges):
767 if stashed_blocks + xf.src_ranges.size() > max_allowed: 798 if (max_allowed_blocks and
799 stashed_blocks + xf.src_ranges.size() > max_allowed_blocks):
768 replaced_cmds.append(xf) 800 replaced_cmds.append(xf)
769 logger.info("%10d %9s %s", xf.src_ranges.size(), "implicit", xf) 801 logger.info("%10d %9s %s", xf.src_ranges.size(), "implicit", xf)
802 else:
803 # The whole source ranges will be stashed for implicit stashes.
804 max_stashed_blocks = max(max_stashed_blocks,
805 stashed_blocks + xf.src_ranges.size())
770 806
771 # Replace the commands in replaced_cmds with "new"s. 807 # Replace the commands in replaced_cmds with "new"s.
772 for cmd in replaced_cmds: 808 for cmd in replaced_cmds:
@@ -795,7 +831,7 @@ class BlockImageDiff(object):
795 logger.info( 831 logger.info(
796 " Total %d blocks (%d bytes) are packed as new blocks due to " 832 " Total %d blocks (%d bytes) are packed as new blocks due to "
797 "insufficient cache size.", new_blocks, num_of_bytes) 833 "insufficient cache size.", new_blocks, num_of_bytes)
798 return new_blocks 834 return new_blocks, max_stashed_blocks
799 835
800 def ComputePatches(self, prefix): 836 def ComputePatches(self, prefix):
801 logger.info("Reticulating splines...") 837 logger.info("Reticulating splines...")
@@ -829,7 +865,7 @@ class BlockImageDiff(object):
829 # These are identical; we don't need to generate a patch, 865 # These are identical; we don't need to generate a patch,
830 # just issue copy commands on the device. 866 # just issue copy commands on the device.
831 xf.style = "move" 867 xf.style = "move"
832 xf.patch = None 868 xf.patch_info = None
833 tgt_size = xf.tgt_ranges.size() * self.tgt.blocksize 869 tgt_size = xf.tgt_ranges.size() * self.tgt.blocksize
834 if xf.src_ranges != xf.tgt_ranges: 870 if xf.src_ranges != xf.tgt_ranges:
835 logger.info( 871 logger.info(
@@ -839,11 +875,10 @@ class BlockImageDiff(object):
839 xf.tgt_name + " (from " + xf.src_name + ")"), 875 xf.tgt_name + " (from " + xf.src_name + ")"),
840 str(xf.tgt_ranges), str(xf.src_ranges)) 876 str(xf.tgt_ranges), str(xf.src_ranges))
841 else: 877 else:
842 if xf.patch: 878 if xf.patch_info:
843 # We have already generated the patch with imgdiff, while 879 # We have already generated the patch (e.g. during split of large
844 # splitting large APKs (i.e. in FindTransfers()). 880 # APKs or reduction of stash size)
845 assert not self.disable_imgdiff 881 imgdiff = xf.patch_info.imgdiff
846 imgdiff = True
847 else: 882 else:
848 imgdiff = self.CanUseImgdiff( 883 imgdiff = self.CanUseImgdiff(
849 xf.tgt_name, xf.tgt_ranges, xf.src_ranges) 884 xf.tgt_name, xf.tgt_ranges, xf.src_ranges)
@@ -854,85 +889,16 @@ class BlockImageDiff(object):
854 else: 889 else:
855 assert False, "unknown style " + xf.style 890 assert False, "unknown style " + xf.style
856 891
857 if diff_queue: 892 patches = self.ComputePatchesForInputList(diff_queue, False)
858 if self.threads > 1:
859 logger.info("Computing patches (using %d threads)...", self.threads)
860 else:
861 logger.info("Computing patches...")
862
863 diff_total = len(diff_queue)
864 patches = [None] * diff_total
865 error_messages = []
866
867 # Using multiprocessing doesn't give additional benefits, due to the
868 # pattern of the code. The diffing work is done by subprocess.call, which
869 # already runs in a separate process (not affected much by the GIL -
870 # Global Interpreter Lock). Using multiprocess also requires either a)
871 # writing the diff input files in the main process before forking, or b)
872 # reopening the image file (SparseImage) in the worker processes. Doing
873 # neither of them further improves the performance.
874 lock = threading.Lock()
875 def diff_worker():
876 while True:
877 with lock:
878 if not diff_queue:
879 return
880 xf_index, imgdiff, patch_index = diff_queue.pop()
881 xf = self.transfers[xf_index]
882
883 patch = xf.patch
884 if not patch:
885 src_ranges = xf.src_ranges
886 tgt_ranges = xf.tgt_ranges
887
888 src_file = common.MakeTempFile(prefix="src-")
889 with open(src_file, "wb") as fd:
890 self.src.WriteRangeDataToFd(src_ranges, fd)
891
892 tgt_file = common.MakeTempFile(prefix="tgt-")
893 with open(tgt_file, "wb") as fd:
894 self.tgt.WriteRangeDataToFd(tgt_ranges, fd)
895
896 message = []
897 try:
898 patch = compute_patch(src_file, tgt_file, imgdiff)
899 except ValueError as e:
900 message.append(
901 "Failed to generate %s for %s: tgt=%s, src=%s:\n%s" % (
902 "imgdiff" if imgdiff else "bsdiff",
903 xf.tgt_name if xf.tgt_name == xf.src_name else
904 xf.tgt_name + " (from " + xf.src_name + ")",
905 xf.tgt_ranges, xf.src_ranges, e.message))
906 if message:
907 with lock:
908 error_messages.extend(message)
909
910 with lock:
911 patches[patch_index] = (xf_index, patch)
912
913 threads = [threading.Thread(target=diff_worker)
914 for _ in range(self.threads)]
915 for th in threads:
916 th.start()
917 while threads:
918 threads.pop().join()
919
920 if error_messages:
921 logger.error('ERROR:')
922 logger.error('\n'.join(error_messages))
923 logger.error('\n\n\n')
924 sys.exit(1)
925 else:
926 patches = []
927 893
928 offset = 0 894 offset = 0
929 with open(prefix + ".patch.dat", "wb") as patch_fd: 895 with open(prefix + ".patch.dat", "wb") as patch_fd:
930 for index, patch in patches: 896 for index, patch_info, _ in patches:
931 xf = self.transfers[index] 897 xf = self.transfers[index]
932 xf.patch_len = len(patch) 898 xf.patch_len = len(patch_info.content)
933 xf.patch_start = offset 899 xf.patch_start = offset
934 offset += xf.patch_len 900 offset += xf.patch_len
935 patch_fd.write(patch) 901 patch_fd.write(patch_info.content)
936 902
937 tgt_size = xf.tgt_ranges.size() * self.tgt.blocksize 903 tgt_size = xf.tgt_ranges.size() * self.tgt.blocksize
938 logger.info( 904 logger.info(
@@ -999,6 +965,32 @@ class BlockImageDiff(object):
999 for i in range(s, e): 965 for i in range(s, e):
1000 assert touched[i] == 1 966 assert touched[i] == 1
1001 967
968 def FindSequenceForTransfers(self):
969 """Finds a sequence for the given transfers.
970
971 The goal is to minimize the violation of order dependencies between these
972 transfers, so that fewer blocks are stashed when applying the update.
973 """
974
975 # Clear the existing dependency between transfers
976 for xf in self.transfers:
977 xf.goes_before = OrderedDict()
978 xf.goes_after = OrderedDict()
979
980 xf.stash_before = []
981 xf.use_stash = []
982
983 # Find the ordering dependencies among transfers (this is O(n^2)
984 # in the number of transfers).
985 self.GenerateDigraph()
986 # Find a sequence of transfers that satisfies as many ordering
987 # dependencies as possible (heuristically).
988 self.FindVertexSequence()
989 # Fix up the ordering dependencies that the sequence didn't
990 # satisfy.
991 self.ReverseBackwardEdges()
992 self.ImproveVertexSequence()
993
1002 def ImproveVertexSequence(self): 994 def ImproveVertexSequence(self):
1003 logger.info("Improving vertex order...") 995 logger.info("Improving vertex order...")
1004 996
@@ -1248,6 +1240,152 @@ class BlockImageDiff(object):
1248 b.goes_before[a] = size 1240 b.goes_before[a] = size
1249 a.goes_after[b] = size 1241 a.goes_after[b] = size
1250 1242
1243 def ComputePatchesForInputList(self, diff_queue, compress_target):
1244 """Returns a list of patch information for the input list of transfers.
1245
1246 Args:
1247 diff_queue: a list of transfers with style 'diff'
1248 compress_target: If True, compresses the target ranges of each
1249 transfers; and save the size.
1250
1251 Returns:
1252 A list of (transfer order, patch_info, compressed_size) tuples.
1253 """
1254
1255 if not diff_queue:
1256 return []
1257
1258 if self.threads > 1:
1259 logger.info("Computing patches (using %d threads)...", self.threads)
1260 else:
1261 logger.info("Computing patches...")
1262
1263 diff_total = len(diff_queue)
1264 patches = [None] * diff_total
1265 error_messages = []
1266
1267 # Using multiprocessing doesn't give additional benefits, due to the
1268 # pattern of the code. The diffing work is done by subprocess.call, which
1269 # already runs in a separate process (not affected much by the GIL -
1270 # Global Interpreter Lock). Using multiprocess also requires either a)
1271 # writing the diff input files in the main process before forking, or b)
1272 # reopening the image file (SparseImage) in the worker processes. Doing
1273 # neither of them further improves the performance.
1274 lock = threading.Lock()
1275
1276 def diff_worker():
1277 while True:
1278 with lock:
1279 if not diff_queue:
1280 return
1281 xf_index, imgdiff, patch_index = diff_queue.pop()
1282 xf = self.transfers[xf_index]
1283
1284 message = []
1285 compressed_size = None
1286
1287 patch_info = xf.patch_info
1288 if not patch_info:
1289 src_file = common.MakeTempFile(prefix="src-")
1290 with open(src_file, "wb") as fd:
1291 self.src.WriteRangeDataToFd(xf.src_ranges, fd)
1292
1293 tgt_file = common.MakeTempFile(prefix="tgt-")
1294 with open(tgt_file, "wb") as fd:
1295 self.tgt.WriteRangeDataToFd(xf.tgt_ranges, fd)
1296
1297 try:
1298 patch_info = compute_patch(src_file, tgt_file, imgdiff)
1299 except ValueError as e:
1300 message.append(
1301 "Failed to generate %s for %s: tgt=%s, src=%s:\n%s" % (
1302 "imgdiff" if imgdiff else "bsdiff",
1303 xf.tgt_name if xf.tgt_name == xf.src_name else
1304 xf.tgt_name + " (from " + xf.src_name + ")",
1305 xf.tgt_ranges, xf.src_ranges, e.message))
1306
1307 if compress_target:
1308 tgt_data = self.tgt.ReadRangeSet(xf.tgt_ranges)
1309 try:
1310 # Compresses with the default level
1311 compress_obj = zlib.compressobj(6, zlib.DEFLATED, -zlib.MAX_WBITS)
1312 compressed_data = (compress_obj.compress("".join(tgt_data))
1313 + compress_obj.flush())
1314 compressed_size = len(compressed_data)
1315 except zlib.error as e:
1316 message.append(
1317 "Failed to compress the data in target range {} for {}:\n"
1318 "{}".format(xf.tgt_ranges, xf.tgt_name, e.message))
1319
1320 if message:
1321 with lock:
1322 error_messages.extend(message)
1323
1324 with lock:
1325 patches[patch_index] = (xf_index, patch_info, compressed_size)
1326
1327 threads = [threading.Thread(target=diff_worker)
1328 for _ in range(self.threads)]
1329 for th in threads:
1330 th.start()
1331 while threads:
1332 threads.pop().join()
1333
1334 if error_messages:
1335 logger.error('ERROR:')
1336 logger.error('\n'.join(error_messages))
1337 logger.error('\n\n\n')
1338 sys.exit(1)
1339
1340 return patches
1341
1342 def SelectAndConvertDiffTransfersToNew(self):
1343 """Converts the diff transfers to reduce the max simultaneous stash.
1344
1345 Since the 'new' data is compressed with deflate, we can select the 'diff'
1346 transfers for conversion by comparing its patch size with the size of the
1347 compressed data. Ideally, we want to convert the transfers with a small
1348 size increase, but using a large number of stashed blocks.
1349 """
1350
1351 logger.info("Selecting diff commands to convert to new.")
1352 diff_queue = []
1353 for xf in self.transfers:
1354 if xf.style == "diff" and xf.src_sha1 != xf.tgt_sha1:
1355 use_imgdiff = self.CanUseImgdiff(xf.tgt_name, xf.tgt_ranges,
1356 xf.src_ranges)
1357 diff_queue.append((xf.order, use_imgdiff, len(diff_queue)))
1358
1359 # Remove the 'move' transfers, and compute the patch & compressed size
1360 # for the remaining.
1361 result = self.ComputePatchesForInputList(diff_queue, True)
1362
1363 removed_stashed_blocks = 0
1364 for xf_index, patch_info, compressed_size in result:
1365 xf = self.transfers[xf_index]
1366 if not xf.patch_info:
1367 xf.patch_info = patch_info
1368
1369 size_ratio = len(xf.patch_info.content) * 100.0 / compressed_size
1370 diff_style = "imgdiff" if xf.patch_info.imgdiff else "bsdiff"
1371 logger.info("%s, target size: %d, style: %s, patch size: %d,"
1372 " compression_size: %d, ratio %.2f%%", xf.tgt_name,
1373 xf.tgt_ranges.size(), diff_style,
1374 len(xf.patch_info.content), compressed_size, size_ratio)
1375
1376 # Convert the transfer to new if the compressed size is smaller or equal.
1377 # We don't need to maintain the stash_before lists here because the
1378 # graph will be regenerated later.
1379 if len(xf.patch_info.content) >= compressed_size:
1380 removed_stashed_blocks += sum(sr.size() for _, sr in xf.use_stash)
1381 logger.info("Converting %s to new", xf.tgt_name)
1382 xf.ConvertToNew()
1383
1384 # TODO(xunchang) convert more transfers by sorting:
1385 # (compressed size - patch_size) / used_stashed_blocks
1386
1387 logger.info("Removed %d stashed blocks", removed_stashed_blocks)
1388
1251 def FindTransfers(self): 1389 def FindTransfers(self):
1252 """Parse the file_map to generate all the transfers.""" 1390 """Parse the file_map to generate all the transfers."""
1253 1391
@@ -1585,7 +1723,7 @@ class BlockImageDiff(object):
1585 self.tgt.RangeSha1(tgt_ranges), 1723 self.tgt.RangeSha1(tgt_ranges),
1586 self.src.RangeSha1(src_ranges), 1724 self.src.RangeSha1(src_ranges),
1587 "diff", self.transfers) 1725 "diff", self.transfers)
1588 transfer_split.patch = patch 1726 transfer_split.patch_info = PatchInfo(True, patch)
1589 1727
1590 def AbbreviateSourceNames(self): 1728 def AbbreviateSourceNames(self):
1591 for k in self.src.file_map.keys(): 1729 for k in self.src.file_map.keys():
diff --git a/tools/releasetools/build_image.py b/tools/releasetools/build_image.py
index 9612499bd..521b319ed 100755
--- a/tools/releasetools/build_image.py
+++ b/tools/releasetools/build_image.py
@@ -75,26 +75,30 @@ def GetInodeUsage(path):
75 """ 75 """
76 cmd = ["find", path, "-print"] 76 cmd = ["find", path, "-print"]
77 output = common.RunAndCheckOutput(cmd, verbose=False) 77 output = common.RunAndCheckOutput(cmd, verbose=False)
78 # increase by > 4% as number of files and directories is not whole picture. 78 # TODO(b/122328872) Fix estimation algorithm to not need the multiplier.
79 return output.count('\n') * 25 // 24 79 return output.count('\n') * 2
80 80
81 81
82def GetFilesystemCharacteristics(sparse_image_path): 82def GetFilesystemCharacteristics(image_path, sparse_image=True):
83 """Returns various filesystem characteristics of "sparse_image_path". 83 """Returns various filesystem characteristics of "image_path".
84 84
85 Args: 85 Args:
86 sparse_image_path: The file to analyze. 86 image_path: The file to analyze.
87 sparse_image: Image is sparse
87 88
88 Returns: 89 Returns:
89 The characteristics dictionary. 90 The characteristics dictionary.
90 """ 91 """
91 unsparse_image_path = UnsparseImage(sparse_image_path, replace=False) 92 unsparse_image_path = image_path
93 if sparse_image:
94 unsparse_image_path = UnsparseImage(image_path, replace=False)
92 95
93 cmd = ["tune2fs", "-l", unsparse_image_path] 96 cmd = ["tune2fs", "-l", unsparse_image_path]
94 try: 97 try:
95 output = common.RunAndCheckOutput(cmd, verbose=False) 98 output = common.RunAndCheckOutput(cmd, verbose=False)
96 finally: 99 finally:
97 os.remove(unsparse_image_path) 100 if sparse_image:
101 os.remove(unsparse_image_path)
98 fs_dict = {} 102 fs_dict = {}
99 for line in output.splitlines(): 103 for line in output.splitlines():
100 fields = line.split(":") 104 fields = line.split(":")
@@ -280,6 +284,7 @@ def BuildImageMkfs(in_dir, prop_dict, out_file, target_out, fs_config):
280 build_command.extend(["-S", prop_dict["hash_seed"]]) 284 build_command.extend(["-S", prop_dict["hash_seed"]])
281 if "ext4_share_dup_blocks" in prop_dict: 285 if "ext4_share_dup_blocks" in prop_dict:
282 build_command.append("-c") 286 build_command.append("-c")
287 build_command.extend(["--inode_size", "256"])
283 if "selinux_fc" in prop_dict: 288 if "selinux_fc" in prop_dict:
284 build_command.append(prop_dict["selinux_fc"]) 289 build_command.append(prop_dict["selinux_fc"])
285 elif fs_type.startswith("squash"): 290 elif fs_type.startswith("squash"):
@@ -413,7 +418,10 @@ def BuildImage(in_dir, prop_dict, out_file, target_out=None):
413 "First Pass based on estimates of %d MB and %s inodes.", 418 "First Pass based on estimates of %d MB and %s inodes.",
414 size // BYTES_IN_MB, prop_dict["extfs_inode_count"]) 419 size // BYTES_IN_MB, prop_dict["extfs_inode_count"])
415 BuildImageMkfs(in_dir, prop_dict, out_file, target_out, fs_config) 420 BuildImageMkfs(in_dir, prop_dict, out_file, target_out, fs_config)
416 fs_dict = GetFilesystemCharacteristics(out_file) 421 sparse_image = False
422 if "extfs_sparse_flag" in prop_dict:
423 sparse_image = True
424 fs_dict = GetFilesystemCharacteristics(out_file, sparse_image)
417 os.remove(out_file) 425 os.remove(out_file)
418 block_size = int(fs_dict.get("Block size", "4096")) 426 block_size = int(fs_dict.get("Block size", "4096"))
419 free_size = int(fs_dict.get("Free blocks", "0")) * block_size 427 free_size = int(fs_dict.get("Free blocks", "0")) * block_size
@@ -427,16 +435,21 @@ def BuildImage(in_dir, prop_dict, out_file, target_out=None):
427 else: 435 else:
428 size -= free_size 436 size -= free_size
429 size += reserved_size 437 size += reserved_size
438 if reserved_size == 0:
439 # add .2% margin
440 size = size * 1002 // 1000
441 # Use a minimum size, otherwise we will fail to calculate an AVB footer
442 # or fail to construct an ext4 image.
443 size = max(size, 256 * 1024)
430 if block_size <= 4096: 444 if block_size <= 4096:
431 size = common.RoundUpTo4K(size) 445 size = common.RoundUpTo4K(size)
432 else: 446 else:
433 size = ((size + block_size - 1) // block_size) * block_size 447 size = ((size + block_size - 1) // block_size) * block_size
434 # Use a minimum size, otherwise we will fail to calculate an AVB footer
435 # or fail to construct an ext4 image.
436 size = max(size, 256 * 1024)
437 extfs_inode_count = prop_dict["extfs_inode_count"] 448 extfs_inode_count = prop_dict["extfs_inode_count"]
438 inodes = int(fs_dict.get("Inode count", extfs_inode_count)) 449 inodes = int(fs_dict.get("Inode count", extfs_inode_count))
439 inodes -= int(fs_dict.get("Free inodes", "0")) 450 inodes -= int(fs_dict.get("Free inodes", "0"))
451 # add .2% margin
452 inodes = inodes * 1002 // 1000
440 prop_dict["extfs_inode_count"] = str(inodes) 453 prop_dict["extfs_inode_count"] = str(inodes)
441 prop_dict["partition_size"] = str(size) 454 prop_dict["partition_size"] = str(size)
442 logger.info( 455 logger.info(
diff --git a/tools/releasetools/build_super_image.py b/tools/releasetools/build_super_image.py
index e8730ae19..bb0e6413a 100755
--- a/tools/releasetools/build_super_image.py
+++ b/tools/releasetools/build_super_image.py
@@ -67,6 +67,17 @@ def GetPartitionSizeFromImage(img):
67 return os.path.getsize(img) 67 return os.path.getsize(img)
68 68
69 69
70def GetArgumentsForImage(partition, group, image=None):
71 image_size = GetPartitionSizeFromImage(image) if image else 0
72
73 cmd = ["--partition",
74 "{}:readonly:{}:{}".format(partition, image_size, group)]
75 if image:
76 cmd += ["--image", "{}={}".format(partition, image)]
77
78 return cmd
79
80
70def BuildSuperImageFromDict(info_dict, output): 81def BuildSuperImageFromDict(info_dict, output):
71 82
72 cmd = [info_dict["lpmake"], 83 cmd = [info_dict["lpmake"],
@@ -105,26 +116,25 @@ def BuildSuperImageFromDict(info_dict, output):
105 116
106 for partition in partition_list: 117 for partition in partition_list:
107 image = info_dict.get("{}_image".format(partition)) 118 image = info_dict.get("{}_image".format(partition))
108 image_size = 0
109 if image: 119 if image:
110 image_size = GetPartitionSizeFromImage(image)
111 has_image = True 120 has_image = True
112 if append_suffix: 121
113 cmd += ["--partition", 122 if not append_suffix:
114 "{}_a:readonly:{}:{}_a".format(partition, image_size, group), 123 cmd += GetArgumentsForImage(partition, group, image)
115 "--partition", 124 continue
116 "{}_b:readonly:0:{}_b".format(partition, group)] 125
117 if image: 126 # For A/B devices, super partition always contains sub-partitions in
118 # For A/B devices, super partition always contains sub-partitions in 127 # the _a slot, because this image should only be used for
119 # the _a slot, because this image should only be used for 128 # bootstrapping / initializing the device. When flashing the image,
120 # bootstrapping / initializing the device. When flashing the image, 129 # bootloader fastboot should always mark _a slot as bootable.
121 # bootloader fastboot should always mark _a slot as bootable. 130 cmd += GetArgumentsForImage(partition + "_a", group + "_a", image)
122 cmd += ["--image", "{}_a={}".format(partition, image)] 131
123 else: 132 other_image = None
124 cmd += ["--partition", 133 if partition == "system" and "system_other_image" in info_dict:
125 "{}:readonly:{}:{}".format(partition, image_size, group)] 134 other_image = info_dict["system_other_image"]
126 if image: 135 has_image = True
127 cmd += ["--image", "{}={}".format(partition, image)] 136
137 cmd += GetArgumentsForImage(partition + "_b", group + "_b", other_image)
128 138
129 if has_image: 139 if has_image:
130 cmd.append("--sparse") 140 cmd.append("--sparse")
@@ -145,6 +155,12 @@ def BuildSuperImageFromExtractedTargetFiles(inp, out):
145 info_dict = common.LoadInfoDict(inp) 155 info_dict = common.LoadInfoDict(inp)
146 partition_list = shlex.split( 156 partition_list = shlex.split(
147 info_dict.get("dynamic_partition_list", "").strip()) 157 info_dict.get("dynamic_partition_list", "").strip())
158
159 if "system" in partition_list:
160 image_path = os.path.join(inp, "IMAGES", "system_other.img")
161 if os.path.isfile(image_path):
162 info_dict["system_other_image"] = image_path
163
148 missing_images = [] 164 missing_images = []
149 for partition in partition_list: 165 for partition in partition_list:
150 image_path = os.path.join(inp, "IMAGES", "{}.img".format(partition)) 166 image_path = os.path.join(inp, "IMAGES", "{}.img".format(partition))
diff --git a/tools/releasetools/common.py b/tools/releasetools/common.py
index 4c452ad70..dcc083c1c 100644
--- a/tools/releasetools/common.py
+++ b/tools/releasetools/common.py
@@ -623,10 +623,13 @@ def _BuildBootableImage(sourcedir, fs_config_file, info_dict=None,
623 # "boot" or "recovery", without extension. 623 # "boot" or "recovery", without extension.
624 partition_name = os.path.basename(sourcedir).lower() 624 partition_name = os.path.basename(sourcedir).lower()
625 625
626 if (partition_name == "recovery" and 626 if partition_name == "recovery":
627 info_dict.get("include_recovery_dtbo") == "true"): 627 if info_dict.get("include_recovery_dtbo") == "true":
628 fn = os.path.join(sourcedir, "recovery_dtbo") 628 fn = os.path.join(sourcedir, "recovery_dtbo")
629 cmd.extend(["--recovery_dtbo", fn]) 629 cmd.extend(["--recovery_dtbo", fn])
630 if info_dict.get("include_recovery_acpio") == "true":
631 fn = os.path.join(sourcedir, "recovery_acpio")
632 cmd.extend(["--recovery_acpio", fn])
630 633
631 RunAndCheckOutput(cmd) 634 RunAndCheckOutput(cmd)
632 635
diff --git a/tools/releasetools/test_blockimgdiff.py b/tools/releasetools/test_blockimgdiff.py
index 857026e34..806ff4b95 100644
--- a/tools/releasetools/test_blockimgdiff.py
+++ b/tools/releasetools/test_blockimgdiff.py
@@ -127,11 +127,11 @@ class BlockImageDiffTest(ReleaseToolsTestCase):
127 127
128 # Sufficient cache to stash 5 blocks (size * 0.8 >= 5). 128 # Sufficient cache to stash 5 blocks (size * 0.8 >= 5).
129 common.OPTIONS.cache_size = 7 * 4096 129 common.OPTIONS.cache_size = 7 * 4096
130 self.assertEqual(0, block_image_diff.ReviseStashSize()) 130 self.assertEqual((0, 5), block_image_diff.ReviseStashSize())
131 131
132 # Insufficient cache to stash 5 blocks (size * 0.8 < 5). 132 # Insufficient cache to stash 5 blocks (size * 0.8 < 5).
133 common.OPTIONS.cache_size = 6 * 4096 133 common.OPTIONS.cache_size = 6 * 4096
134 self.assertEqual(10, block_image_diff.ReviseStashSize()) 134 self.assertEqual((10, 0), block_image_diff.ReviseStashSize())
135 135
136 def test_ReviseStashSize_bug_33687949(self): 136 def test_ReviseStashSize_bug_33687949(self):
137 """ReviseStashSize() should "free" the used stash _after_ the command. 137 """ReviseStashSize() should "free" the used stash _after_ the command.
@@ -169,7 +169,7 @@ class BlockImageDiffTest(ReleaseToolsTestCase):
169 169
170 # Insufficient cache to stash 15 blocks (size * 0.8 < 15). 170 # Insufficient cache to stash 15 blocks (size * 0.8 < 15).
171 common.OPTIONS.cache_size = 15 * 4096 171 common.OPTIONS.cache_size = 15 * 4096
172 self.assertEqual(15, block_image_diff.ReviseStashSize()) 172 self.assertEqual((15, 5), block_image_diff.ReviseStashSize())
173 173
174 def test_FileTypeSupportedByImgdiff(self): 174 def test_FileTypeSupportedByImgdiff(self):
175 self.assertTrue( 175 self.assertTrue(
diff --git a/tools/signapk/Android.bp b/tools/signapk/Android.bp
index e95205d04..ad9d957dd 100644
--- a/tools/signapk/Android.bp
+++ b/tools/signapk/Android.bp
@@ -28,4 +28,10 @@ java_library_host {
28 ], 28 ],
29 29
30 required: ["libconscrypt_openjdk_jni"], 30 required: ["libconscrypt_openjdk_jni"],
31
32 // The post-build signing tools need signapk.jar (and its shared libraries,
33 // handled in their own Android.bp files)
34 dist: {
35 targets: ["droidcore"],
36 },
31} 37}
diff --git a/tools/signapk/Android.mk b/tools/signapk/Android.mk
deleted file mode 100644
index ff54d6d84..000000000
--- a/tools/signapk/Android.mk
+++ /dev/null
@@ -1,26 +0,0 @@
1#
2# Copyright (C) 2008 The Android Open Source Project
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8# http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15#
16LOCAL_PATH := $(call my-dir)
17
18ifeq ($(TARGET_BUILD_APPS),)
19# The post-build signing tools need signapk.jar and its shared libraries,
20# but we don't need this if we're just doing unbundled apps.
21my_dist_files := $(HOST_OUT_JAVA_LIBRARIES)/signapk.jar \
22 $(HOST_OUT_SHARED_LIBRARIES)/libconscrypt_openjdk_jni$(HOST_SHLIB_SUFFIX)
23
24$(call dist-for-goals,droidcore,$(my_dist_files))
25my_dist_files :=
26endif