Merge "Allow codename.fingerprint format for targetSdkVersion"
diff --git a/Changes.md b/Changes.md
index 1fadcef..be2a271 100644
--- a/Changes.md
+++ b/Changes.md
@@ -1,5 +1,9 @@
# Build System Changes for Android.mk Writers
+## Deprecation of `BUILD_*` module types
+
+See [build/make/Deprecation.md](Deprecation.md) for the current status.
+
## `PRODUCT_HOST_PACKAGES` split from `PRODUCT_PACKAGES` {#PRODUCT_HOST_PACKAGES}
Previously, adding a module to `PRODUCT_PACKAGES` that supported both the host
diff --git a/Deprecation.md b/Deprecation.md
new file mode 100644
index 0000000..6468f46
--- /dev/null
+++ b/Deprecation.md
@@ -0,0 +1,56 @@
+# Deprecation of Make
+
+We've made significant progress converting AOSP from Make to Soong (Android.mk
+to Android.bp), and we're ready to start turning off pieces of Make. If you
+have any problems converting, please contact us via:
+
+* The [android-building@googlegroups.com] group.
+* Our [public bug tracker](https://issuetracker.google.com/issues/new?component=381517).
+* Or privately through your existing contacts at Google.
+
+## Status
+
+[build/make/core/deprecation.mk] is the source of truth, but for easy browsing:
+
+| Module type | State |
+| -------------------------- | --------- |
+| `BUILD_HOST_TEST_CONFIG` | Warning |
+| `BUILD_TARGET_TEST_CONFIG` | Warning |
+| `BUILD_*` | Available |
+
+## Module Type Deprecation Process
+
+We'll be turning off `BUILD_*` module types as all of the users are removed
+from AOSP (and Google's internal trees). The process will go something like
+this, using `BUILD_PACKAGE` as an example:
+
+* Prerequisite: all common users of `BUILD_PACKAGE` have been removed (some
+ device-specific ones may remain).
+* `BUILD_PACKAGE` will be moved from `AVAILABLE_BUILD_MODULE_TYPES` to
+ `DEFAULT_WARNING_BUILD_MODULE_TYPES` in [build/make/core/deprecation.mk]. This
+ will make referring to `BUILD_PACKAGE` a warning.
+* Any devices that still have warnings will have
+ `BUILD_BROKEN_USES_BUILD_PACKAGE := true` added to their `BoardConfig.mk`.
+* `BUILD_PACKAGE` will be switched from `DEFAULT_WARNING_BUILD_MODULE_TYPES` to
+ `DEFAULT_ERROR_BUILD_MODULE_TYPES`, which will turn referring to
+ `BUILD_PACKAGE` into an error unless the device has overridden it.
+* At some later point, after all devices in AOSP no longer set
+ `BUILD_BROKEN_USES_BUILD_PACKAGE`, `BUILD_PACKAGE` will be moved from
+ `DEFAULT_ERROR_BUILD_MODULE_TYPES` to `OBSOLETE_BUILD_MODULE_TYPES` and the
+ code will be removed. It will no longer be possible to use `BUILD_PACKAGE`.
+
+In most cases, we expect module types to stay in the default warning state for
+about two weeks before becoming an error by default. Then it will spend some
+amount of time in the default error state before moving to obsolete -- we'll
+try and keep that around for a while, but other development may cause those to
+break, and the fix may to be to obsolete them. There is no expectation that the
+`BUILD_BROKEN_USES_BUILD_*` workarounds will work in a future release, it's a
+short-term workaround.
+
+Just to be clear, the above process will happen on the AOSP master branch. So
+if you're following Android releases, none of the deprecation steps will be in
+Android Q, and the 2020 release will have jumped directly to the end for many
+module types.
+
+[android-building@googlegroups.com]: https://groups.google.com/forum/#!forum/android-building
+[build/make/core/deprecation.mk]: /core/deprecation.mk
diff --git a/core/Makefile b/core/Makefile
index 21029aa..8a960b6 100644
--- a/core/Makefile
+++ b/core/Makefile
@@ -91,9 +91,7 @@
ifdef has_dup_copy_headers
has_dup_copy_headers :=
- ifneq ($(BUILD_BROKEN_DUP_COPY_HEADERS),true)
- $(error duplicate header copies are no longer allowed. For more information about headers, see: https://android.googlesource.com/platform/build/soong/+/master/docs/best_practices.md#headers)
- endif
+ $(error duplicate header copies are no longer allowed. For more information about headers, see: https://android.googlesource.com/platform/build/soong/+/master/docs/best_practices.md#headers)
endif
# -----------------------------------------------------------------
@@ -497,6 +495,9 @@
$(hide) echo ro.vendor.product.cpu.abilist64="$(TARGET_CPU_ABI_LIST_64_BIT)">>$@
$(hide) echo ro.product.board="$(TARGET_BOOTLOADER_BOARD_NAME)">>$@
$(hide) echo ro.board.platform="$(TARGET_BOARD_PLATFORM)">>$@
+ifdef TARGET_SCREEN_DENSITY
+ $(hide) echo ro.sf.lcd_density="$(TARGET_SCREEN_DENSITY)">>$@
+endif
$(hide) $(call generate-common-build-props,vendor,$@)
$(hide) echo "#" >> $@; \
echo "# BOOTIMAGE_BUILD_PROPERTIES" >> $@; \
@@ -1222,42 +1223,6 @@
$(hide) mkdir -p $(dir $@)
$(hide) $(ACP) $< $@
-# -----------------------------------------------------------------
-# Build a keystore with the authorized keys in it, used to verify the
-# authenticity of downloaded OTA packages.
-#
-# This rule adds to ALL_DEFAULT_INSTALLED_MODULES, so it needs to come
-# before the rules that use that variable to build the image.
-ALL_DEFAULT_INSTALLED_MODULES += $(TARGET_OUT_ETC)/security/otacerts.zip
-$(TARGET_OUT_ETC)/security/otacerts.zip: PRIVATE_CERT := $(DEFAULT_KEY_CERT_PAIR).x509.pem
-$(TARGET_OUT_ETC)/security/otacerts.zip: $(SOONG_ZIP)
-$(TARGET_OUT_ETC)/security/otacerts.zip: $(DEFAULT_KEY_CERT_PAIR).x509.pem
- $(hide) rm -f $@
- $(hide) mkdir -p $(dir $@)
- $(hide) $(SOONG_ZIP) -o $@ -C $(dir $(PRIVATE_CERT)) -f $(PRIVATE_CERT)
-
-# Carry the public key for update_engine if it's a non-IoT target that
-# uses the AB updater. We use the same key as otacerts but in RSA public key
-# format.
-ifeq ($(AB_OTA_UPDATER),true)
-ifneq ($(PRODUCT_IOT),true)
-ALL_DEFAULT_INSTALLED_MODULES += $(TARGET_OUT_ETC)/update_engine/update-payload-key.pub.pem
-$(TARGET_OUT_ETC)/update_engine/update-payload-key.pub.pem: $(DEFAULT_KEY_CERT_PAIR).x509.pem
- $(hide) rm -f $@
- $(hide) mkdir -p $(dir $@)
- $(hide) openssl x509 -pubkey -noout -in $< > $@
-
-ALL_DEFAULT_INSTALLED_MODULES += \
- $(TARGET_RECOVERY_ROOT_OUT)/system/etc/update_engine/update-payload-key.pub.pem
-$(TARGET_RECOVERY_ROOT_OUT)/system/etc/update_engine/update-payload-key.pub.pem: \
- $(TARGET_OUT_ETC)/update_engine/update-payload-key.pub.pem
- $(hide) cp -f $< $@
-endif
-endif
-
-.PHONY: otacerts
-otacerts: $(TARGET_OUT_ETC)/security/otacerts.zip
-
# #################################################################
# Targets for user images
@@ -1570,15 +1535,13 @@
recovery_ramdisk := $(PRODUCT_OUT)/ramdisk-recovery.img
recovery_resources_common := $(call include-path-for, recovery)/res
-# Set recovery_density to a density bucket based on PRODUCT_AAPT_PREF_CONFIG if set. Otherwise use
-# the default medium density.
-ifneq (,$(PRODUCT_AAPT_PREF_CONFIG))
-# If PRODUCT_AAPT_PREF_CONFIG includes a non-numeric dpi bucket, always perfer that value.
-recovery_density := $(filter %dpi,$(PRODUCT_AAPT_PREF_CONFIG))
+# Set recovery_density to a density bucket based on TARGET_SCREEN_DENSITY, PRODUCT_AAPT_PREF_CONFIG,
+# or mdpi, in order of preference. We support both specific buckets (e.g. xdpi) and numbers,
+# which get remapped to a bucket.
+recovery_density := $(or $(TARGET_SCREEN_DENSITY),$(PRODUCT_AAPT_PREF_CONFIG),mdpi)
ifeq (,$(filter xxxhdpi xxhdpi xhdpi hdpi mdpi,$(recovery_density)))
recovery_density_value := $(patsubst %dpi,%,$(recovery_density))
-# Map the numeric dpi value to a bucket. We roughly use the medium point between the primary
-# densities to split buckets.
+# We roughly use the medium point between the primary densities to split buckets.
# ------160------240------320----------480------------640------
# mdpi hdpi xhdpi xxhdpi xxxhdpi
recovery_density := $(strip \
@@ -1587,9 +1550,6 @@
$(if $(filter $(shell echo $$(($(recovery_density_value) >= 280))),1),xhdpi),\
$(if $(filter $(shell echo $$(($(recovery_density_value) >= 200))),1),hdpi,mdpi)))
endif
-else # PRODUCT_AAPT_PREF_CONFIG is empty
-recovery_density := mdpi
-endif # PRODUCT_AAPT_PREF_CONFIG
ifneq (,$(wildcard $(recovery_resources_common)-$(recovery_density)))
recovery_resources_common := $(recovery_resources_common)-$(recovery_density)
@@ -1827,22 +1787,6 @@
INTERNAL_RECOVERYIMAGE_ARGS += --dtb $(INSTALLED_DTBIMAGE_TARGET)
endif
-# Keys authorized to sign OTA packages this build will accept. The
-# build always uses dev-keys for this; release packaging tools will
-# substitute other keys for this one.
-OTA_PUBLIC_KEYS := $(DEFAULT_SYSTEM_DEV_CERTIFICATE).x509.pem
-
-# Generate a file containing the keys that will be read by the
-# recovery binary.
-RECOVERY_INSTALL_OTA_KEYS := \
- $(call intermediates-dir-for,PACKAGING,ota_keys)/otacerts.zip
-$(RECOVERY_INSTALL_OTA_KEYS): PRIVATE_OTA_PUBLIC_KEYS := $(OTA_PUBLIC_KEYS)
-$(RECOVERY_INSTALL_OTA_KEYS): extra_keys := $(patsubst %,%.x509.pem,$(PRODUCT_EXTRA_RECOVERY_KEYS))
-$(RECOVERY_INSTALL_OTA_KEYS): $(SOONG_ZIP) $(OTA_PUBLIC_KEYS) $(extra_keys)
- $(hide) rm -f $@
- $(hide) mkdir -p $(dir $@)
- $(hide) $(SOONG_ZIP) -o $@ $(foreach key_file, $(PRIVATE_OTA_PUBLIC_KEYS) $(extra_keys), -C $(dir $(key_file)) -f $(key_file))
-
RECOVERYIMAGE_ID_FILE := $(PRODUCT_OUT)/recovery.id
# $(1): output file
@@ -1874,8 +1818,6 @@
cp -f $(item) $(TARGET_RECOVERY_ROOT_OUT)/system/etc/recovery.fstab)
$(if $(strip $(recovery_wipe)), \
$(hide) cp -f $(recovery_wipe) $(TARGET_RECOVERY_ROOT_OUT)/system/etc/recovery.wipe)
- $(hide) mkdir -p $(TARGET_RECOVERY_ROOT_OUT)/system/etc/security
- $(hide) cp $(RECOVERY_INSTALL_OTA_KEYS) $(TARGET_RECOVERY_ROOT_OUT)/system/etc/security/otacerts.zip
$(hide) ln -sf prop.default $(TARGET_RECOVERY_ROOT_OUT)/default.prop
$(BOARD_RECOVERY_IMAGE_PREPARE)
$(hide) $(MKBOOTFS) -d $(TARGET_OUT) $(TARGET_RECOVERY_ROOT_OUT) | $(MINIGZIP) > $(recovery_ramdisk)
@@ -1932,7 +1874,6 @@
$(INSTALLED_RECOVERY_BUILD_PROP_TARGET) \
$(recovery_resource_deps) \
$(recovery_fstab) \
- $(RECOVERY_INSTALL_OTA_KEYS) \
$(BOARD_RECOVERY_KERNEL_MODULES) \
$(DEPMOD)
$(call pretty,"Target boot image from recovery: $@")
@@ -1963,7 +1904,6 @@
$(INSTALLED_RECOVERY_BUILD_PROP_TARGET) \
$(recovery_resource_deps) \
$(recovery_fstab) \
- $(RECOVERY_INSTALL_OTA_KEYS) \
$(BOARD_RECOVERY_KERNEL_MODULES) \
$(DEPMOD)
$(call build-recoveryimage-target, $@)
diff --git a/core/android_manifest.mk b/core/android_manifest.mk
index 1f7acf1..06bea5e 100644
--- a/core/android_manifest.mk
+++ b/core/android_manifest.mk
@@ -23,12 +23,6 @@
$(call intermediates-dir-for,JAVA_LIBRARIES,$(lib),,COMMON)/manifest/AndroidManifest.xml)
endif
-# With aapt2, we'll link in the built resource from the AAR.
-ifneq ($(LOCAL_USE_AAPT2),true)
- LOCAL_RESOURCE_DIR += $(foreach lib, $(LOCAL_STATIC_JAVA_AAR_LIBRARIES),\
- $(call intermediates-dir-for,JAVA_LIBRARIES,$(lib),,COMMON)/aar/res)
-endif
-
full_android_manifest := $(intermediates.COMMON)/manifest/AndroidManifest.xml
ifneq (,$(strip $(my_full_libs_manifest_files)))
diff --git a/core/board_config.mk b/core/board_config.mk
index d32e301..dcfed9d 100644
--- a/core/board_config.mk
+++ b/core/board_config.mk
@@ -86,12 +86,16 @@
_build_broken_var_list := \
BUILD_BROKEN_ANDROIDMK_EXPORTS \
- BUILD_BROKEN_DUP_COPY_HEADERS \
BUILD_BROKEN_DUP_RULES \
- BUILD_BROKEN_PHONY_TARGETS \
BUILD_BROKEN_ENG_DEBUG_TAGS \
BUILD_BROKEN_USES_NETWORK \
+_build_broken_var_list += \
+ $(foreach m,$(AVAILABLE_BUILD_MODULE_TYPES) \
+ $(DEFAULT_WARNING_BUILD_MODULE_TYPES) \
+ $(DEFAULT_ERROR_BUILD_MODULE_TYPES), \
+ BUILD_BROKEN_USES_$(m))
+
_board_true_false_vars := $(_build_broken_var_list)
_board_strip_readonly_list += $(_build_broken_var_list)
@@ -450,7 +454,7 @@
endif
BUILDING_ODM_IMAGE :=
-ifeq ($(ODM_BUILD_ODM_IMAGE),)
+ifeq ($(PRODUCT_BUILD_ODM_IMAGE),)
ifdef BOARD_ODMIMAGE_FILE_SYSTEM_TYPE
BUILDING_ODM_IMAGE := true
endif
@@ -511,3 +515,16 @@
$(error System SDK versions '$(_unsupported_systemsdk_versions)' in BOARD_SYSTEMSDK_VERSIONS are not supported.\
Supported versions are $(PLATFORM_SYSTEMSDK_VERSIONS))
endif
+
+###########################################
+# Handle BUILD_BROKEN_USES_BUILD_*
+
+$(foreach m,$(DEFAULT_WARNING_BUILD_MODULE_TYPES),\
+ $(if $(filter false,$(BUILD_BROKEN_USES_$(m))),\
+ $(KATI_obsolete_var $(m),Please convert to Soong),\
+ $(KATI_deprecated_var $(m),Please convert to Soong)))
+
+$(foreach m,$(DEFAULT_ERROR_BUILD_MODULE_TYPES),\
+ $(if $(filter true,$(BUILD_BROKEN_USES_$(m))),\
+ $(KATI_deprecated_var $(m),Please convert to Soong),\
+ $(KATI_obsolete_var $(m),Please convert to Soong)))
diff --git a/core/clear_vars.mk b/core/clear_vars.mk
index d67c9f8..fafdce6 100644
--- a/core/clear_vars.mk
+++ b/core/clear_vars.mk
@@ -291,7 +291,7 @@
LOCAL_UNCOMPRESS_DEX:=
LOCAL_UNINSTALLABLE_MODULE:=
LOCAL_UNSTRIPPED_PATH:=
-LOCAL_USE_AAPT2:=$(USE_AAPT2)
+LOCAL_USE_AAPT2:=
LOCAL_USE_CLANG_LLD:=
LOCAL_USE_VNDK:=
LOCAL_USES_LIBRARIES:=
diff --git a/core/config.mk b/core/config.mk
index b5fe866..386c64e 100644
--- a/core/config.mk
+++ b/core/config.mk
@@ -95,6 +95,8 @@
$(KATI_deprecated_var USER,Use BUILD_USERNAME instead. See $(CHANGES_URL)#USER)
$(KATI_obsolete_var TARGET_ROOT_OUT_SBIN,/sbin has been removed, use /system/bin instead)
$(KATI_obsolete_var TARGET_ROOT_OUT_SBIN_UNSTRIPPED,/sbin has been removed, use /system/bin instead)
+$(KATI_obsolete_var BUILD_BROKEN_PHONY_TARGETS)
+$(KATI_obsolete_var BUILD_BROKEN_DUP_COPY_HEADERS)
# This is marked as obsolete in envsetup.mk after reading the BoardConfig.mk
$(KATI_deprecate_export It is a global setting. See $(CHANGES_URL)#export_keyword)
@@ -135,45 +137,48 @@
# Build system internal files
# ###############################################################
-BUILD_COMBOS:= $(BUILD_SYSTEM)/combo
+BUILD_COMBOS :=$= $(BUILD_SYSTEM)/combo
-CLEAR_VARS:= $(BUILD_SYSTEM)/clear_vars.mk
-BUILD_HOST_STATIC_LIBRARY:= $(BUILD_SYSTEM)/host_static_library.mk
-BUILD_HOST_SHARED_LIBRARY:= $(BUILD_SYSTEM)/host_shared_library.mk
-BUILD_STATIC_LIBRARY:= $(BUILD_SYSTEM)/static_library.mk
-BUILD_HEADER_LIBRARY:= $(BUILD_SYSTEM)/header_library.mk
-BUILD_AUX_STATIC_LIBRARY:= $(BUILD_SYSTEM)/aux_static_library.mk
-BUILD_AUX_EXECUTABLE:= $(BUILD_SYSTEM)/aux_executable.mk
-BUILD_SHARED_LIBRARY:= $(BUILD_SYSTEM)/shared_library.mk
-BUILD_EXECUTABLE:= $(BUILD_SYSTEM)/executable.mk
-BUILD_HOST_EXECUTABLE:= $(BUILD_SYSTEM)/host_executable.mk
-BUILD_PACKAGE:= $(BUILD_SYSTEM)/package.mk
-BUILD_PHONY_PACKAGE:= $(BUILD_SYSTEM)/phony_package.mk
-BUILD_RRO_PACKAGE:= $(BUILD_SYSTEM)/build_rro_package.mk
-BUILD_HOST_PREBUILT:= $(BUILD_SYSTEM)/host_prebuilt.mk
-BUILD_PREBUILT:= $(BUILD_SYSTEM)/prebuilt.mk
-BUILD_MULTI_PREBUILT:= $(BUILD_SYSTEM)/multi_prebuilt.mk
-BUILD_JAVA_LIBRARY:= $(BUILD_SYSTEM)/java_library.mk
-BUILD_STATIC_JAVA_LIBRARY:= $(BUILD_SYSTEM)/static_java_library.mk
-BUILD_HOST_JAVA_LIBRARY:= $(BUILD_SYSTEM)/host_java_library.mk
-BUILD_COPY_HEADERS := $(BUILD_SYSTEM)/copy_headers.mk
-BUILD_NATIVE_TEST := $(BUILD_SYSTEM)/native_test.mk
-BUILD_NATIVE_BENCHMARK := $(BUILD_SYSTEM)/native_benchmark.mk
-BUILD_HOST_NATIVE_TEST := $(BUILD_SYSTEM)/host_native_test.mk
-BUILD_FUZZ_TEST := $(BUILD_SYSTEM)/fuzz_test.mk
-BUILD_HOST_FUZZ_TEST := $(BUILD_SYSTEM)/host_fuzz_test.mk
+CLEAR_VARS :=$= $(BUILD_SYSTEM)/clear_vars.mk
-BUILD_SHARED_TEST_LIBRARY := $(BUILD_SYSTEM)/shared_test_lib.mk
-BUILD_HOST_SHARED_TEST_LIBRARY := $(BUILD_SYSTEM)/host_shared_test_lib.mk
-BUILD_STATIC_TEST_LIBRARY := $(BUILD_SYSTEM)/static_test_lib.mk
-BUILD_HOST_STATIC_TEST_LIBRARY := $(BUILD_SYSTEM)/host_static_test_lib.mk
+BUILD_HOST_STATIC_LIBRARY :=$= $(BUILD_SYSTEM)/host_static_library.mk
+BUILD_HOST_SHARED_LIBRARY :=$= $(BUILD_SYSTEM)/host_shared_library.mk
+BUILD_STATIC_LIBRARY :=$= $(BUILD_SYSTEM)/static_library.mk
+BUILD_HEADER_LIBRARY :=$= $(BUILD_SYSTEM)/header_library.mk
+BUILD_AUX_STATIC_LIBRARY :=$= $(BUILD_SYSTEM)/aux_static_library.mk
+BUILD_AUX_EXECUTABLE :=$= $(BUILD_SYSTEM)/aux_executable.mk
+BUILD_SHARED_LIBRARY :=$= $(BUILD_SYSTEM)/shared_library.mk
+BUILD_EXECUTABLE :=$= $(BUILD_SYSTEM)/executable.mk
+BUILD_HOST_EXECUTABLE :=$= $(BUILD_SYSTEM)/host_executable.mk
+BUILD_PACKAGE :=$= $(BUILD_SYSTEM)/package.mk
+BUILD_PHONY_PACKAGE :=$= $(BUILD_SYSTEM)/phony_package.mk
+BUILD_RRO_PACKAGE :=$= $(BUILD_SYSTEM)/build_rro_package.mk
+BUILD_HOST_PREBUILT :=$= $(BUILD_SYSTEM)/host_prebuilt.mk
+BUILD_PREBUILT :=$= $(BUILD_SYSTEM)/prebuilt.mk
+BUILD_MULTI_PREBUILT :=$= $(BUILD_SYSTEM)/multi_prebuilt.mk
+BUILD_JAVA_LIBRARY :=$= $(BUILD_SYSTEM)/java_library.mk
+BUILD_STATIC_JAVA_LIBRARY :=$= $(BUILD_SYSTEM)/static_java_library.mk
+BUILD_HOST_JAVA_LIBRARY :=$= $(BUILD_SYSTEM)/host_java_library.mk
+BUILD_COPY_HEADERS :=$= $(BUILD_SYSTEM)/copy_headers.mk
+BUILD_NATIVE_TEST :=$= $(BUILD_SYSTEM)/native_test.mk
+BUILD_NATIVE_BENCHMARK :=$= $(BUILD_SYSTEM)/native_benchmark.mk
+BUILD_HOST_NATIVE_TEST :=$= $(BUILD_SYSTEM)/host_native_test.mk
+BUILD_FUZZ_TEST :=$= $(BUILD_SYSTEM)/fuzz_test.mk
+BUILD_HOST_FUZZ_TEST :=$= $(BUILD_SYSTEM)/host_fuzz_test.mk
-BUILD_NOTICE_FILE := $(BUILD_SYSTEM)/notice_files.mk
-BUILD_HOST_DALVIK_JAVA_LIBRARY := $(BUILD_SYSTEM)/host_dalvik_java_library.mk
-BUILD_HOST_DALVIK_STATIC_JAVA_LIBRARY := $(BUILD_SYSTEM)/host_dalvik_static_java_library.mk
+BUILD_SHARED_TEST_LIBRARY :=$= $(BUILD_SYSTEM)/shared_test_lib.mk
+BUILD_HOST_SHARED_TEST_LIBRARY :=$= $(BUILD_SYSTEM)/host_shared_test_lib.mk
+BUILD_STATIC_TEST_LIBRARY :=$= $(BUILD_SYSTEM)/static_test_lib.mk
+BUILD_HOST_STATIC_TEST_LIBRARY :=$= $(BUILD_SYSTEM)/host_static_test_lib.mk
-BUILD_HOST_TEST_CONFIG := $(BUILD_SYSTEM)/host_test_config.mk
-BUILD_TARGET_TEST_CONFIG := $(BUILD_SYSTEM)/target_test_config.mk
+BUILD_NOTICE_FILE :=$= $(BUILD_SYSTEM)/notice_files.mk
+BUILD_HOST_DALVIK_JAVA_LIBRARY :=$= $(BUILD_SYSTEM)/host_dalvik_java_library.mk
+BUILD_HOST_DALVIK_STATIC_JAVA_LIBRARY :=$= $(BUILD_SYSTEM)/host_dalvik_static_java_library.mk
+
+BUILD_HOST_TEST_CONFIG :=$= $(BUILD_SYSTEM)/host_test_config.mk
+BUILD_TARGET_TEST_CONFIG :=$= $(BUILD_SYSTEM)/target_test_config.mk
+
+include $(BUILD_SYSTEM)/deprecation.mk
# ###############################################################
# Parse out any modifier targets.
diff --git a/core/definitions.mk b/core/definitions.mk
index 7e44a47..1f5c5ce 100644
--- a/core/definitions.mk
+++ b/core/definitions.mk
@@ -1846,42 +1846,6 @@
# b/37750224
AAPT_ASAN_OPTIONS := ASAN_OPTIONS=detect_leaks=0
-# TODO: Right now we generate the asset resources twice, first as part
-# of generating the Java classes, then at the end when packaging the final
-# assets. This should be changed to do one of two things: (1) Don't generate
-# any resource files the first time, only create classes during that stage;
-# or (2) Don't use the -c flag with the second stage, instead taking the
-# resource files from the first stage as additional input. My original intent
-# was to use approach (2), but this requires a little more work in the tool.
-# Maybe we should just use approach (1).
-
-# This rule creates the R.java and Manifest.java files, both of which
-# are PRODUCT-neutral. Don't pass PRIVATE_PRODUCT_AAPT_CONFIG to this invocation.
-define create-resource-java-files
-@mkdir -p $(dir $(PRIVATE_RESOURCE_PUBLICS_OUTPUT))
-rm -rf $(PRIVATE_JAVA_GEN_DIR)
-mkdir -p $(PRIVATE_JAVA_GEN_DIR)
-$(hide) $(AAPT_ASAN_OPTIONS) $(AAPT) package $(PRIVATE_AAPT_FLAGS) -m \
- $(eval # PRIVATE_PRODUCT_AAPT_CONFIG is intentionally missing-- see comment.) \
- $(addprefix -J , $(PRIVATE_JAVA_GEN_DIR)) \
- $(addprefix -M , $(PRIVATE_ANDROID_MANIFEST)) \
- $(addprefix -P , $(PRIVATE_RESOURCE_PUBLICS_OUTPUT)) \
- $(addprefix -S , $(PRIVATE_RESOURCE_DIR)) \
- $(addprefix -A , $(PRIVATE_ASSET_DIR)) \
- $(addprefix -I , $(PRIVATE_AAPT_INCLUDES)) \
- $(addprefix -G , $(PRIVATE_PROGUARD_OPTIONS_FILE)) \
- $(addprefix --min-sdk-version , $(PRIVATE_DEFAULT_APP_TARGET_SDK)) \
- $(addprefix --target-sdk-version , $(PRIVATE_DEFAULT_APP_TARGET_SDK)) \
- $(if $(filter --version-code,$(PRIVATE_AAPT_FLAGS)),,--version-code $(PLATFORM_SDK_VERSION)) \
- $(if $(filter --version-name,$(PRIVATE_AAPT_FLAGS)),,--version-name $(APPS_DEFAULT_VERSION_NAME)) \
- $(addprefix --rename-manifest-package , $(PRIVATE_MANIFEST_PACKAGE_NAME)) \
- $(addprefix --rename-instrumentation-target-package , $(PRIVATE_MANIFEST_INSTRUMENTATION_FOR)) \
- --skip-symbols-without-default-localization
-$(SOONG_ZIP) -o $(PRIVATE_SRCJAR) -C $(PRIVATE_JAVA_GEN_DIR) -D $(PRIVATE_JAVA_GEN_DIR)
-# So that we re-run aapt when the list of input files change
-$(hide) echo $(PRIVATE_RESOURCE_LIST) >/dev/null
-endef
-
# Search for generated R.java/Manifest.java in $1, copy the found R.java as $2.
# Also copy them to a central 'R' directory to make it easier to add the files to an IDE.
define find-generated-R.java
@@ -2246,37 +2210,6 @@
$(hide) rm -f $(dir $@)d8_input.jar
endef
-#TODO: we kinda want to build different asset packages for
-# different configurations, then combine them later (or something).
-# Per-locale, etc.
-# A list of dynamic and static parameters; build layers for
-# dynamic params that lay over the static ones.
-#TODO: update the manifest to point to the package file
-#Note that the version numbers are given to aapt as simple default
-#values; applications can override these by explicitly stating
-#them in their manifest.
-# $(1) the package file
-define create-assets-package
-$(hide) $(AAPT_ASAN_OPTIONS) $(AAPT) package $(PRIVATE_AAPT_FLAGS) \
- $(addprefix -c , $(PRIVATE_PRODUCT_AAPT_CONFIG)) \
- $(addprefix --preferred-density , $(PRIVATE_PRODUCT_AAPT_PREF_CONFIG)) \
- $(addprefix -M , $(PRIVATE_ANDROID_MANIFEST)) \
- $(addprefix -S , $(PRIVATE_RESOURCE_DIR)) \
- $(addprefix -A , $(PRIVATE_ASSET_DIR)) \
- $(addprefix -I , $(PRIVATE_AAPT_INCLUDES)) \
- $(addprefix --min-sdk-version , $(PRIVATE_DEFAULT_APP_TARGET_SDK)) \
- $(addprefix --target-sdk-version , $(PRIVATE_DEFAULT_APP_TARGET_SDK)) \
- $(if $(filter --product,$(PRIVATE_AAPT_FLAGS)),,$(addprefix --product , $(PRIVATE_TARGET_AAPT_CHARACTERISTICS))) \
- $(if $(filter --version-code,$(PRIVATE_AAPT_FLAGS)),,--version-code $(PLATFORM_SDK_VERSION)) \
- $(if $(filter --version-name,$(PRIVATE_AAPT_FLAGS)),,--version-name $(APPS_DEFAULT_VERSION_NAME)) \
- $(addprefix --rename-manifest-package , $(PRIVATE_MANIFEST_PACKAGE_NAME)) \
- $(addprefix --rename-instrumentation-target-package , $(PRIVATE_MANIFEST_INSTRUMENTATION_FOR)) \
- --skip-symbols-without-default-localization \
- -F $(1)
-# So that we re-run aapt when the list of input files change
-$(hide) echo $(PRIVATE_RESOURCE_LIST) >/dev/null
-endef
-
# We need the extra blank line, so that the command will be on a separate line.
# $(1): the package
# $(2): the ABI name
@@ -2381,16 +2314,14 @@
ifeq ($(HOST_OS),linux)
# Runs appcompat and store logs in $(PRODUCT_OUT)/appcompat
define extract-package
-$(if $(filter aapt2, $(1)), \
- $(AAPT2) dump $@ | awk -F ' |=' '/^Package/{print $$3}' >> $(PRODUCT_OUT)/appcompat/$(PRIVATE_MODULE).log &&, \
- $(AAPT) dump badging $@ | awk -F \' '/^package/{print $$2}' >> $(PRODUCT_OUT)/appcompat/$(PRIVATE_MODULE).log &&)
+$(AAPT2) dump $@ | awk -F ' |=' '/^Package/{print $$3}' >> $(PRODUCT_OUT)/appcompat/$(PRIVATE_MODULE).log &&
endef
define appcompat-header
$(hide) \
mkdir -p $(PRODUCT_OUT)/appcompat && \
rm -f $(PRODUCT_OUT)/appcompat/$(PRIVATE_MODULE).log && \
echo -n "Package name: " >> $(PRODUCT_OUT)/appcompat/$(PRIVATE_MODULE).log && \
- $(call extract-package, $(1)) \
+ $(extract-package) \
echo "Module name in Android tree: $(PRIVATE_MODULE)" >> $(PRODUCT_OUT)/appcompat/$(PRIVATE_MODULE).log && \
echo "Local path in Android tree: $(PRIVATE_PATH)" >> $(PRODUCT_OUT)/appcompat/$(PRIVATE_MODULE).log && \
echo "Install path on $(TARGET_PRODUCT)-$(TARGET_BUILD_VARIANT): $(PRIVATE_INSTALLED_MODULE)" >> $(PRODUCT_OUT)/appcompat/$(PRIVATE_MODULE).log && \
diff --git a/core/deprecation.mk b/core/deprecation.mk
new file mode 100644
index 0000000..cbc938a
--- /dev/null
+++ b/core/deprecation.mk
@@ -0,0 +1,55 @@
+# These module types can still be used without warnings or errors.
+AVAILABLE_BUILD_MODULE_TYPES :=$= \
+ BUILD_AUX_EXECUTABLE \
+ BUILD_AUX_STATIC_LIBRARY \
+ BUILD_COPY_HEADERS \
+ BUILD_EXECUTABLE \
+ BUILD_FUZZ_TEST \
+ BUILD_HEADER_LIBRARY \
+ BUILD_HOST_DALVIK_JAVA_LIBRARY \
+ BUILD_HOST_DALVIK_STATIC_JAVA_LIBRARY \
+ BUILD_HOST_EXECUTABLE \
+ BUILD_HOST_FUZZ_TEST \
+ BUILD_HOST_JAVA_LIBRARY \
+ BUILD_HOST_NATIVE_TEST \
+ BUILD_HOST_PREBUILT \
+ BUILD_HOST_SHARED_LIBRARY \
+ BUILD_HOST_SHARED_TEST_LIBRARY \
+ BUILD_HOST_STATIC_LIBRARY \
+ BUILD_HOST_STATIC_TEST_LIBRARY \
+ BUILD_JAVA_LIBRARY \
+ BUILD_MULTI_PREBUILT \
+ BUILD_NATIVE_BENCHMARK \
+ BUILD_NATIVE_TEST \
+ BUILD_NOTICE_FILE \
+ BUILD_PACKAGE \
+ BUILD_PHONY_PACKAGE \
+ BUILD_PREBUILT \
+ BUILD_RRO_PACKAGE \
+ BUILD_SHARED_LIBRARY \
+ BUILD_SHARED_TEST_LIBRARY \
+ BUILD_STATIC_JAVA_LIBRARY \
+ BUILD_STATIC_LIBRARY \
+ BUILD_STATIC_TEST_LIBRARY \
+
+# These are BUILD_* variables that will throw a warning when used. This is
+# generally a temporary state until all the devices are marked with the
+# relevant BUILD_BROKEN_USES_BUILD_* variables, then these would move to
+# DEFAULT_ERROR_BUILD_MODULE_TYPES.
+DEFAULT_WARNING_BUILD_MODULE_TYPES :=$= \
+ BUILD_HOST_TEST_CONFIG \
+ BUILD_TARGET_TEST_CONFIG \
+
+# These are BUILD_* variables that are errors to reference, but you can set
+# BUILD_BROKEN_USES_BUILD_* in your BoardConfig.mk in order to turn them back
+# to warnings.
+DEFAULT_ERROR_BUILD_MODULE_TYPES :=$= \
+
+# These are BUILD_* variables that are always errors to reference.
+# Setting the BUILD_BROKEN_USES_BUILD_* variables is also an error.
+OBSOLETE_BUILD_MODULE_TYPES :=$= \
+
+$(foreach m,$(OBSOLETE_BUILD_MODULE_TYPES),\
+ $(KATI_obsolete_var $(m),Please convert to Soong) \
+ $(KATI_obsolete_var BUILD_BROKEN_USES_$(m),Please convert to Soong))
+
diff --git a/core/dex_preopt.mk b/core/dex_preopt.mk
index 8017486..180edaf 100644
--- a/core/dex_preopt.mk
+++ b/core/dex_preopt.mk
@@ -22,19 +22,28 @@
$(TARGET_2ND_ARCH_VAR_PREFIX)DEFAULT_DEX_PREOPT_INSTALLED_IMAGE :=
$(foreach my_boot_image_name,$(DEXPREOPT_IMAGE_NAMES),$(eval include $(BUILD_SYSTEM)/dex_preopt_libart.mk))
-boot_profile_jars_zip := $(PRODUCT_OUT)/boot_profile_jars.zip
+# Build the boot.zip which contains the boot jars and their compilation output
+# We can do this only if preopt is enabled and if the product uses libart config (which sets the
+# default properties for preopting).
+ifeq ($(WITH_DEXPREOPT), true)
+ifeq ($(PRODUCT_USES_ART), true)
+
+boot_zip := $(PRODUCT_OUT)/boot.zip
bootclasspath_jars := $(DEXPREOPT_BOOTCLASSPATH_DEX_FILES)
system_server_jars := $(foreach m,$(PRODUCT_SYSTEM_SERVER_JARS),$(PRODUCT_OUT)/system/framework/$(m).jar)
-$(boot_profile_jars_zip): PRIVATE_BOOTCLASSPATH_JARS := $(bootclasspath_jars)
-$(boot_profile_jars_zip): PRIVATE_SYSTEM_SERVER_JARS := $(system_server_jars)
-$(boot_profile_jars_zip): $(bootclasspath_jars) $(system_server_jars) $(SOONG_ZIP)
- @echo "Create boot profiles package: $@"
+$(boot_zip): PRIVATE_BOOTCLASSPATH_JARS := $(bootclasspath_jars)
+$(boot_zip): PRIVATE_SYSTEM_SERVER_JARS := $(system_server_jars)
+$(boot_zip): $(bootclasspath_jars) $(system_server_jars) $(SOONG_ZIP) $(MERGE_ZIPS) $(DEXPREOPT_IMAGE_ZIP_boot)
+ @echo "Create boot package: $@"
rm -f $@
- $(SOONG_ZIP) -o $@ \
+ $(SOONG_ZIP) -o $@.tmp \
-C $(dir $(firstword $(PRIVATE_BOOTCLASSPATH_JARS)))/.. $(addprefix -f ,$(PRIVATE_BOOTCLASSPATH_JARS)) \
-C $(PRODUCT_OUT) $(addprefix -f ,$(PRIVATE_SYSTEM_SERVER_JARS))
+ $(MERGE_ZIPS) $@ $@.tmp $(DEXPREOPT_IMAGE_ZIP_boot)
+ rm -f $@.tmp
-ifeq ($(PRODUCT_DIST_BOOT_AND_SYSTEM_JARS),true)
-$(call dist-for-goals, droidcore, $(boot_profile_jars_zip))
-endif
+$(call dist-for-goals, droidcore, $(boot_zip))
+
+endif #PRODUCT_USES_ART
+endif #WITH_DEXPREOPT
diff --git a/core/dpi_specific_apk.mk b/core/dpi_specific_apk.mk
deleted file mode 100644
index ad073c7..0000000
--- a/core/dpi_specific_apk.mk
+++ /dev/null
@@ -1,77 +0,0 @@
-# Set up rules to build dpi-specific apk, with whatever else from the base apk.
-# Input variable: my_dpi, and all other variables set up in package_internal.mk.
-#
-
-dpi_apk_name := $(LOCAL_MODULE)_$(my_dpi)
-dpi_intermediate := $(call intermediates-dir-for,APPS,$(dpi_apk_name))
-built_dpi_apk := $(dpi_intermediate)/package.apk
-additional_certificates := $(foreach c,$(LOCAL_ADDITIONAL_CERTIFICATES), $(c).x509.pem $(c).pk8)
-
-# Set up all the target-specific variables.
-$(built_dpi_apk): PRIVATE_MODULE := $(dpi_apk_name)
-$(built_dpi_apk): PRIVATE_AAPT_FLAGS := $(LOCAL_AAPT_FLAGS) --pseudo-localize $($(LOCAL_PACKAGE_NAME)_aapt_flags_$(my_dpi))
-# Clear PRIVATE_PRODUCT_AAPT_CONFIG to include everything by default.
-$(built_dpi_apk): PRIVATE_PRODUCT_AAPT_CONFIG :=
-$(built_dpi_apk): PRIVATE_PRODUCT_AAPT_PREF_CONFIG := $(my_dpi)
-$(built_dpi_apk): PRIVATE_ANDROID_MANIFEST := $(full_android_manifest)
-$(built_dpi_apk): PRIVATE_RESOURCE_DIR := $(LOCAL_RESOURCE_DIR)
-$(built_dpi_apk): PRIVATE_ASSET_DIR := $(LOCAL_ASSET_DIR)
-$(built_dpi_apk): PRIVATE_AAPT_INCLUDES := $(all_library_res_package_exports)
-$(built_dpi_apk): PRIVATE_RESOURCE_LIST := $(all_res_assets)
-$(built_dpi_apk): PRIVATE_DEFAULT_APP_TARGET_SDK := $(call module-target-sdk-version)
-$(built_dpi_apk): PRIVATE_MANIFEST_PACKAGE_NAME := $(LOCAL_MANIFEST_PACKAGE_NAME)
-$(built_dpi_apk): PRIVATE_MANIFEST_INSTRUMENTATION_FOR := $(LOCAL_INSTRUMENTATION_FOR)
-$(built_dpi_apk): PRIVATE_JNI_SHARED_LIBRARIES := $(jni_shared_libraries_with_abis)
-$(built_dpi_apk): PRIVATE_JNI_SHARED_LIBRARIES_ABI := $(jni_shared_libraries_abis)
-$(built_dpi_apk): PRIVATE_PRIVATE_KEY := $(private_key)
-$(built_dpi_apk): PRIVATE_CERTIFICATE := $(certificate)
-$(built_dpi_apk): $(additional_certificates)
-$(built_dpi_apk): PRIVATE_ADDITIONAL_CERTIFICATES := $(additional_certificates)
-
-$(built_dpi_apk): PRIVATE_SOURCE_ARCHIVE :=
-ifneq ($(full_classes_jar),)
-$(built_dpi_apk): PRIVATE_DEX_FILE := $(built_dex)
-# Use the jarjar processed arhive as the initial package file.
-$(built_dpi_apk): PRIVATE_SOURCE_ARCHIVE := $(full_classes_pre_proguard_jar)
-$(built_dpi_apk): $(built_dex)
-else
-$(built_dpi_apk): PRIVATE_DEX_FILE :=
-endif # full_classes_jar
-
-# Set up dependenncies and the build recipe.
-$(built_dpi_apk) : $(R_file_stamp)
-$(built_dpi_apk) : $(all_library_res_package_export_deps)
-$(built_dpi_apk) : $(private_key) $(certificate) $(SIGNAPK_JAR)
-$(built_dpi_apk) : $(AAPT)
-$(built_dpi_apk) : $(MERGE_ZIPS) $(SOONG_ZIP) $(ZIP2ZIP)
-$(built_dpi_apk) : $(all_res_assets) $(jni_shared_libraries) $(full_android_manifest)
- @echo "target Package: $(PRIVATE_MODULE) ($@)"
- rm -rf $@.parts
- mkdir -p $@.parts
- $(call create-assets-package,$@.parts/apk.zip)
-ifneq ($(jni_shared_libraries),)
- $(call create-jni-shared-libs-package,$@.parts/jni.zip)
-endif
-ifeq ($(full_classes_jar),)
-# We don't build jar, need to add the Java resources here.
- $(if $(PRIVATE_EXTRA_JAR_ARGS),$(call create-java-resources-jar,$@.parts/res.zip))
-else
- $(call create-dex-jar,$@.parts/dex.zip,$(PRIVATE_DEX_FILE))
- $(call extract-resources-jar,$@.parts/res.zip,$(PRIVATE_SOURCE_ARCHIVE))
-endif
- $(MERGE_ZIPS) $@ $@.parts/*.zip
- rm -rf $@.parts
- $(sign-package)
-
-# Set up global variables to register this apk to the higher-level dependency graph.
-ALL_MODULES += $(dpi_apk_name)
-ALL_MODULES.$(dpi_apk_name).CLASS := APPS
-ALL_MODULES.$(dpi_apk_name).BUILT := $(built_dpi_apk)
-ALL_MODULES.$(dpi_apk_name).TARGET_BUILT := $(built_dpi_apk)
-PACKAGES := $(PACKAGES) $(dpi_apk_name)
-PACKAGES.$(dpi_apk_name).PRIVATE_KEY := $(private_key)
-PACKAGES.$(dpi_apk_name).CERTIFICATE := $(certificate)
-
-# Phony targets used by "apps_only".
-.PHONY: $(dpi_apk_name)
-$(dpi_apk_name) : $(built_dpi_apk)
diff --git a/core/force_aapt2.mk b/core/force_aapt2.mk
index db2e60f..25b45e4 100644
--- a/core/force_aapt2.mk
+++ b/core/force_aapt2.mk
@@ -14,50 +14,40 @@
# limitations under the License.
#
-# Including this makefile will force AAPT2 on if FORCE_AAPT2==true,
+# Including this makefile will force AAPT2 on,
# rewriting some properties to convert standard AAPT usage to AAPT2.
-ifneq ($(FORCE_AAPT2),false)
- ifeq ($(LOCAL_USE_AAPT2),)
- # Force AAPT2 on
- LOCAL_USE_AAPT2 := true
- # Filter out support library resources
- LOCAL_RESOURCE_DIR := $(filter-out \
- prebuilts/sdk/current/% \
- frameworks/support/%,\
- $(LOCAL_RESOURCE_DIR))
- # Filter out unnecessary aapt flags
- ifneq (,$(filter --extra-packages,$(LOCAL_AAPT_FLAGS)))
- LOCAL_AAPT_FLAGS := $(subst --extra-packages=,--extra-packages$(space), \
- $(filter-out \
- --extra-packages=android.support.% \
- --extra-packages=androidx.%, \
- $(subst --extra-packages$(space),--extra-packages=,$(LOCAL_AAPT_FLAGS))))
- ifeq (,$(filter --extra-packages,$(LOCAL_AAPT_FLAGS)))
- LOCAL_AAPT_FLAGS := $(filter-out --auto-add-overlay,$(LOCAL_AAPT_FLAGS))
- endif
- endif
-
- # AAPT2 is pickier about missing resources. Support library may have references to resources
- # added in current, so always treat LOCAL_SDK_VERSION as LOCAL_SDK_RES_VERSION := current.
- ifdef LOCAL_SDK_VERSION
- LOCAL_SDK_RES_VERSION := current
- endif
-
- ifeq (,$(strip $(LOCAL_MANIFEST_FILE)$(LOCAL_FULL_MANIFEST_FILE)))
- ifeq (,$(wildcard $(LOCAL_PATH)/AndroidManifest.xml))
- # work around missing manifests by creating a default one
- LOCAL_FULL_MANIFEST_FILE := $(call local-intermediates-dir,COMMON)/DefaultManifest.xml
- $(call create-default-manifest-file,$(LOCAL_FULL_MANIFEST_FILE),$(call module-min-sdk-version))
- endif
- endif
- endif
+ifeq ($(LOCAL_USE_AAPT2),false)
+ $(call pretty-error, LOCAL_USE_AAPT2 := false is no longer supported)
endif
-ifneq ($(LOCAL_USE_AAPT2),true)
- ifneq ($(LOCAL_USE_AAPT2),false)
- ifneq ($(LOCAL_USE_AAPT2),)
- $(call pretty-error,Invalid value for LOCAL_USE_AAPT2: "$(LOCAL_USE_AAPT2)")
+# Filter out support library resources
+LOCAL_RESOURCE_DIR := $(filter-out \
+ prebuilts/sdk/current/% \
+ frameworks/support/%,\
+ $(LOCAL_RESOURCE_DIR))
+# Filter out unnecessary aapt flags
+ifneq (,$(filter --extra-packages,$(LOCAL_AAPT_FLAGS)))
+ LOCAL_AAPT_FLAGS := $(subst --extra-packages=,--extra-packages$(space), \
+ $(filter-out \
+ --extra-packages=android.support.% \
+ --extra-packages=androidx.%, \
+ $(subst --extra-packages$(space),--extra-packages=,$(LOCAL_AAPT_FLAGS))))
+ ifeq (,$(filter --extra-packages,$(LOCAL_AAPT_FLAGS)))
+ LOCAL_AAPT_FLAGS := $(filter-out --auto-add-overlay,$(LOCAL_AAPT_FLAGS))
endif
+endif
+
+# AAPT2 is pickier about missing resources. Support library may have references to resources
+# added in current, so always treat LOCAL_SDK_VERSION := <number> as LOCAL_SDK_RES_VERSION := current.
+ifneq (,$(filter-out current system_current test_current core_current,$(LOCAL_SDK_VERSION)))
+ LOCAL_SDK_RES_VERSION := current
+endif
+
+ifeq (,$(strip $(LOCAL_MANIFEST_FILE)$(LOCAL_FULL_MANIFEST_FILE)))
+ ifeq (,$(wildcard $(LOCAL_PATH)/AndroidManifest.xml))
+ # work around missing manifests by creating a default one
+ LOCAL_FULL_MANIFEST_FILE := $(call local-intermediates-dir,COMMON)/DefaultManifest.xml
+ $(call create-default-manifest-file,$(LOCAL_FULL_MANIFEST_FILE),$(call module-min-sdk-version))
endif
endif
diff --git a/core/java.mk b/core/java.mk
index 1533963..40fa594 100644
--- a/core/java.mk
+++ b/core/java.mk
@@ -422,10 +422,8 @@
common_proguard_flags += -dontshrink # don't shrink tests by default
endif # test package
ifneq ($(LOCAL_PROGUARD_ENABLED),custom)
- ifeq ($(LOCAL_USE_AAPT2),true)
- common_proguard_flag_files += $(foreach l,$(LOCAL_STATIC_ANDROID_LIBRARIES),\
- $(call intermediates-dir-for,JAVA_LIBRARIES,$(l),,COMMON)/export_proguard_flags)
- endif
+ common_proguard_flag_files += $(foreach l,$(LOCAL_STATIC_ANDROID_LIBRARIES),\
+ $(call intermediates-dir-for,JAVA_LIBRARIES,$(l),,COMMON)/export_proguard_flags)
endif
ifneq ($(common_proguard_flag_files),)
common_proguard_flags += $(addprefix -include , $(common_proguard_flag_files))
diff --git a/core/java_common.mk b/core/java_common.mk
index f5da120..db5b6c3 100644
--- a/core/java_common.mk
+++ b/core/java_common.mk
@@ -534,13 +534,6 @@
my_allowed_types := java:sdk java:system java:platform java:core
endif
-ifdef LOCAL_AAPT2_ONLY
-my_link_type += aapt2_only
-endif
-ifeq ($(LOCAL_USE_AAPT2),true)
-my_allowed_types += aapt2_only
-endif
-
my_link_deps := $(addprefix JAVA_LIBRARIES:,$(LOCAL_STATIC_JAVA_LIBRARIES) $(LOCAL_JAVA_LIBRARIES))
my_link_deps += $(addprefix APPS:,$(apk_libraries))
diff --git a/core/java_prebuilt_internal.mk b/core/java_prebuilt_internal.mk
index 8a919ff..31aae83 100644
--- a/core/java_prebuilt_internal.mk
+++ b/core/java_prebuilt_internal.mk
@@ -172,11 +172,6 @@
include $(BUILD_SYSTEM)/force_aapt2.mk
-ifdef LOCAL_AAPT2_ONLY
-LOCAL_USE_AAPT2 := true
-endif
-
-ifeq ($(LOCAL_USE_AAPT2),true)
ifneq ($(my_src_aar),)
$(intermediates.COMMON)/export_proguard_flags : $(my_src_proguard_options)
@@ -229,7 +224,7 @@
# Make sure my_res_package is created when you run mm/mmm.
$(built_module) : $(my_res_package)
endif # $(my_src_aar)
-endif # LOCAL_USE_AAPT2
+
# make sure the classes.jar and javalib.jar are built before $(LOCAL_BUILT_MODULE)
$(built_module) : $(common_javalib_jar)
diff --git a/core/package_internal.mk b/core/package_internal.mk
index e27f6ce..493a0f1 100644
--- a/core/package_internal.mk
+++ b/core/package_internal.mk
@@ -171,12 +171,7 @@
need_compile_asset := true
endif
-ifdef LOCAL_AAPT2_ONLY
-LOCAL_USE_AAPT2 := true
-endif
-
my_res_package :=
-ifeq ($(LOCAL_USE_AAPT2),true)
# In aapt2 the last takes precedence.
my_resource_dirs := $(call reverse-list,$(LOCAL_RESOURCE_DIR))
my_res_dir :=
@@ -210,30 +205,12 @@
my_res_package := $(intermediates)/package-res.apk
LOCAL_INTERMEDIATE_TARGETS += $(my_res_package)
-ifeq ($(LOCAL_USE_AAPT2),true)
- my_bundle_module := $(intermediates)/base.zip
- LOCAL_INTERMEDIATE_TARGETS += $(my_bundle_module)
-endif
+my_bundle_module := $(intermediates)/base.zip
+LOCAL_INTERMEDIATE_TARGETS += $(my_bundle_module)
# Always run aapt2, because we need to at least compile the AndroidManifest.xml.
need_compile_res := true
-else # LOCAL_USE_AAPT2
-all_resources := $(strip \
- $(foreach dir, $(LOCAL_RESOURCE_DIR), \
- $(addprefix $(dir)/, \
- $(patsubst res/%,%, \
- $(call find-subdir-assets,$(dir)) \
- ) \
- ) \
- ))
-
-ifdef LOCAL_PACKAGE_SPLITS
-LOCAL_AAPT_FLAGS += $(addprefix --split ,$(LOCAL_PACKAGE_SPLITS))
-endif
-
-endif # LOCAL_USE_AAPT2
-
ifneq ($(all_resources),)
need_compile_res := true
endif
@@ -369,71 +346,24 @@
$(R_file_stamp) $(my_res_package): PRIVATE_MANIFEST_INSTRUMENTATION_FOR := $(LOCAL_MANIFEST_INSTRUMENTATION_FOR)
###############################
-## AAPT/AAPT2
+## AAPT2
-ifeq ($(LOCAL_USE_AAPT2),true)
- my_compiled_res_base_dir := $(intermediates.COMMON)/flat-res
- ifneq (,$(filter-out current,$(renderscript_target_api)))
- ifneq ($(call math_gt_or_eq,$(renderscript_target_api),21),true)
- my_generated_res_zips := $(rs_generated_res_zip)
- endif # renderscript_target_api < 21
- endif # renderscript_target_api is set
- my_asset_dirs := $(LOCAL_ASSET_DIR)
- my_full_asset_paths := $(all_assets)
+my_compiled_res_base_dir := $(intermediates.COMMON)/flat-res
+ifneq (,$(filter-out current,$(renderscript_target_api)))
+ ifneq ($(call math_gt_or_eq,$(renderscript_target_api),21),true)
+ my_generated_res_zips := $(rs_generated_res_zip)
+ endif # renderscript_target_api < 21
+endif # renderscript_target_api is set
+my_asset_dirs := $(LOCAL_ASSET_DIR)
+my_full_asset_paths := $(all_assets)
- # Add AAPT2 link specific flags.
- $(my_res_package): PRIVATE_AAPT_FLAGS := $(LOCAL_AAPT_FLAGS)
- ifndef LOCAL_AAPT_NAMESPACES
- $(my_res_package): PRIVATE_AAPT_FLAGS += --no-static-lib-packages
- endif
+# Add AAPT2 link specific flags.
+$(my_res_package): PRIVATE_AAPT_FLAGS := $(LOCAL_AAPT_FLAGS)
+ifndef LOCAL_AAPT_NAMESPACES
+ $(my_res_package): PRIVATE_AAPT_FLAGS += --no-static-lib-packages
+endif
- include $(BUILD_SYSTEM)/aapt2.mk
-else # LOCAL_USE_AAPT2
-
- my_srcjar := $(intermediates.COMMON)/aapt.srcjar
- LOCAL_SRCJARS += $(my_srcjar)
- $(R_file_stamp): PRIVATE_SRCJAR := $(my_srcjar)
- $(R_file_stamp): PRIVATE_JAVA_GEN_DIR := $(intermediates.COMMON)/aapt
- $(R_file_stamp): .KATI_IMPLICIT_OUTPUTS := $(my_srcjar)
- # Since we don't know where the real R.java file is going to end up,
- # we need to use another file to stand in its place. We'll just
- # copy the generated file to src/R.stamp, which means it will
- # have the same contents and timestamp as the actual file.
- #
- # At the same time, this will copy the R.java file to a central
- # 'R' directory to make it easier to add the files to an IDE.
- #
-
- $(R_file_stamp): PRIVATE_RESOURCE_PUBLICS_OUTPUT := \
- $(intermediates.COMMON)/public_resources.xml
- $(R_file_stamp): PRIVATE_PROGUARD_OPTIONS_FILE := $(proguard_options_file)
- $(R_file_stamp): PRIVATE_RESOURCE_LIST := $(all_res_assets)
- $(R_file_stamp): $(all_res_assets) $(full_android_manifest) $(rs_generated_res_zip) $(AAPT) $(SOONG_ZIP) | $(ACP)
- @echo "target R.java/Manifest.java: $(PRIVATE_MODULE) ($@)"
- @rm -rf $@ && mkdir -p $(dir $@)
- $(create-resource-java-files)
- $(call find-generated-R.java,$(PRIVATE_JAVA_GEN_DIR),$@)
-
- $(proguard_options_file): $(R_file_stamp)
-
- ifdef LOCAL_EXPORT_PACKAGE_RESOURCES
- # Put this module's resources into a PRODUCT-agnositc package that
- # other packages can use to build their own PRODUCT-agnostic R.java (etc.)
- # files.
- resource_export_package := $(intermediates.COMMON)/package-export.apk
- $(R_file_stamp): $(resource_export_package)
-
- # create-assets-package looks at PRODUCT_AAPT_CONFIG, but this target
- # can't know anything about PRODUCT. Clear it out just for this target.
- $(resource_export_package): PRIVATE_PRODUCT_AAPT_CONFIG :=
- $(resource_export_package): PRIVATE_PRODUCT_AAPT_PREF_CONFIG :=
- $(resource_export_package): PRIVATE_RESOURCE_LIST := $(all_res_assets)
- $(resource_export_package): $(all_res_assets) $(full_android_manifest) $(rs_generated_res_zip) $(AAPT)
- @echo "target Export Resources: $(PRIVATE_MODULE) ($@)"
- $(call create-assets-package,$@)
- endif
-
-endif # LOCAL_USE_AAPT2
+include $(BUILD_SYSTEM)/aapt2.mk
endif # need_compile_res
@@ -496,9 +426,7 @@
$(LOCAL_INTERMEDIATE_TARGETS): \
PRIVATE_AAPT_INCLUDES := $(all_library_res_package_exports)
-ifeq ($(LOCAL_USE_AAPT2),true)
$(my_res_package) : $(all_library_res_package_export_deps)
-endif
# These four are set above for $(R_stamp_file) and $(my_res_package), but
# $(LOCAL_BUILT_MODULE) is not set before java.mk, so they have to be set again
@@ -595,13 +523,8 @@
$(LOCAL_BUILT_MODULE): PRIVATE_RESOURCE_INTERMEDIATES_DIR := $(intermediates.COMMON)/resources
$(LOCAL_BUILT_MODULE) : $(jni_shared_libraries)
$(LOCAL_BUILT_MODULE) : $(JAR_ARGS) $(SOONG_ZIP) $(MERGE_ZIPS) $(ZIP2ZIP)
-ifeq ($(LOCAL_USE_AAPT2),true)
$(LOCAL_BUILT_MODULE): PRIVATE_RES_PACKAGE := $(my_res_package)
$(LOCAL_BUILT_MODULE) : $(my_res_package) $(AAPT2) | $(ACP)
-else
-$(LOCAL_BUILT_MODULE): PRIVATE_RESOURCE_LIST := $(all_res_assets)
-$(LOCAL_BUILT_MODULE) : $(all_res_assets) $(full_android_manifest) $(AAPT) $(ZIPALIGN)
-endif # LOCAL_USE_AAPT2
ifdef LOCAL_COMPRESSED_MODULE
$(LOCAL_BUILT_MODULE) : $(MINIGZIP)
endif
@@ -622,11 +545,7 @@
@echo "target Package: $(PRIVATE_MODULE) ($@)"
rm -rf $@.parts
mkdir -p $@.parts
-ifeq ($(LOCAL_USE_AAPT2),true)
cp -f $(PRIVATE_RES_PACKAGE) $@.parts/apk.zip
-else # ! LOCAL_USE_AAPT2
- $(call create-assets-package,$@.parts/apk.zip)
-endif # LOCAL_USE_AAPT2
ifneq ($(jni_shared_libraries),)
$(call create-jni-shared-libs-package,$@.parts/jni.zip,$(PRIVATE_USE_EMBEDDED_NATIVE_LIBS))
endif
@@ -645,11 +564,7 @@
endif
# Run appcompat before stripping the classes.dex file.
ifeq ($(module_run_appcompat),true)
-ifeq ($(LOCAL_USE_AAPT2),true)
- $(call appcompat-header, aapt2)
-else
$(appcompat-header)
-endif
$(run-appcompat)
endif # module_run_appcompat
ifdef LOCAL_DEX_PREOPT
@@ -665,63 +580,57 @@
$(compress-package)
endif # LOCAL_COMPRESSED_MODULE
-ifeq ($(LOCAL_USE_AAPT2),true)
- my_package_res_pb := $(intermediates)/package-res.pb.apk
- $(my_package_res_pb): $(my_res_package) $(AAPT2)
+my_package_res_pb := $(intermediates)/package-res.pb.apk
+$(my_package_res_pb): $(my_res_package) $(AAPT2)
$(AAPT2) convert --output-format proto $< -o $@
- $(my_bundle_module): $(my_package_res_pb)
- $(my_bundle_module): PRIVATE_RES_PACKAGE := $(my_package_res_pb)
+$(my_bundle_module): $(my_package_res_pb)
+$(my_bundle_module): PRIVATE_RES_PACKAGE := $(my_package_res_pb)
- $(my_bundle_module): $(jni_shared_libraries)
- $(my_bundle_module): PRIVATE_JNI_SHARED_LIBRARIES := $(jni_shared_libraries_with_abis)
- $(my_bundle_module): PRIVATE_JNI_SHARED_LIBRARIES_ABI := $(jni_shared_libraries_abis)
+$(my_bundle_module): $(jni_shared_libraries)
+$(my_bundle_module): PRIVATE_JNI_SHARED_LIBRARIES := $(jni_shared_libraries_with_abis)
+$(my_bundle_module): PRIVATE_JNI_SHARED_LIBRARIES_ABI := $(jni_shared_libraries_abis)
- ifneq ($(full_classes_jar),)
- $(my_bundle_module): PRIVATE_DEX_FILE := $(built_dex)
- # Use the jarjar processed archive as the initial package file.
- $(my_bundle_module): PRIVATE_SOURCE_ARCHIVE := $(full_classes_pre_proguard_jar)
- $(my_bundle_module): $(built_dex)
- else
- $(my_bundle_module): PRIVATE_DEX_FILE :=
- $(my_bundle_module): PRIVATE_SOURCE_ARCHIVE :=
- endif # full_classes_jar
+ifneq ($(full_classes_jar),)
+ $(my_bundle_module): PRIVATE_DEX_FILE := $(built_dex)
+ # Use the jarjar processed archive as the initial package file.
+ $(my_bundle_module): PRIVATE_SOURCE_ARCHIVE := $(full_classes_pre_proguard_jar)
+ $(my_bundle_module): $(built_dex)
+else
+ $(my_bundle_module): PRIVATE_DEX_FILE :=
+ $(my_bundle_module): PRIVATE_SOURCE_ARCHIVE :=
+endif # full_classes_jar
- $(my_bundle_module): $(MERGE_ZIPS) $(SOONG_ZIP) $(ZIP2ZIP)
+$(my_bundle_module): $(MERGE_ZIPS) $(SOONG_ZIP) $(ZIP2ZIP)
@echo "target Bundle: $(PRIVATE_MODULE) ($@)"
rm -rf $@.parts
mkdir -p $@.parts
$(ZIP2ZIP) -i $(PRIVATE_RES_PACKAGE) -o $@.parts/apk.zip AndroidManifest.xml:manifest/AndroidManifest.xml resources.pb "res/**/*" "assets/**/*"
- ifneq ($(jni_shared_libraries),)
+ ifneq ($(jni_shared_libraries),)
$(call create-jni-shared-libs-package,$@.parts/jni.zip)
- endif
- ifeq ($(full_classes_jar),)
- # We don't build jar, need to add the Java resources here.
+ endif
+ ifeq ($(full_classes_jar),)
+ # We don't build jar, need to add the Java resources here.
$(if $(PRIVATE_EXTRA_JAR_ARGS),\
$(call create-java-resources-jar,$@.parts/res.zip) && \
$(ZIP2ZIP) -i $@.parts/res.zip -o $@.parts/res.zip.tmp "**/*:root/" && \
mv -f $@.parts/res.zip.tmp $@.parts/res.zip)
- else # full_classes_jar
+ else # full_classes_jar
$(call create-dex-jar,$@.parts/dex.zip,$(PRIVATE_DEX_FILE))
$(ZIP2ZIP) -i $@.parts/dex.zip -o $@.parts/dex.zip.tmp "classes*.dex:dex/"
mv -f $@.parts/dex.zip.tmp $@.parts/dex.zip
$(call extract-resources-jar,$@.parts/res.zip,$(PRIVATE_SOURCE_ARCHIVE))
$(ZIP2ZIP) -i $@.parts/res.zip -o $@.parts/res.zip.tmp "**/*:root/"
mv -f $@.parts/res.zip.tmp $@.parts/res.zip
- endif # full_classes_jar
+ endif # full_classes_jar
$(MERGE_ZIPS) $@ $@.parts/*.zip
rm -rf $@.parts
- ALL_MODULES.$(LOCAL_MODULE).BUNDLE := $(my_bundle_module)
-endif
+ALL_MODULES.$(LOCAL_MODULE).BUNDLE := $(my_bundle_module)
-###############################
-## Build dpi-specific apks, if it's apps_only build.
ifdef TARGET_BUILD_APPS
-ifdef LOCAL_DPI_VARIANTS
-$(foreach d, $(LOCAL_DPI_VARIANTS), \
- $(eval my_dpi := $(d)) \
- $(eval include $(BUILD_SYSTEM)/dpi_specific_apk.mk))
-endif
+ ifdef LOCAL_DPI_VARIANTS
+ $(call pretty-error,Building DPI-specific APKs is no longer supported)
+ endif
endif
###############################
diff --git a/core/product.mk b/core/product.mk
index 777d2bc..192d58c 100644
--- a/core/product.mk
+++ b/core/product.mk
@@ -245,6 +245,7 @@
_product_var_list += \
PRODUCT_USE_PROFILE_FOR_BOOT_IMAGE \
PRODUCT_DEX_PREOPT_BOOT_IMAGE_PROFILE_LOCATION \
+ PRODUCT_USES_ART \
_product_var_list += PRODUCT_SYSTEM_SERVER_COMPILER_FILTER
# Per-module sanitizer configs
diff --git a/core/soong_app_prebuilt.mk b/core/soong_app_prebuilt.mk
index 8d92b20..8153d78 100644
--- a/core/soong_app_prebuilt.mk
+++ b/core/soong_app_prebuilt.mk
@@ -60,7 +60,7 @@
$(LOCAL_BUILT_MODULE): $(LOCAL_PREBUILT_MODULE_FILE)
@echo "Copy: $@"
$(copy-file-to-target)
- $(call appcompat-header, aapt2)
+ $(appcompat-header)
$(run-appcompat)
else
$(eval $(call copy-one-file,$(LOCAL_PREBUILT_MODULE_FILE),$(LOCAL_BUILT_MODULE)))
diff --git a/core/soong_config.mk b/core/soong_config.mk
index c01fc98..46e026a 100644
--- a/core/soong_config.mk
+++ b/core/soong_config.mk
@@ -165,7 +165,7 @@
$(call add_json_list, ProductHiddenAPIStubsSystem, $(PRODUCT_HIDDENAPI_STUBS_SYSTEM))
$(call add_json_list, ProductHiddenAPIStubsTest, $(PRODUCT_HIDDENAPI_STUBS_TEST))
-$(call add_json_str, TargetFSConfigGen, $(TARGET_FS_CONFIG_GEN))
+$(call add_json_list, TargetFSConfigGen, $(TARGET_FS_CONFIG_GEN))
$(call add_json_map, VendorVars)
$(foreach namespace,$(SOONG_CONFIG_NAMESPACES),\
diff --git a/core/static_java_library.mk b/core/static_java_library.mk
index ee759b9..cb3281a 100644
--- a/core/static_java_library.mk
+++ b/core/static_java_library.mk
@@ -33,10 +33,6 @@
include $(BUILD_SYSTEM)/force_aapt2.mk
-ifdef LOCAL_AAPT2_ONLY
-LOCAL_USE_AAPT2 := true
-endif
-
# Hack to build static Java library with Android resource
# See bug 5714516
all_resources :=
@@ -46,11 +42,9 @@
need_compile_res := true
LOCAL_RESOURCE_DIR := $(foreach d,$(LOCAL_RESOURCE_DIR),$(call clean-path,$(d)))
endif
-ifeq ($(LOCAL_USE_AAPT2),true)
ifneq ($(strip $(LOCAL_STATIC_ANDROID_LIBRARIES) $(LOCAL_STATIC_JAVA_AAR_LIBRARIES)),)
need_compile_res := true
endif
-endif
ifeq ($(need_compile_res),true)
all_resources := $(strip \
@@ -84,22 +78,20 @@
R_file_stamp := $(intermediates.COMMON)/src/R.stamp
LOCAL_INTERMEDIATE_TARGETS += $(R_file_stamp)
-ifeq ($(LOCAL_USE_AAPT2),true)
- ifneq ($(strip $(LOCAL_STATIC_ANDROID_LIBRARIES) $(LOCAL_STATIC_JAVA_AAR_LIBRARIES)),)
- # If we are using static android libraries, every source file becomes an overlay.
- # This is to emulate old AAPT behavior which simulated library support.
- my_res_resources :=
- my_overlay_resources := $(all_resources)
- else
- # Otherwise, for a library we treat all the resource equal with no overlay.
- my_res_resources := $(all_resources)
- my_overlay_resources :=
- endif
- # For libraries put everything in the COMMON intermediate directory.
- my_res_package := $(intermediates.COMMON)/package-res.apk
+ifneq ($(strip $(LOCAL_STATIC_ANDROID_LIBRARIES) $(LOCAL_STATIC_JAVA_AAR_LIBRARIES)),)
+ # If we are using static android libraries, every source file becomes an overlay.
+ # This is to emulate old AAPT behavior which simulated library support.
+ my_res_resources :=
+ my_overlay_resources := $(all_resources)
+else
+ # Otherwise, for a library we treat all the resource equal with no overlay.
+ my_res_resources := $(all_resources)
+ my_overlay_resources :=
+endif
+# For libraries put everything in the COMMON intermediate directory.
+my_res_package := $(intermediates.COMMON)/package-res.apk
- LOCAL_INTERMEDIATE_TARGETS += $(my_res_package)
-endif # LOCAL_USE_AAPT2
+LOCAL_INTERMEDIATE_TARGETS += $(my_res_package)
endif # need_compile_res
@@ -127,7 +119,6 @@
endif
endif
-ifeq ($(LOCAL_USE_AAPT2),true)
import_proguard_flag_files := $(strip $(foreach l,$(LOCAL_STATIC_ANDROID_LIBRARIES) $(LOCAL_STATIC_JAVA_AAR_LIBRARIES),\
$(call intermediates-dir-for,JAVA_LIBRARIES,$(l),,COMMON)/export_proguard_flags))
$(intermediates.COMMON)/export_proguard_flags: $(import_proguard_flag_files) $(addprefix $(LOCAL_PATH)/,$(LOCAL_EXPORT_PROGUARD_FLAG_FILES))
@@ -139,7 +130,6 @@
cat $$f >>$@; \
done
import_proguard_flag_files :=
-endif
include $(BUILD_SYSTEM)/aapt_flags.mk
@@ -150,7 +140,6 @@
# add --non-constant-id to prevent inlining constants.
# AAR needs text symbol file R.txt.
-ifeq ($(LOCAL_USE_AAPT2),true)
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_AAPT_FLAGS := $(LOCAL_AAPT_FLAGS) --static-lib --output-text-symbols $(intermediates.COMMON)/R.txt
ifndef LOCAL_AAPT_NAMESPACES
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_AAPT_FLAGS += --no-static-lib-packages
@@ -158,15 +147,6 @@
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_PRODUCT_AAPT_CONFIG :=
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_PRODUCT_AAPT_PREF_CONFIG :=
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_TARGET_AAPT_CHARACTERISTICS :=
-else
-$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_AAPT_FLAGS := $(LOCAL_AAPT_FLAGS) --non-constant-id --output-text-symbols $(intermediates.COMMON)
-
-my_srcjar := $(intermediates.COMMON)/aapt.srcjar
-LOCAL_SRCJARS += $(my_srcjar)
-$(R_file_stamp): PRIVATE_SRCJAR := $(my_srcjar)
-$(R_file_stamp): PRIVATE_JAVA_GEN_DIR := $(intermediates.COMMON)/aapt
-$(R_file_stamp): .KATI_IMPLICIT_OUTPUTS := $(my_srcjar)
-endif
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_ANDROID_MANIFEST := $(full_android_manifest)
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_RESOURCE_PUBLICS_OUTPUT := $(intermediates.COMMON)/public_resources.xml
@@ -178,26 +158,16 @@
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_MANIFEST_PACKAGE_NAME :=
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_MANIFEST_INSTRUMENTATION_FOR :=
-ifeq ($(LOCAL_USE_AAPT2),true)
- # One more level with name res so we can zip up the flat resources that can be linked by apps.
- my_compiled_res_base_dir := $(intermediates.COMMON)/flat-res/res
- ifneq (,$(filter-out current,$(renderscript_target_api)))
- ifneq ($(call math_gt_or_eq,$(renderscript_target_api),21),true)
- my_generated_res_zips := $(rs_generated_res_zip)
- endif # renderscript_target_api < 21
- endif # renderscript_target_api is set
- include $(BUILD_SYSTEM)/aapt2.mk
- $(my_res_package) : $(framework_res_package_export)
- $(my_res_package): .KATI_IMPLICIT_OUTPUTS += $(intermediates.COMMON)/R.txt
-else
- $(R_file_stamp): .KATI_IMPLICIT_OUTPUTS += $(intermediates.COMMON)/R.txt
- $(R_file_stamp): PRIVATE_RESOURCE_LIST := $(all_resources)
- $(R_file_stamp) : $(all_resources) $(full_android_manifest) $(AAPT) $(SOONG_ZIP) \
- $(framework_res_package_export) $(rs_generated_res_zip)
- @echo "target R.java/Manifest.java: $(PRIVATE_MODULE) ($@)"
- $(create-resource-java-files)
- $(hide) find $(PRIVATE_JAVA_GEN_DIR) -name R.java | xargs cat > $@
-endif # LOCAL_USE_AAPT2
+# One more level with name res so we can zip up the flat resources that can be linked by apps.
+my_compiled_res_base_dir := $(intermediates.COMMON)/flat-res/res
+ifneq (,$(filter-out current,$(renderscript_target_api)))
+ ifneq ($(call math_gt_or_eq,$(renderscript_target_api),21),true)
+ my_generated_res_zips := $(rs_generated_res_zip)
+ endif # renderscript_target_api < 21
+endif # renderscript_target_api is set
+include $(BUILD_SYSTEM)/aapt2.mk
+$(my_res_package) : $(framework_res_package_export)
+$(my_res_package): .KATI_IMPLICIT_OUTPUTS += $(intermediates.COMMON)/R.txt
endif # need_compile_res
diff --git a/core/version_defaults.mk b/core/version_defaults.mk
index a392924..b248fd3 100644
--- a/core/version_defaults.mk
+++ b/core/version_defaults.mk
@@ -39,9 +39,9 @@
include $(INTERNAL_BUILD_ID_MAKEFILE)
endif
-DEFAULT_PLATFORM_VERSION := QP1A
-MIN_PLATFORM_VERSION := QP1A
-MAX_PLATFORM_VERSION := QP1A
+DEFAULT_PLATFORM_VERSION := RP1A
+MIN_PLATFORM_VERSION := RP1A
+MAX_PLATFORM_VERSION := RP1A
ALLOWED_VERSIONS := $(call allowed-platform-versions,\
$(MIN_PLATFORM_VERSION),\
@@ -82,11 +82,20 @@
# please add that PLATFORM_VERSION as well as clean up obsolete PLATFORM_VERSION's
# in the following text file:
# cts/tests/tests/os/assets/platform_versions.txt
+
+# Note that there should be one PLATFORM_VERSION and PLATFORM_VERSION_CODENAME
+# entry for each unreleased API level, regardless of
+# MIN_PLATFORM_VERSION/MAX_PLATFORM_VERSION. PLATFORM_VERSION is used to
+# generate the range of allowed SDK versions, so it must have an entry for every
+# unreleased API level targetable by this branch, not just those that are valid
+# lunch targets for this branch.
PLATFORM_VERSION.QP1A := Q
+PLATFORM_VERSION.RP1A := R
# These are the current development codenames, if the build is not a final
# release build. If this is a final release build, it is simply "REL".
PLATFORM_VERSION_CODENAME.QP1A := Q
+PLATFORM_VERSION_CODENAME.RP1A := R
ifndef PLATFORM_VERSION
PLATFORM_VERSION := $(PLATFORM_VERSION.$(TARGET_PLATFORM_VERSION))
diff --git a/target/board/gsi_system.prop b/target/board/gsi_system.prop
index d768c83..780aadc 100644
--- a/target/board/gsi_system.prop
+++ b/target/board/gsi_system.prop
@@ -4,6 +4,9 @@
# GSI always disables adb authentication
ro.adb.secure=0
+# GSI disables non-AOSP nnapi extensions on product partition
+ro.nnapi.extensions.deny_on_product=true
+
# TODO(b/120679683): disable RescueParty before all problem apps solved
persist.sys.disable_rescue=true
diff --git a/target/board/gsi_system_user.prop b/target/board/gsi_system_user.prop
index becb783..217bd01 100644
--- a/target/board/gsi_system_user.prop
+++ b/target/board/gsi_system_user.prop
@@ -1,6 +1,9 @@
# GSI always generate dex pre-opt in system image
ro.cp_system_other_odex=0
+# GSI disables non-AOSP nnapi extensions on product partition
+ro.nnapi.extensions.deny_on_product=true
+
# TODO(b/120679683): disable RescueParty before all problem apps solved
persist.sys.disable_rescue=true
diff --git a/target/product/base_system.mk b/target/product/base_system.mk
index 46bf350..e9e8b49 100644
--- a/target/product/base_system.mk
+++ b/target/product/base_system.mk
@@ -210,6 +210,7 @@
netd \
NetworkStack \
org.apache.http.legacy \
+ otacerts \
perfetto \
ping \
ping6 \
diff --git a/target/product/base_vendor.mk b/target/product/base_vendor.mk
index bf01957..c45f870 100644
--- a/target/product/base_vendor.mk
+++ b/target/product/base_vendor.mk
@@ -23,6 +23,7 @@
init_second_stage.recovery \
ld.config.recovery.txt \
linker.recovery \
+ otacerts.recovery \
recovery \
shell_and_utilities_recovery \
watchdogd.recovery \
diff --git a/target/product/mainline_system.mk b/target/product/mainline_system.mk
index d75809c..66207df 100644
--- a/target/product/mainline_system.mk
+++ b/target/product/mainline_system.mk
@@ -18,6 +18,8 @@
$(call inherit-product, $(SRC_TARGET_DIR)/product/handheld_system.mk)
$(call inherit-product, $(SRC_TARGET_DIR)/product/telephony_system.mk)
$(call inherit-product, $(SRC_TARGET_DIR)/product/languages_default.mk)
+# Enable updating of APEXes
+$(call inherit-product, $(SRC_TARGET_DIR)/product/updatable_apex.mk)
# Add adb keys to debuggable AOSP builds (if they exist)
$(call inherit-product-if-exists, vendor/google/security/adb/vendor_key.mk)
diff --git a/target/product/runtime_libart.mk b/target/product/runtime_libart.mk
index e08b56b..a88ba3c 100644
--- a/target/product/runtime_libart.mk
+++ b/target/product/runtime_libart.mk
@@ -54,7 +54,7 @@
dalvik.vm.dexopt.secondary=true \
dalvik.vm.appimageformat=lz4
-PRODUCT_PROPERTY_OVERRIDES += \
+PRODUCT_SYSTEM_DEFAULT_PROPERTIES += \
ro.dalvik.vm.native.bridge=0
# Different dexopt types for different package update/install times.
@@ -91,3 +91,9 @@
PRODUCT_SYSTEM_DEFAULT_PROPERTIES += \
dalvik.vm.minidebuginfo=true \
dalvik.vm.dex2oat-minidebuginfo=true
+
+# Disable iorapd by default
+PRODUCT_SYSTEM_DEFAULT_PROPERTIES += \
+ ro.iorapd.enable=false
+
+PRODUCT_USES_ART := true
diff --git a/target/product/security/Android.mk b/target/product/security/Android.mk
index 4142ea9..1d695ae 100644
--- a/target/product/security/Android.mk
+++ b/target/product/security/Android.mk
@@ -23,3 +23,40 @@
include $(BUILD_PREBUILT)
endif
endif
+
+
+#######################################
+# otacerts: A keystore with the authorized keys in it, which is used to verify the authenticity of
+# downloaded OTA packages.
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := otacerts
+LOCAL_MODULE_CLASS := ETC
+LOCAL_MODULE_STEM := otacerts.zip
+LOCAL_MODULE_PATH := $(TARGET_OUT_ETC)/security
+include $(BUILD_SYSTEM)/base_rules.mk
+$(LOCAL_BUILT_MODULE): PRIVATE_CERT := $(DEFAULT_SYSTEM_DEV_CERTIFICATE).x509.pem
+$(LOCAL_BUILT_MODULE): $(SOONG_ZIP) $(DEFAULT_SYSTEM_DEV_CERTIFICATE).x509.pem
+ $(SOONG_ZIP) -o $@ -j -f $(PRIVATE_CERT)
+
+
+#######################################
+# otacerts for recovery image.
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := otacerts.recovery
+LOCAL_MODULE_CLASS := ETC
+LOCAL_MODULE_STEM := otacerts.zip
+LOCAL_MODULE_PATH := $(TARGET_RECOVERY_ROOT_OUT)/system/etc/security
+include $(BUILD_SYSTEM)/base_rules.mk
+
+extra_recovery_keys := $(patsubst %,%.x509.pem,$(PRODUCT_EXTRA_RECOVERY_KEYS))
+
+$(LOCAL_BUILT_MODULE): PRIVATE_CERT := $(DEFAULT_SYSTEM_DEV_CERTIFICATE).x509.pem
+$(LOCAL_BUILT_MODULE): PRIVATE_EXTRA_RECOVERY_KEYS := $(extra_recovery_keys)
+$(LOCAL_BUILT_MODULE): \
+ $(SOONG_ZIP) \
+ $(DEFAULT_SYSTEM_DEV_CERTIFICATE).x509.pem \
+ $(extra_recovery_keys)
+ $(SOONG_ZIP) -o $@ -j \
+ $(foreach key_file, $(PRIVATE_CERT) $(PRIVATE_EXTRA_RECOVERY_KEYS), -f $(key_file))
diff --git a/target/product/updatable_apex.mk b/target/product/updatable_apex.mk
new file mode 100644
index 0000000..4b31578
--- /dev/null
+++ b/target/product/updatable_apex.mk
@@ -0,0 +1,20 @@
+#
+# Copyright (C) 2019 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+# Inherit this when the target needs to support updating APEXes
+
+PRODUCT_PROPERTY_OVERRIDES := ro.apex.updatable=true
+PRODUCT_PACKAGES := com.android.apex.cts.shim.v1_prebuilt
diff --git a/tools/fs_config/Android.bp b/tools/fs_config/Android.bp
index d6fae2d..d9a48d7 100644
--- a/tools/fs_config/Android.bp
+++ b/tools/fs_config/Android.bp
@@ -42,7 +42,7 @@
genrule {
name: "oemaids_header_gen",
tool_files: ["fs_config_generator.py"],
- cmd: "$(location fs_config_generator.py) oemaid --aid-header=$(location :android_filesystem_config_header) $(location :target_fs_config_gen) >$(out)",
+ cmd: "$(location fs_config_generator.py) oemaid --aid-header=$(location :android_filesystem_config_header) $(locations :target_fs_config_gen) >$(out)",
srcs: [
":target_fs_config_gen",
":android_filesystem_config_header",
@@ -62,7 +62,7 @@
genrule {
name: "passwd_gen",
tool_files: ["fs_config_generator.py"],
- cmd: "$(location fs_config_generator.py) passwd --required-prefix=vendor_ --aid-header=$(location :android_filesystem_config_header) $(location :target_fs_config_gen) >$(out)",
+ cmd: "$(location fs_config_generator.py) passwd --required-prefix=vendor_ --aid-header=$(location :android_filesystem_config_header) $(locations :target_fs_config_gen) >$(out)",
srcs: [
":target_fs_config_gen",
":android_filesystem_config_header",
@@ -82,7 +82,7 @@
genrule {
name: "group_gen",
tool_files: ["fs_config_generator.py"],
- cmd: "$(location fs_config_generator.py) group --required-prefix=vendor_ --aid-header=$(location :android_filesystem_config_header) $(location :target_fs_config_gen) >$(out)",
+ cmd: "$(location fs_config_generator.py) group --required-prefix=vendor_ --aid-header=$(location :android_filesystem_config_header) $(locations :target_fs_config_gen) >$(out)",
srcs: [
":target_fs_config_gen",
":android_filesystem_config_header",
diff --git a/tools/fs_config/fs_config.go b/tools/fs_config/fs_config.go
index 869cb3d..16bcefa 100644
--- a/tools/fs_config/fs_config.go
+++ b/tools/fs_config/fs_config.go
@@ -24,7 +24,7 @@
android.RegisterModuleType("target_fs_config_gen_filegroup", targetFSConfigGenFactory)
}
-// target_fs_config_gen_filegroup is used to expose the file pointed to by TARGET_FS_CONFIG_GEN to
+// target_fs_config_gen_filegroup is used to expose the files pointed to by TARGET_FS_CONFIG_GEN to
// genrules in Soong. If TARGET_FS_CONFIG_GEN is empty, it will export an empty file instead.
func targetFSConfigGenFactory() android.Module {
module := &targetFSConfigGen{}
@@ -36,17 +36,17 @@
type targetFSConfigGen struct {
android.ModuleBase
- path android.Path
+ paths android.Paths
}
func (targetFSConfigGen) DepsMutator(ctx android.BottomUpMutatorContext) {}
func (t *targetFSConfigGen) GenerateAndroidBuildActions(ctx android.ModuleContext) {
- if ret := ctx.DeviceConfig().TargetFSConfigGen(); ret != nil && *ret != "" {
- t.path = android.PathForSource(ctx, *ret)
+ if ret := ctx.DeviceConfig().TargetFSConfigGen(); len(ret) != 0 {
+ t.paths = android.PathsForSource(ctx, ret)
} else {
path := android.PathForModuleGen(ctx, "empty")
- t.path = path
+ t.paths = android.Paths{path}
rule := android.NewRuleBuilder()
rule.Command().Text("rm -rf").Output(path)
@@ -56,5 +56,5 @@
}
func (t *targetFSConfigGen) Srcs() android.Paths {
- return android.Paths{t.path}
+ return t.paths
}
diff --git a/tools/releasetools/img_from_target_files.py b/tools/releasetools/img_from_target_files.py
index 0156b72..941ef65 100755
--- a/tools/releasetools/img_from_target_files.py
+++ b/tools/releasetools/img_from_target_files.py
@@ -96,7 +96,6 @@
finally:
logger.info("cleaning up...")
common.ZipClose(output_zip)
- shutil.rmtree(OPTIONS.input_tmp)
logger.info("done.")
@@ -108,3 +107,5 @@
except common.ExternalError as e:
logger.exception("\n ERROR:\n")
sys.exit(1)
+ finally:
+ common.Cleanup()
diff --git a/tools/releasetools/merge_target_files.py b/tools/releasetools/merge_target_files.py
index 77c774a..2e5cbca 100755
--- a/tools/releasetools/merge_target_files.py
+++ b/tools/releasetools/merge_target_files.py
@@ -13,11 +13,11 @@
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations under
# the License.
+"""This script merges two partial target files packages.
-"""
-This script merges two partial target files packages (one of which contains
-system files, and the other contains non-system files) together, producing a
-complete target files package that can be used to generate an OTA package.
+One package contains system files, and the other contains non-system files.
+It produces a complete target files package that can be used to generate an
+OTA package.
Usage: merge_target_files.py [args]
@@ -58,6 +58,10 @@
The output ota package. This is a zip archive. Use of this flag may
require passing the --path common flag; see common.py.
+ --output-img output-img-package
+ The output img package, suitable for use with 'fastboot update'. Use of
+ this flag may require passing the --path common flag; see common.py.
+
--output-super-empty output-super-empty-image
If provided, creates a super_empty.img file from the merged target
files package and saves it at this path.
@@ -82,6 +86,7 @@
import add_img_to_target_files
import build_super_image
import common
+import img_from_target_files
import ota_from_target_files
logger = logging.getLogger(__name__)
@@ -96,6 +101,7 @@
OPTIONS.output_dir = None
OPTIONS.output_item_list = None
OPTIONS.output_ota = None
+OPTIONS.output_img = None
OPTIONS.output_super_empty = None
OPTIONS.rebuild_recovery = False
OPTIONS.keep_tmp = False
@@ -126,8 +132,8 @@
'META/*',
]
-# default_system_misc_info_keys is a list of keys to obtain from the system instance of
-# META/misc_info.txt. The remaining keys from the other instance.
+# default_system_misc_info_keys is a list of keys to obtain from the system
+# instance of META/misc_info.txt. The remaining keys from the other instance.
default_system_misc_info_keys = [
'avb_system_hashtree_enable',
@@ -185,10 +191,8 @@
Args:
target_files: The target files zip archive from which to extract items.
-
target_files_temp_dir: The temporary directory where the extracted items
- will land.
-
+ will land.
extract_item_list: A list of items to extract.
"""
@@ -198,9 +202,7 @@
# zip file. Otherwise, the extraction step will fail.
with zipfile.ZipFile(
- target_files,
- 'r',
- allowZip64=True) as target_files_zipfile:
+ target_files, 'r', allowZip64=True) as target_files_zipfile:
target_files_namelist = target_files_zipfile.namelist()
filtered_extract_item_list = []
@@ -214,18 +216,17 @@
# Extract from target_files into target_files_temp_dir the
# filtered_extract_item_list.
- common.UnzipToDir(
- target_files,
- target_files_temp_dir,
- filtered_extract_item_list)
+ common.UnzipToDir(target_files, target_files_temp_dir,
+ filtered_extract_item_list)
def copy_items(from_dir, to_dir, patterns):
"""Similar to extract_items() except uses an input dir instead of zip."""
file_paths = []
for dirpath, _, filenames in os.walk(from_dir):
- file_paths.extend(os.path.relpath(path=os.path.join(dirpath, filename),
- start=from_dir) for filename in filenames)
+ file_paths.extend(
+ os.path.relpath(path=os.path.join(dirpath, filename), start=from_dir)
+ for filename in filenames)
filtered_file_paths = set()
for pattern in patterns:
@@ -250,26 +251,25 @@
Args:
config_file_path: The path to the config file to open and read.
+
+ Returns:
+ The list of strings in the config file.
"""
with open(config_file_path) as config_file:
return config_file.read().splitlines()
-def validate_config_lists(
- system_item_list,
- system_misc_info_keys,
- other_item_list):
+def validate_config_lists(system_item_list, system_misc_info_keys,
+ other_item_list):
"""Performs validations on the merge config lists.
Args:
- system_item_list: The list of items to extract from the partial
- system target files package as is.
-
- system_misc_info_keys: A list of keys to obtain from the system instance
- of META/misc_info.txt. The remaining keys from the other instance.
-
- other_item_list: The list of items to extract from the partial
- other target files package as is.
+ system_item_list: The list of items to extract from the partial system
+ target files package as is.
+ system_misc_info_keys: A list of keys to obtain from the system instance of
+ META/misc_info.txt. The remaining keys from the other instance.
+ other_item_list: The list of items to extract from the partial other target
+ files package as is.
Returns:
False if a validation fails, otherwise true.
@@ -284,7 +284,7 @@
# by the default config lists.
difference = default_combined_item_set.difference(combined_item_set)
if difference:
- logger.error('Missing merge config items: %s' % list(difference))
+ logger.error('Missing merge config items: %s', list(difference))
logger.error('Please ensure missing items are in either the '
'system-item-list or other-item-list files provided to '
'this script.')
@@ -299,11 +299,10 @@
return True
-def process_ab_partitions_txt(
- system_target_files_temp_dir,
- other_target_files_temp_dir,
- output_target_files_temp_dir):
- """Perform special processing for META/ab_partitions.txt
+def process_ab_partitions_txt(system_target_files_temp_dir,
+ other_target_files_temp_dir,
+ output_target_files_temp_dir):
+ """Perform special processing for META/ab_partitions.txt.
This function merges the contents of the META/ab_partitions.txt files from
the system directory and the other directory, placing the merged result in
@@ -314,22 +313,20 @@
names.
Args:
- system_target_files_temp_dir: The name of a directory containing the
- special items extracted from the system target files package.
-
- other_target_files_temp_dir: The name of a directory containing the
- special items extracted from the other target files package.
-
- output_target_files_temp_dir: The name of a directory that will be used
- to create the output target files package after all the special cases
- are processed.
+ system_target_files_temp_dir: The name of a directory containing the special
+ items extracted from the system target files package.
+ other_target_files_temp_dir: The name of a directory containing the special
+ items extracted from the other target files package.
+ output_target_files_temp_dir: The name of a directory that will be used to
+ create the output target files package after all the special cases are
+ processed.
"""
- system_ab_partitions_txt = os.path.join(
- system_target_files_temp_dir, 'META', 'ab_partitions.txt')
+ system_ab_partitions_txt = os.path.join(system_target_files_temp_dir, 'META',
+ 'ab_partitions.txt')
- other_ab_partitions_txt = os.path.join(
- other_target_files_temp_dir, 'META', 'ab_partitions.txt')
+ other_ab_partitions_txt = os.path.join(other_target_files_temp_dir, 'META',
+ 'ab_partitions.txt')
with open(system_ab_partitions_txt) as f:
system_ab_partitions = f.read().splitlines()
@@ -339,8 +336,8 @@
output_ab_partitions = set(system_ab_partitions + other_ab_partitions)
- output_ab_partitions_txt = os.path.join(
- output_target_files_temp_dir, 'META', 'ab_partitions.txt')
+ output_ab_partitions_txt = os.path.join(output_target_files_temp_dir, 'META',
+ 'ab_partitions.txt')
with open(output_ab_partitions_txt, 'w') as output:
for partition in sorted(output_ab_partitions):
@@ -348,42 +345,35 @@
def append_recovery_to_filesystem_config(output_target_files_temp_dir):
- """Perform special processing for META/filesystem_config.txt
+ """Perform special processing for META/filesystem_config.txt.
This function appends recovery information to META/filesystem_config.txt
so that recovery patch regeneration will succeed.
Args:
- output_target_files_temp_dir: The name of a directory that will be used
- to create the output target files package after all the special cases
- are processed. We find filesystem_config.txt here.
+ output_target_files_temp_dir: The name of a directory that will be used to
+ create the output target files package after all the special cases are
+ processed. We find filesystem_config.txt here.
"""
- filesystem_config_txt = os.path.join(
- output_target_files_temp_dir,
- 'META',
- 'filesystem_config.txt')
+ filesystem_config_txt = os.path.join(output_target_files_temp_dir, 'META',
+ 'filesystem_config.txt')
with open(filesystem_config_txt, 'a') as f:
# TODO(bpeckham) this data is hard coded. It should be generated
# programmatically.
- f.write(
- 'system/bin/install-recovery.sh 0 0 750 '
- 'selabel=u:object_r:install_recovery_exec:s0 capabilities=0x0\n')
- f.write(
- 'system/recovery-from-boot.p 0 0 644 '
- 'selabel=u:object_r:system_file:s0 capabilities=0x0\n')
- f.write(
- 'system/etc/recovery.img 0 0 440 '
- 'selabel=u:object_r:install_recovery_exec:s0 capabilities=0x0\n')
+ f.write('system/bin/install-recovery.sh 0 0 750 '
+ 'selabel=u:object_r:install_recovery_exec:s0 capabilities=0x0\n')
+ f.write('system/recovery-from-boot.p 0 0 644 '
+ 'selabel=u:object_r:system_file:s0 capabilities=0x0\n')
+ f.write('system/etc/recovery.img 0 0 440 '
+ 'selabel=u:object_r:install_recovery_exec:s0 capabilities=0x0\n')
-def process_misc_info_txt(
- system_target_files_temp_dir,
- other_target_files_temp_dir,
- output_target_files_temp_dir,
- system_misc_info_keys):
- """Perform special processing for META/misc_info.txt
+def process_misc_info_txt(system_target_files_temp_dir,
+ other_target_files_temp_dir,
+ output_target_files_temp_dir, system_misc_info_keys):
+ """Perform special processing for META/misc_info.txt.
This function merges the contents of the META/misc_info.txt files from the
system directory and the other directory, placing the merged result in the
@@ -392,18 +382,15 @@
content.
Args:
- system_target_files_temp_dir: The name of a directory containing the
- special items extracted from the system target files package.
-
- other_target_files_temp_dir: The name of a directory containing the
- special items extracted from the other target files package.
-
- output_target_files_temp_dir: The name of a directory that will be used
- to create the output target files package after all the special cases
- are processed.
-
- system_misc_info_keys: A list of keys to obtain from the system instance
- of META/misc_info.txt. The remaining keys from the other instance.
+ system_target_files_temp_dir: The name of a directory containing the special
+ items extracted from the system target files package.
+ other_target_files_temp_dir: The name of a directory containing the special
+ items extracted from the other target files package.
+ output_target_files_temp_dir: The name of a directory that will be used to
+ create the output target files package after all the special cases are
+ processed.
+ system_misc_info_keys: A list of keys to obtain from the system instance of
+ META/misc_info.txt. The remaining keys from the other instance.
"""
def read_helper(d):
@@ -434,19 +421,18 @@
# Partition groups and group sizes are defined by the other (non-system)
# misc info file because these values may vary for each board that uses
# a shared system image.
- for partition_group in merged_info_dict['super_partition_groups'].split(' '):
+ for partition_group in merged_info_dict['super_partition_groups'].split(
+ ' '):
if ('super_%s_group_size' % partition_group) not in merged_info_dict:
raise ValueError(
'Other META/misc_info.txt does not contain required key '
'super_%s_group_size.' % partition_group)
key = 'super_%s_partition_list' % partition_group
- merged_info_dict[key] = '%s %s' % (
- system_info_dict.get(key, ''),
- merged_info_dict.get(key, ''))
+ merged_info_dict[key] = '%s %s' % (system_info_dict.get(
+ key, ''), merged_info_dict.get(key, ''))
- output_misc_info_txt = os.path.join(
- output_target_files_temp_dir,
- 'META', 'misc_info.txt')
+ output_misc_info_txt = os.path.join(output_target_files_temp_dir, 'META',
+ 'misc_info.txt')
sorted_keys = sorted(merged_info_dict.keys())
@@ -464,12 +450,11 @@
Args:
temp_dir: The name of a scratch directory that this function can use for
- intermediate files generated during processing.
-
+ intermediate files generated during processing.
output_target_files_temp_dir: The name of the working directory that must
- already contain plat_file_contexts and vendor_file_contexts (in the
- appropriate sub directories), and to which META/file_contexts.bin will be
- written.
+ already contain plat_file_contexts and vendor_file_contexts (in the
+ appropriate sub directories), and to which META/file_contexts.bin will be
+ written.
"""
# To create a merged file_contexts.bin file, we use the system and vendor
@@ -490,9 +475,8 @@
for partition in ['SYSTEM', 'VENDOR', 'PRODUCT', 'ODM']:
prefix = 'plat' if partition == 'SYSTEM' else partition.lower()
- file_contexts = os.path.join(
- output_target_files_temp_dir,
- partition, 'etc', 'selinux', prefix + '_file_contexts')
+ file_contexts = os.path.join(output_target_files_temp_dir, partition, 'etc',
+ 'selinux', prefix + '_file_contexts')
mandatory = partition in ['SYSTEM', 'VENDOR']
@@ -518,27 +502,23 @@
# Finally, the compile step creates the final META/file_contexts.bin.
- file_contexts_bin = os.path.join(
- output_target_files_temp_dir,
- 'META', 'file_contexts.bin')
+ file_contexts_bin = os.path.join(output_target_files_temp_dir, 'META',
+ 'file_contexts.bin')
command = [
'sefcontext_compile',
- '-o', file_contexts_bin,
+ '-o',
+ file_contexts_bin,
sorted_file_contexts_txt,
]
common.RunAndWait(command, verbose=True)
-def process_special_cases(
- temp_dir,
- system_target_files_temp_dir,
- other_target_files_temp_dir,
- output_target_files_temp_dir,
- system_misc_info_keys,
- rebuild_recovery
-):
+def process_special_cases(temp_dir, system_target_files_temp_dir,
+ other_target_files_temp_dir,
+ output_target_files_temp_dir, system_misc_info_keys,
+ rebuild_recovery):
"""Perform special-case processing for certain target files items.
Certain files in the output target files package require special-case
@@ -546,23 +526,18 @@
Args:
temp_dir: The name of a scratch directory that this function can use for
- intermediate files generated during processing.
-
- system_target_files_temp_dir: The name of a directory containing the
- special items extracted from the system target files package.
-
- other_target_files_temp_dir: The name of a directory containing the
- special items extracted from the other target files package.
-
- output_target_files_temp_dir: The name of a directory that will be used
- to create the output target files package after all the special cases
- are processed.
-
- system_misc_info_keys: A list of keys to obtain from the system instance
- of META/misc_info.txt. The remaining keys from the other instance.
-
+ intermediate files generated during processing.
+ system_target_files_temp_dir: The name of a directory containing the special
+ items extracted from the system target files package.
+ other_target_files_temp_dir: The name of a directory containing the special
+ items extracted from the other target files package.
+ output_target_files_temp_dir: The name of a directory that will be used to
+ create the output target files package after all the special cases are
+ processed.
+ system_misc_info_keys: A list of keys to obtain from the system instance of
+ META/misc_info.txt. The remaining keys from the other instance.
rebuild_recovery: If true, rebuild the recovery patch used by non-A/B
- devices and write it to the system image.
+ devices and write it to the system image.
"""
if 'ab_update' in system_misc_info_keys:
@@ -586,19 +561,11 @@
output_target_files_temp_dir=output_target_files_temp_dir)
-def merge_target_files(
- temp_dir,
- system_target_files,
- system_item_list,
- system_misc_info_keys,
- other_target_files,
- other_item_list,
- output_target_files,
- output_dir,
- output_item_list,
- output_ota,
- output_super_empty,
- rebuild_recovery):
+def merge_target_files(temp_dir, system_target_files, system_item_list,
+ system_misc_info_keys, other_target_files,
+ other_item_list, output_target_files, output_dir,
+ output_item_list, output_ota, output_img,
+ output_super_empty, rebuild_recovery):
"""Merge two target files packages together.
This function takes system and other target files packages as input, performs
@@ -607,45 +574,36 @@
Args:
temp_dir: The name of a directory we use when we extract items from the
- input target files packages, and also a scratch directory that we use for
- temporary files.
-
+ input target files packages, and also a scratch directory that we use for
+ temporary files.
system_target_files: The name of the zip archive containing the system
- partial target files package.
-
+ partial target files package.
system_item_list: The list of items to extract from the partial system
- target files package as is, meaning these items will land in the output
- target files package exactly as they appear in the input partial system
- target files package.
-
+ target files package as is, meaning these items will land in the output
+ target files package exactly as they appear in the input partial system
+ target files package.
system_misc_info_keys: The list of keys to obtain from the system instance
- of META/misc_info.txt. The remaining keys from the other instance.
-
- other_target_files: The name of the zip archive containing the other
- partial target files package.
-
- other_item_list: The list of items to extract from the partial other
- target files package as is, meaning these items will land in the output
- target files package exactly as they appear in the input partial other
- target files package.
-
- output_target_files: The name of the output zip archive target files
- package created by merging system and other.
-
+ of META/misc_info.txt. The remaining keys from the other instance.
+ other_target_files: The name of the zip archive containing the other partial
+ target files package.
+ other_item_list: The list of items to extract from the partial other target
+ files package as is, meaning these items will land in the output target
+ files package exactly as they appear in the input partial other target
+ files package.
+ output_target_files: The name of the output zip archive target files package
+ created by merging system and other.
+ output_dir: The destination directory for saving merged files.
+ output_item_list: The list of items to copy into the output_dir.
output_ota: The name of the output zip archive ota package.
-
+ output_img: The name of the output zip archive img package.
output_super_empty: If provided, creates a super_empty.img file from the
- merged target files package and saves it at this path.
-
+ merged target files package and saves it at this path.
rebuild_recovery: If true, rebuild the recovery patch used by non-A/B
- devices and write it to the system image.
+ devices and write it to the system image.
"""
- logger.info(
- 'starting: merge system %s and other %s into output %s',
- system_target_files,
- other_target_files,
- output_target_files)
+ logger.info('starting: merge system %s and other %s into output %s',
+ system_target_files, other_target_files, output_target_files)
# Create directory names that we'll use when we extract files from system,
# and other, and for zipping the final output.
@@ -703,27 +661,6 @@
system_misc_info_keys=system_misc_info_keys,
rebuild_recovery=rebuild_recovery)
- # Create super_empty.img using the merged misc_info.txt.
-
- if output_super_empty:
- misc_info_txt = os.path.join(output_target_files_temp_dir,
- 'META', 'misc_info.txt')
- def read_helper():
- with open(misc_info_txt) as f:
- return list(f.read().splitlines())
-
- misc_info_dict = common.LoadDictionaryFromLines(read_helper())
- if misc_info_dict.get('use_dynamic_partitions') != 'true':
- raise ValueError(
- 'Building super_empty.img requires use_dynamic_partitions=true.')
-
- build_super_image_args = [
- '--verbose',
- misc_info_txt,
- output_super_empty,
- ]
- build_super_image.main(build_super_image_args)
-
# Regenerate IMAGES in the temporary directory.
add_img_args = ['--verbose']
@@ -733,6 +670,34 @@
add_img_to_target_files.main(add_img_args)
+ # Create super_empty.img using the merged misc_info.txt.
+
+ misc_info_txt = os.path.join(output_target_files_temp_dir, 'META',
+ 'misc_info.txt')
+
+ def read_helper():
+ with open(misc_info_txt) as f:
+ return list(f.read().splitlines())
+
+ use_dynamic_partitions = common.LoadDictionaryFromLines(
+ read_helper()).get('use_dynamic_partitions')
+
+ if use_dynamic_partitions != 'true' and output_super_empty:
+ raise ValueError(
+ 'Building super_empty.img requires use_dynamic_partitions=true.')
+ elif use_dynamic_partitions == 'true':
+ super_empty_img = os.path.join(output_target_files_temp_dir, 'IMAGES',
+ 'super_empty.img')
+ build_super_image_args = [
+ misc_info_txt,
+ super_empty_img,
+ ]
+ build_super_image.main(build_super_image_args)
+
+ # Copy super_empty.img to the user-provided output_super_empty location.
+ if output_super_empty:
+ shutil.copyfile(super_empty_img, output_super_empty)
+
# Finally, create the output target files zip archive and/or copy the
# output items to the output target files directory.
@@ -744,8 +709,8 @@
output_zip = os.path.abspath(output_target_files)
output_target_files_list = os.path.join(temp_dir, 'output.list')
- output_target_files_meta_dir = os.path.join(
- output_target_files_temp_dir, 'META')
+ output_target_files_meta_dir = os.path.join(output_target_files_temp_dir,
+ 'META')
command = [
'find',
@@ -754,13 +719,8 @@
# TODO(bpeckham): sort this to be more like build.
meta_content = common.RunAndCheckOutput(command, verbose=False)
command = [
- 'find',
- output_target_files_temp_dir,
- '-path',
- output_target_files_meta_dir,
- '-prune',
- '-o',
- '-print'
+ 'find', output_target_files_temp_dir, '-path',
+ output_target_files_meta_dir, '-prune', '-o', '-print'
]
# TODO(bpeckham): sort this to be more like build.
other_content = common.RunAndCheckOutput(command, verbose=False)
@@ -772,9 +732,12 @@
command = [
'soong_zip',
'-d',
- '-o', output_zip,
- '-C', output_target_files_temp_dir,
- '-l', output_target_files_list,
+ '-o',
+ output_zip,
+ '-C',
+ output_target_files_temp_dir,
+ '-l',
+ output_target_files_list,
]
logger.info('creating %s', output_target_files)
common.RunAndWait(command, verbose=True)
@@ -788,6 +751,15 @@
]
ota_from_target_files.main(ota_from_target_files_args)
+ # Create the IMG package from the merged target files package.
+
+ if output_img:
+ img_from_target_files_args = [
+ output_zip,
+ output_img,
+ ]
+ img_from_target_files.main(img_from_target_files_args)
+
def call_func_with_temp_dir(func, keep_tmp):
"""Manage the creation and cleanup of the temporary directory.
@@ -796,9 +768,8 @@
directory. It also cleans up the temporary directory.
Args:
- func: The function to call. Should accept one parameter, the path to
- the temporary directory.
-
+ func: The function to call. Should accept one parameter, the path to the
+ temporary directory.
keep_tmp: Keep the temporary directory after processing is complete.
"""
@@ -847,6 +818,8 @@
OPTIONS.output_item_list = a
elif o == '--output-ota':
OPTIONS.output_ota = a
+ elif o == '--output-img':
+ OPTIONS.output_img = a
elif o == '--output-super-empty':
OPTIONS.output_super_empty = a
elif o == '--rebuild_recovery':
@@ -858,7 +831,8 @@
return True
args = common.ParseOptions(
- sys.argv[1:], __doc__,
+ sys.argv[1:],
+ __doc__,
extra_long_opts=[
'system-target-files=',
'system-item-list=',
@@ -869,19 +843,17 @@
'output-dir=',
'output-item-list=',
'output-ota=',
+ 'output-img=',
'output-super-empty=',
'rebuild_recovery',
'keep-tmp',
],
extra_option_handler=option_handler)
- if (len(args) != 0 or
- OPTIONS.system_target_files is None or
- OPTIONS.other_target_files is None or (
- OPTIONS.output_target_files is None and
- OPTIONS.output_dir is None) or (
- OPTIONS.output_dir is not None and
- OPTIONS.output_item_list is None)):
+ if (args or OPTIONS.system_target_files is None or
+ OPTIONS.other_target_files is None or
+ (OPTIONS.output_target_files is None and OPTIONS.output_dir is None) or
+ (OPTIONS.output_dir is not None and OPTIONS.output_item_list is None)):
common.Usage(__doc__)
sys.exit(1)
@@ -923,9 +895,9 @@
output_dir=OPTIONS.output_dir,
output_item_list=output_item_list,
output_ota=OPTIONS.output_ota,
+ output_img=OPTIONS.output_img,
output_super_empty=OPTIONS.output_super_empty,
- rebuild_recovery=OPTIONS.rebuild_recovery),
- OPTIONS.keep_tmp)
+ rebuild_recovery=OPTIONS.rebuild_recovery), OPTIONS.keep_tmp)
if __name__ == '__main__':