Merge "Revert "Revert "Add libstagefright_omx_soft to vndk"""
diff --git a/core/Makefile b/core/Makefile
index 2a2488c..ff5a0c6 100644
--- a/core/Makefile
+++ b/core/Makefile
@@ -2147,12 +2147,80 @@
endef
endif
+# Check that libraries that should only be in APEXes don't end up in the system
+# image. For the Runtime APEX this complements the checks in
+# art/build/apex/art_apex_test.py.
+# TODO(b/128708192): Implement this restriction in Soong instead.
+
+# TODO(b/124293228): Fix remaining bugs and add these libraries to the list:
+# libart-compiler.so
+# libart-dexlayout.so
+# libart.so
+# libartbase.so
+# libartpalette.so
+# libdexfile.so
+# libdexfile_external.so - aosp_marlin-userdebug gets this in a vndk-sp-Q subdirectory.
+# libicui18n.so
+# libicuuc.so
+# libnativehelper.so - cf_x86_phone-userdebug builds get this in system/lib/arm
+# libprofile.so
+# libsigchain.so
+# libtombstoned_client.so
+APEX_MODULE_LIBS= \
+ libadbconnection.so \
+ libandroidicu.so \
+ libdt_fd_forward.so \
+ libdt_socket.so \
+ libjavacore.so \
+ libjdwp.so \
+ libnativebridge.so \
+ libnativeloader.so \
+ libnpt.so \
+ libopenjdk.so \
+ libopenjdkjvm.so \
+ libopenjdkjvmti.so \
+ libpac.so \
+
+# If the check below fails, some library has ended up in system/lib or
+# system/lib64 that is intended to only go into some APEX package. The likely
+# cause is that a library or binary in /system has grown a dependency that
+# directly or indirectly pulls in the prohibited library.
+#
+# To resolve this, look for the APEX package that the library belong to - search
+# for it in 'native_shared_lib' properties in 'apex' build modules (see
+# art/build/apex/Android.bp for an example). Then check if there is an exported
+# library in that APEX package that should be used instead, i.e. one listed in
+# its 'native_shared_lib' property for which the corresponding 'cc_library'
+# module has a 'stubs' clause (like libdexfile_external in
+# art/libdexfile/Android.bp).
+#
+# If you cannot find an APEX exported library that fits your needs, or you think
+# that the library you want to depend on should be allowed in /system, then
+# please contact the owners of the APEX package containing the library.
+#
+# If you get this error for a library that is exported in an APEX, then the APEX
+# might be misconfigured or something is wrong in the build system. Please reach
+# out to the APEX package owners and/or soong-team@, or
+# android-building@googlegroups.com externally.
+define check-apex-libs-absence
+$(hide) ( \
+ cd $(TARGET_OUT); \
+ findres=$$(find lib* -type f \( -false $(foreach lib,$(APEX_MODULE_LIBS),-o -name $(lib)) \) -print) || exit 1; \
+ if [ -n "$$findres" ]; then \
+ echo "APEX libraries found in system image (see comment in this makefile for details):" 1>&2; \
+ echo "$$findres" | sort 1>&2; \
+ false; \
+ fi; \
+)
+endef
+
# $(1): output file
define build-systemimage-target
@echo "Target system fs image: $(1)"
$(call create-system-vendor-symlink)
$(call create-system-product-symlink)
$(call create-system-product_services-symlink)
+ $(call check-apex-libs-absence)
@mkdir -p $(dir $(1)) $(systemimage_intermediates) && rm -rf $(systemimage_intermediates)/system_image_info.txt
$(call generate-image-prop-dictionary, $(systemimage_intermediates)/system_image_info.txt,system, \
skip_fsck=true)
@@ -3947,8 +4015,10 @@
endif
$(call generate-userimage-prop-dictionary, $(zip_root)/META/misc_info.txt)
ifneq ($(INSTALLED_RECOVERYIMAGE_TARGET),)
+ifdef BUILDING_SYSTEM_IMAGE
$(hide) PATH=$(foreach p,$(INTERNAL_USERIMAGES_BINARY_PATHS),$(p):)$$PATH MKBOOTIMG=$(MKBOOTIMG) \
build/make/tools/releasetools/make_recovery_patch $(zip_root) $(zip_root)
+endif # BUILDING_SYSTEM_IMAGE
endif
ifeq ($(AB_OTA_UPDATER),true)
@# When using the A/B updater, include the updater config files in the zip.
@@ -4235,7 +4305,7 @@
@echo "Package symbols: $@"
$(hide) rm -rf $@ $(PRIVATE_LIST_FILE)
$(hide) mkdir -p $(dir $@) $(TARGET_OUT_UNSTRIPPED) $(dir $(PRIVATE_LIST_FILE))
- $(hide) find $(TARGET_OUT_UNSTRIPPED) | sort >$(PRIVATE_LIST_FILE)
+ $(hide) find -L $(TARGET_OUT_UNSTRIPPED) -type f | sort >$(PRIVATE_LIST_FILE)
$(hide) $(SOONG_ZIP) -d -o $@ -C $(OUT_DIR)/.. -l $(PRIVATE_LIST_FILE)
# -----------------------------------------------------------------
# A zip of the coverage directory.
diff --git a/core/base_rules.mk b/core/base_rules.mk
index 7e7d6dc..f477eda 100644
--- a/core/base_rules.mk
+++ b/core/base_rules.mk
@@ -257,13 +257,11 @@
endif
use_testcase_folder :=
-ifdef ENABLE_DEFAULT_TEST_LOCATION
- ifeq ($(my_module_path),)
- ifneq ($(LOCAL_MODULE),$(filter $(LOCAL_MODULE),$(DEFAULT_DATA_OUT_MODULES)))
- ifdef LOCAL_COMPATIBILITY_SUITE
- ifneq (true, $(LOCAL_IS_HOST_MODULE))
- use_testcase_folder := true
- endif
+ifeq ($(my_module_path),)
+ ifneq ($(LOCAL_MODULE),$(filter $(LOCAL_MODULE),$(DEFAULT_DATA_OUT_MODULES)))
+ ifdef LOCAL_COMPATIBILITY_SUITE
+ ifneq (true, $(LOCAL_IS_HOST_MODULE))
+ use_testcase_folder := true
endif
endif
endif
diff --git a/core/config.mk b/core/config.mk
index cca6200..2e3e31f 100644
--- a/core/config.mk
+++ b/core/config.mk
@@ -1183,12 +1183,9 @@
include $(BUILD_SYSTEM)/soong_config.mk
endif
-# If ENABLE_DEFAULT_TEST_LOCATION is true, move default install path from
-# $(my_prefix)OUT_DATA to $(my_prefix)OUT_TESTCASES
-ENABLE_DEFAULT_TEST_LOCATION := true
-include external/linux-kselftest/android/kselftest_test_list.mk
-include external/ltp/android/ltp_package_list.mk
DEFAULT_DATA_OUT_MODULES := ltp $(ltp_packages) $(kselftest_modules)
-.KATI_READONLY := ENABLE_DEFAULT_TEST_LOCATION DEFAULT_DATA_OUT_MODULES
+.KATI_READONLY := DEFAULT_DATA_OUT_MODULES
include $(BUILD_SYSTEM)/dumpvar.mk
diff --git a/core/definitions.mk b/core/definitions.mk
index d9f3338..205a055 100644
--- a/core/definitions.mk
+++ b/core/definitions.mk
@@ -3312,10 +3312,12 @@
# $(4): Whether LOCAL_EXPORT_PACKAGE_RESOURCES is set or
# not for the source module.
# $(5): Resource overlay list.
+# $(6): Target partition
###########################################################
define append_enforce_rro_sources
$(eval ENFORCE_RRO_SOURCES += \
- $(strip $(1))||$(strip $(2))||$(strip $(3))||$(strip $(4))||$(call normalize-path-list, $(strip $(5))))
+ $(strip $(1))||$(strip $(2))||$(strip $(3))||$(strip $(4))||$(call normalize-path-list, $(strip $(5)))||$(strip $(6)) \
+ )
endef
###########################################################
@@ -3330,6 +3332,7 @@
$(eval enforce_rro_source_manifest_package_info := $(word 3,$(_o))) \
$(eval enforce_rro_use_res_lib := $(word 4,$(_o))) \
$(eval enforce_rro_source_overlays := $(subst :, ,$(word 5,$(_o)))) \
+ $(eval enforce_rro_partition := $(word 6,$(_o))) \
$(eval include $(BUILD_SYSTEM)/generate_enforce_rro.mk) \
$(eval ALL_MODULES.$$(enforce_rro_source_module).REQUIRED += $$(LOCAL_PACKAGE_NAME)) \
)
diff --git a/core/generate_enforce_rro.mk b/core/generate_enforce_rro.mk
index 6124a4f..f7877f2 100644
--- a/core/generate_enforce_rro.mk
+++ b/core/generate_enforce_rro.mk
@@ -1,6 +1,6 @@
include $(CLEAR_VARS)
-enforce_rro_module := $(enforce_rro_source_module)__auto_generated_rro
+enforce_rro_module := $(enforce_rro_source_module)__auto_generated_rro_$(enforce_rro_partition)
LOCAL_PACKAGE_NAME := $(enforce_rro_module)
intermediates := $(call intermediates-dir-for,APPS,$(LOCAL_PACKAGE_NAME),,COMMON)
@@ -14,10 +14,17 @@
endif
$(rro_android_manifest_file): PRIVATE_PACKAGE_INFO := $(enforce_rro_source_manifest_package_info)
+$(rro_android_manifest_file): PRIVATE_USE_PACKAGE_NAME := $(use_package_name_arg)
+$(rro_android_manifest_file): PRIVATE_PARTITION := $(enforce_rro_partition)
+# There should be no duplicate overrides, but just in case, set the priority of
+# /product overlays to be higher than /vendor, to at least get deterministic results.
+$(rro_android_manifest_file): PRIVATE_PRIORITY := $(if $(filter product,$(enforce_rro_partition)),1,0)
$(rro_android_manifest_file): build/make/tools/generate-enforce-rro-android-manifest.py
$(hide) build/make/tools/generate-enforce-rro-android-manifest.py \
--package-info $(PRIVATE_PACKAGE_INFO) \
- $(use_package_name_arg) \
+ $(PRIVATE_USE_PACKAGE_NAME) \
+ --partition $(PRIVATE_PARTITION) \
+ --priority $(PRIVATE_PRIORITY) \
-o $@
LOCAL_PATH:= $(intermediates)
@@ -31,7 +38,14 @@
LOCAL_AAPT_FLAGS += --auto-add-overlay
LOCAL_RESOURCE_DIR := $(enforce_rro_source_overlays)
-LOCAL_PRODUCT_MODULE := true
+
+ifeq (product,$(enforce_rro_partition))
+ LOCAL_PRODUCT_MODULE := true
+else ifeq (vendor,$(enforce_rro_partition))
+ LOCAL_VENDOR_MODULE := true
+else
+ $(error Unsupported partition. Want: [vendor/product] Got: [$(enforce_rro_partition)])
+endif
ifneq (,$(LOCAL_RES_LIBRARIES))
# Technically we are linking against the app (if only to grab its resources),
diff --git a/core/local_systemsdk.mk b/core/local_systemsdk.mk
index 0f1271f..6c022f2 100644
--- a/core/local_systemsdk.mk
+++ b/core/local_systemsdk.mk
@@ -25,7 +25,7 @@
ifneq (,$(filter JAVA_LIBRARIES APPS,$(LOCAL_MODULE_CLASS)))
ifndef LOCAL_SDK_VERSION
ifeq ($(_is_vendor_app),true)
- ifeq (,$(filter %__auto_generated_rro,$(LOCAL_MODULE)))
+ ifeq (,$(filter %__auto_generated_rro_vendor,$(LOCAL_MODULE)))
# Runtime resource overlays are exempted from building against System SDK.
# TODO(b/35859726): remove this exception
LOCAL_SDK_VERSION := system_current
diff --git a/core/main.mk b/core/main.mk
index 43c80ee..62d3719 100644
--- a/core/main.mk
+++ b/core/main.mk
@@ -1206,7 +1206,8 @@
# Fakes don't get installed, host files are irrelevant, and NDK stubs aren't installed to device.
static_whitelist_patterns := $(TARGET_OUT_FAKE)/% $(HOST_OUT)/% $(SOONG_OUT_DIR)/ndk/%
# RROs become REQUIRED by the source module, but are always placed on the vendor partition.
- static_whitelist_patterns += %__auto_generated_rro.apk
+ static_whitelist_patterns += %__auto_generated_rro_product.apk
+ static_whitelist_patterns += %__auto_generated_rro_vendor.apk
# Auto-included targets are not considered
static_whitelist_patterns += $(call module-installed-files,$(call auto-included-modules))
# $(PRODUCT_OUT)/apex is where shared libraries in APEXes get installed.
diff --git a/core/native_benchmark.mk b/core/native_benchmark.mk
index 4750649..073d8dd 100644
--- a/core/native_benchmark.mk
+++ b/core/native_benchmark.mk
@@ -6,11 +6,6 @@
LOCAL_STATIC_LIBRARIES += libgoogle-benchmark
-ifndef ENABLE_DEFAULT_TEST_LOCATION
-LOCAL_MODULE_PATH_64 := $(TARGET_OUT_DATA_METRIC_TESTS)/$(LOCAL_MODULE)
-LOCAL_MODULE_PATH_32 := $($(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_DATA_METRIC_TESTS)/$(LOCAL_MODULE)
-endif
-
ifndef LOCAL_MULTILIB
ifndef LOCAL_32_BIT_ONLY
LOCAL_MULTILIB := both
diff --git a/core/package_internal.mk b/core/package_internal.mk
index 89296e6..e27f6ce 100644
--- a/core/package_internal.mk
+++ b/core/package_internal.mk
@@ -132,21 +132,26 @@
enforce_rro_enabled := true
endif
-all_package_resource_overlays := $(strip \
+product_package_overlays := $(strip \
$(wildcard $(foreach dir, $(PRODUCT_PACKAGE_OVERLAYS), \
- $(addprefix $(dir)/, $(LOCAL_RESOURCE_DIR)))) \
+ $(addprefix $(dir)/, $(LOCAL_RESOURCE_DIR)))))
+device_package_overlays := $(strip \
$(wildcard $(foreach dir, $(DEVICE_PACKAGE_OVERLAYS), \
$(addprefix $(dir)/, $(LOCAL_RESOURCE_DIR)))))
static_resource_overlays :=
-runtime_resource_overlays :=
+runtime_resource_overlays_product :=
+runtime_resource_overlays_vendor :=
ifdef enforce_rro_enabled
ifneq ($(PRODUCT_ENFORCE_RRO_EXCLUDED_OVERLAYS),)
- static_resource_overlays += $(filter $(addsuffix %,$(PRODUCT_ENFORCE_RRO_EXCLUDED_OVERLAYS)),$(all_package_resource_overlays))
+ # The PRODUCT_ exclusion variable applies to both inclusion variables..
+ static_resource_overlays += $(filter $(addsuffix %,$(PRODUCT_ENFORCE_RRO_EXCLUDED_OVERLAYS)),$(product_package_overlays))
+ static_resource_overlays += $(filter $(addsuffix %,$(PRODUCT_ENFORCE_RRO_EXCLUDED_OVERLAYS)),$(device_package_overlays))
endif
- runtime_resource_overlays := $(filter-out $(static_resource_overlays),$(all_package_resource_overlays))
+ runtime_resource_overlays_product := $(filter-out $(static_resource_overlays),$(product_package_overlays))
+ runtime_resource_overlays_vendor := $(filter-out $(static_resource_overlays),$(device_package_overlays))
else
- static_resource_overlays := $(all_package_resource_overlays)
+ static_resource_overlays := $(product_package_overlays) $(device_package_overlays)
endif
# Add the static overlays. Auto-RRO is created later, as it depends on
@@ -762,17 +767,10 @@
ifdef LOCAL_COMPATIBILITY_SUITE
-ifndef ENABLE_DEFAULT_TEST_LOCATION
-$(foreach suite, $(LOCAL_COMPATIBILITY_SUITE), \
- $(eval my_compat_dist_$(suite) := $(foreach dir, $(call compatibility_suite_dirs,$(suite)), \
- $(foreach s,$(my_split_suffixes),\
- $(intermediates)/package_$(s).apk:$(dir)/$(LOCAL_MODULE)_$(s).apk))))
-else
$(foreach suite, $(LOCAL_COMPATIBILITY_SUITE), \
$(eval my_compat_dist_$(suite) := $(foreach dir, $(call compatibility_suite_dirs,$(suite)), \
$(foreach s,$(my_split_suffixes),\
$(call compat-copy-pair,$(intermediates)/package_$(s).apk,$(dir)/$(LOCAL_MODULE)_$(s).apk)))))
-endif
$(call create-suite-dependencies)
@@ -790,7 +788,7 @@
# Reset internal variables.
all_res_assets :=
-ifdef runtime_resource_overlays
+ifneq (,$(runtime_resource_overlays_product)$(runtime_resource_overlays_vendor))
ifdef LOCAL_EXPORT_PACKAGE_RESOURCES
enforce_rro_use_res_lib := true
else
@@ -805,11 +803,24 @@
enforce_rro_manifest_package_info := $(full_android_manifest)
endif
- $(call append_enforce_rro_sources, \
- $(my_register_name), \
- $(enforce_rro_is_manifest_package_name), \
- $(enforce_rro_manifest_package_info), \
- $(enforce_rro_use_res_lib), \
- $(runtime_resource_overlays) \
- )
+ ifdef runtime_resource_overlays_product
+ $(call append_enforce_rro_sources, \
+ $(my_register_name), \
+ $(enforce_rro_is_manifest_package_name), \
+ $(enforce_rro_manifest_package_info), \
+ $(enforce_rro_use_res_lib), \
+ $(runtime_resource_overlays_product), \
+ product \
+ )
+ endif
+ ifdef runtime_resource_overlays_vendor
+ $(call append_enforce_rro_sources, \
+ $(my_register_name), \
+ $(enforce_rro_is_manifest_package_name), \
+ $(enforce_rro_manifest_package_info), \
+ $(enforce_rro_use_res_lib), \
+ $(runtime_resource_overlays_vendor), \
+ vendor \
+ )
+ endif
endif
diff --git a/core/proguard.flags b/core/proguard.flags
index 6ed1f9b..50049cb 100644
--- a/core/proguard.flags
+++ b/core/proguard.flags
@@ -15,4 +15,35 @@
@**.VisibleForTesting *;
}
+# Understand the @Keep support annotation.
+-keep class android.support.annotation.Keep
+-keep class androidx.annotation.Keep
+
+-keep @android.support.annotation.Keep class * {*;}
+-keep @androidx.annotation.Keep class * {*;}
+
+-keepclasseswithmembers class * {
+ @android.support.annotation.Keep <methods>;
+}
+
+-keepclasseswithmembers class * {
+ @androidx.annotation.Keep <methods>;
+}
+
+-keepclasseswithmembers class * {
+ @android.support.annotation.Keep <fields>;
+}
+
+-keepclasseswithmembers class * {
+ @androidx.annotation.Keep <fields>;
+}
+
+-keepclasseswithmembers class * {
+ @android.support.annotation.Keep <init>(...);
+}
+
+-keepclasseswithmembers class * {
+ @androidx.annotation.Keep <init>(...);
+}
+
-include proguard_basic_keeps.flags
diff --git a/core/soong_app_prebuilt.mk b/core/soong_app_prebuilt.mk
index cfcb0c6..8d92b20 100644
--- a/core/soong_app_prebuilt.mk
+++ b/core/soong_app_prebuilt.mk
@@ -159,13 +159,26 @@
include $(BUILD_SYSTEM)/link_type.mk
endif # !LOCAL_IS_HOST_MODULE
-ifneq (,$(LOCAL_SOONG_DEVICE_RRO_DIRS)$(LOCAL_SOONG_PRODUCT_RRO_DIRS))
+ifdef LOCAL_SOONG_DEVICE_RRO_DIRS
$(call append_enforce_rro_sources, \
$(my_register_name), \
false, \
$(LOCAL_FULL_MANIFEST_FILE), \
$(if $(LOCAL_EXPORT_PACKAGE_RESOURCES),true,false), \
- $(LOCAL_SOONG_DEVICE_RRO_DIRS) $(LOCAL_SOONG_PRODUCT_RRO_DIRS))
+ $(LOCAL_SOONG_DEVICE_RRO_DIRS), \
+ vendor \
+ )
+endif
+
+ifdef LOCAL_SOONG_PRODUCT_RRO_DIRS
+ $(call append_enforce_rro_sources, \
+ $(my_register_name), \
+ false, \
+ $(LOCAL_FULL_MANIFEST_FILE), \
+ $(if $(LOCAL_EXPORT_PACKAGE_RESOURCES),true,false), \
+ $(LOCAL_SOONG_PRODUCT_RRO_DIRS), \
+ product \
+ )
endif
SOONG_ALREADY_CONV := $(SOONG_ALREADY_CONV) $(LOCAL_MODULE)
diff --git a/core/target_test_internal.mk b/core/target_test_internal.mk
index 1ed1195..40b2ba8 100644
--- a/core/target_test_internal.mk
+++ b/core/target_test_internal.mk
@@ -30,10 +30,8 @@
endif
use_testcase_folder := false
-ifdef ENABLE_DEFAULT_TEST_LOCATION
- ifneq ($(LOCAL_MODULE),$(filter $(LOCAL_MODULE),$(DEFAULT_DATA_OUT_MODULES)))
- use_testcase_folder := true
- endif
+ifneq ($(LOCAL_MODULE),$(filter $(LOCAL_MODULE),$(DEFAULT_DATA_OUT_MODULES)))
+ use_testcase_folder := true
endif
ifneq ($(use_testcase_folder),true)
diff --git a/target/board/BoardConfigEmuCommon.mk b/target/board/BoardConfigEmuCommon.mk
index 3e8d342..617b3c5 100644
--- a/target/board/BoardConfigEmuCommon.mk
+++ b/target/board/BoardConfigEmuCommon.mk
@@ -30,3 +30,5 @@
BOARD_SEPOLICY_DIRS += device/generic/goldfish/sepolicy/common
+# TODO(b/125540538): Remove when emulator uses dynamic partitions
+BOARD_BUILD_SYSTEM_ROOT_IMAGE := true
diff --git a/target/board/BoardConfigGsiCommon.mk b/target/board/BoardConfigGsiCommon.mk
index 68d29c8..d53995c 100644
--- a/target/board/BoardConfigGsiCommon.mk
+++ b/target/board/BoardConfigGsiCommon.mk
@@ -6,9 +6,6 @@
include build/make/target/board/BoardConfigMainlineCommon.mk
-# Enable system property split for Treble
-BOARD_PROPERTY_OVERRIDES_SPLIT_ENABLED := true
-
# This flag is set by mainline but isn't desired for GSI.
BOARD_USES_SYSTEM_OTHER_ODEX :=
@@ -27,6 +24,7 @@
# GSI forces product packages to /system for now.
TARGET_COPY_OUT_PRODUCT := system/product
+BOARD_PRODUCTIMAGE_FILE_SYSTEM_TYPE :=
# Creates metadata partition mount point under root for
# the devices with metadata parition
diff --git a/target/board/BoardConfigMainlineCommon.mk b/target/board/BoardConfigMainlineCommon.mk
index e13317f..acbd11d 100644
--- a/target/board/BoardConfigMainlineCommon.mk
+++ b/target/board/BoardConfigMainlineCommon.mk
@@ -5,16 +5,16 @@
# The generic product target doesn't have any hardware-specific pieces.
TARGET_NO_BOOTLOADER := true
TARGET_NO_KERNEL := true
+TARGET_NO_RECOVERY := true
TARGET_USERIMAGES_USE_EXT4 := true
# Mainline devices must have /vendor and /product partitions.
TARGET_COPY_OUT_VENDOR := vendor
-TARGET_COPY_OUT_PRODUCT := product
+BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE := ext4
-# system-as-root is mandatory from Android P
-TARGET_NO_RECOVERY := true
-BOARD_BUILD_SYSTEM_ROOT_IMAGE := true
+TARGET_COPY_OUT_PRODUCT := product
+BOARD_PRODUCTIMAGE_FILE_SYSTEM_TYPE := ext4
BOARD_VNDK_VERSION := current
@@ -39,3 +39,10 @@
BOARD_AVB_ROLLBACK_INDEX := $(PLATFORM_SECURITY_PATCH_TIMESTAMP)
BOARD_CHARGER_ENABLE_SUSPEND := true
+
+# Enable A/B update
+AB_OTA_UPDATER := true
+AB_OTA_PARTITIONS := system
+
+# Enable system property split for Treble
+BOARD_PROPERTY_OVERRIDES_SPLIT_ENABLED := true
diff --git a/target/board/generic_arm64_a/BoardConfig.mk b/target/board/generic_arm64_a/BoardConfig.mk
deleted file mode 100644
index 68aedfc..0000000
--- a/target/board/generic_arm64_a/BoardConfig.mk
+++ /dev/null
@@ -1,32 +0,0 @@
-#
-# Copyright (C) 2017 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.
-#
-
-include build/make/target/board/BoardConfigGsiCommon.mk
-
-TARGET_ARCH := arm64
-TARGET_ARCH_VARIANT := armv8-a
-TARGET_CPU_ABI := arm64-v8a
-TARGET_CPU_ABI2 :=
-TARGET_CPU_VARIANT := generic
-
-TARGET_2ND_ARCH := arm
-TARGET_2ND_ARCH_VARIANT := armv8-a
-TARGET_2ND_CPU_ABI := armeabi-v7a
-TARGET_2ND_CPU_ABI2 := armeabi
-TARGET_2ND_CPU_VARIANT := generic
-
-# This is a non-system-as-root Legacy GSI build target
-BOARD_BUILD_SYSTEM_ROOT_IMAGE := false
diff --git a/target/board/generic_arm_a/BoardConfig.mk b/target/board/generic_arm_a/BoardConfig.mk
deleted file mode 100644
index 464a74f..0000000
--- a/target/board/generic_arm_a/BoardConfig.mk
+++ /dev/null
@@ -1,29 +0,0 @@
-#
-# Copyright (C) 2017 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.
-#
-
-include build/make/target/board/BoardConfigGsiCommon.mk
-
-TARGET_ARCH := arm
-TARGET_ARCH_VARIANT := armv7-a-neon
-TARGET_CPU_ABI := armeabi-v7a
-TARGET_CPU_ABI2 := armeabi
-TARGET_CPU_VARIANT := generic
-
-# Legacy GSI keeps 32 bits binder for 32 bits CPU Arch
-TARGET_USES_64_BIT_BINDER := false
-
-# This is a non-system-as-root Legacy GSI build target
-BOARD_BUILD_SYSTEM_ROOT_IMAGE := false
diff --git a/target/board/generic_x86_64_a/BoardConfig.mk b/target/board/generic_x86_64_a/BoardConfig.mk
deleted file mode 100644
index 07eef4f..0000000
--- a/target/board/generic_x86_64_a/BoardConfig.mk
+++ /dev/null
@@ -1,28 +0,0 @@
-#
-# Copyright (C) 2017 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.
-#
-
-include build/make/target/board/BoardConfigGsiCommon.mk
-
-TARGET_CPU_ABI := x86_64
-TARGET_ARCH := x86_64
-TARGET_ARCH_VARIANT := x86_64
-
-TARGET_2ND_CPU_ABI := x86
-TARGET_2ND_ARCH := x86
-TARGET_2ND_ARCH_VARIANT := x86_64
-
-# This is a non-system-as-root Legacy GSI build target
-BOARD_BUILD_SYSTEM_ROOT_IMAGE := false
diff --git a/target/board/generic_x86_a/BoardConfig.mk b/target/board/generic_x86_a/BoardConfig.mk
deleted file mode 100644
index e3e8a3a..0000000
--- a/target/board/generic_x86_a/BoardConfig.mk
+++ /dev/null
@@ -1,27 +0,0 @@
-#
-# Copyright (C) 2017 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.
-#
-
-include build/make/target/board/BoardConfigGsiCommon.mk
-
-TARGET_CPU_ABI := x86
-TARGET_ARCH := x86
-TARGET_ARCH_VARIANT := x86
-
-# Legacy GSI keeps 32 bits binder for 32 bits CPU Arch
-TARGET_USES_64_BIT_BINDER := false
-
-# This is a non-system-as-root Legacy GSI build target
-BOARD_BUILD_SYSTEM_ROOT_IMAGE := false
diff --git a/target/product/AndroidProducts.mk b/target/product/AndroidProducts.mk
index 12fd99a..cfb8930 100644
--- a/target/product/AndroidProducts.mk
+++ b/target/product/AndroidProducts.mk
@@ -44,16 +44,12 @@
else
PRODUCT_MAKEFILES := \
$(LOCAL_DIR)/aosp_arm64_ab.mk \
- $(LOCAL_DIR)/aosp_arm64_a.mk \
$(LOCAL_DIR)/aosp_arm64.mk \
$(LOCAL_DIR)/aosp_arm_ab.mk \
- $(LOCAL_DIR)/aosp_arm_a.mk \
$(LOCAL_DIR)/aosp_arm.mk \
$(LOCAL_DIR)/aosp_x86_64_ab.mk \
- $(LOCAL_DIR)/aosp_x86_64_a.mk \
$(LOCAL_DIR)/aosp_x86_64.mk \
$(LOCAL_DIR)/aosp_x86_ab.mk \
- $(LOCAL_DIR)/aosp_x86_a.mk \
$(LOCAL_DIR)/aosp_x86_arm.mk \
$(LOCAL_DIR)/aosp_x86.mk \
$(LOCAL_DIR)/full.mk \
diff --git a/target/product/aosp_arm64_a.mk b/target/product/aosp_arm64_a.mk
deleted file mode 100644
index e45229d..0000000
--- a/target/product/aosp_arm64_a.mk
+++ /dev/null
@@ -1,45 +0,0 @@
-#
-# Copyright (C) 2017 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.
-#
-
-# PRODUCT_PROPERTY_OVERRIDES cannot be used here because sysprops will be at
-# /vendor/[build|default].prop when build split is on. In order to have sysprops
-# on the generic system image, place them in build/make/target/board/
-# gsi_system.prop.
-
-$(call inherit-product, $(SRC_TARGET_DIR)/product/core_64_bit.mk)
-$(call inherit-product, $(SRC_TARGET_DIR)/product/legacy_gsi_common.mk)
-
-# Enable mainline checking for excat this product name
-ifeq (aosp_arm64_a,$(TARGET_PRODUCT))
-PRODUCT_ENFORCE_ARTIFACT_PATH_REQUIREMENTS := relaxed
-endif
-
-PRODUCT_ARTIFACT_PATH_REQUIREMENT_WHITELIST += \
- root/init.zygote32_64.rc \
- root/init.zygote64_32.rc \
-
-# Copy different zygote settings for vendor.img to select by setting property
-# ro.zygote=zygote64_32 or ro.zygote=zygote32_64:
-# 1. 64-bit primary, 32-bit secondary OR
-# 2. 32-bit primary, 64-bit secondary
-# init.zygote64_32.rc is in the core_64_bit.mk below
-PRODUCT_COPY_FILES += \
- system/core/rootdir/init.zygote32_64.rc:root/init.zygote32_64.rc
-
-PRODUCT_NAME := aosp_arm64_a
-PRODUCT_DEVICE := generic_arm64_a
-PRODUCT_BRAND := Android
-PRODUCT_MODEL := AOSP on ARM64
diff --git a/target/product/aosp_arm_a.mk b/target/product/aosp_arm_a.mk
deleted file mode 100644
index 249ad2c..0000000
--- a/target/product/aosp_arm_a.mk
+++ /dev/null
@@ -1,32 +0,0 @@
-#
-# Copyright (C) 2017 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.
-#
-
-# PRODUCT_PROPERTY_OVERRIDES cannot be used here because sysprops will be at
-# /vendor/[build|default].prop when build split is on. In order to have sysprops
-# on the generic system image, place them in build/make/target/board/
-# gsi_system.prop.
-
-$(call inherit-product, $(SRC_TARGET_DIR)/product/legacy_gsi_common.mk)
-
-# Enable mainline checking for excat this product name
-ifeq (aosp_arm_a,$(TARGET_PRODUCT))
-PRODUCT_ENFORCE_ARTIFACT_PATH_REQUIREMENTS := relaxed
-endif
-
-PRODUCT_NAME := aosp_arm_a
-PRODUCT_DEVICE := generic_arm_a
-PRODUCT_BRAND := Android
-PRODUCT_MODEL := AOSP on ARM32
diff --git a/target/product/aosp_x86_64_a.mk b/target/product/aosp_x86_64_a.mk
deleted file mode 100644
index f40b9a9..0000000
--- a/target/product/aosp_x86_64_a.mk
+++ /dev/null
@@ -1,45 +0,0 @@
-#
-# Copyright (C) 2017 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.
-#
-
-# PRODUCT_PROPERTY_OVERRIDES cannot be used here because sysprops will be at
-# /vendor/[build|default].prop when build split is on. In order to have sysprops
-# on the generic system image, place them in build/make/target/board/
-# gsi_system.prop.
-
-$(call inherit-product, $(SRC_TARGET_DIR)/product/core_64_bit.mk)
-$(call inherit-product, $(SRC_TARGET_DIR)/product/legacy_gsi_common.mk)
-
-# Enable mainline checking for excat this product name
-ifeq (aosp_x86_64_a,$(TARGET_PRODUCT))
-PRODUCT_ENFORCE_ARTIFACT_PATH_REQUIREMENTS := relaxed
-endif
-
-PRODUCT_ARTIFACT_PATH_REQUIREMENT_WHITELIST += \
- root/init.zygote32_64.rc \
- root/init.zygote64_32.rc \
-
-# Copy different zygote settings for vendor.img to select by setting property
-# ro.zygote=zygote64_32 or ro.zygote=zygote32_64:
-# 1. 64-bit primary, 32-bit secondary OR
-# 2. 32-bit primary, 64-bit secondary
-# init.zygote64_32.rc is in the core_64_bit.mk below
-PRODUCT_COPY_FILES += \
- system/core/rootdir/init.zygote32_64.rc:root/init.zygote32_64.rc
-
-PRODUCT_NAME := aosp_x86_64_a
-PRODUCT_DEVICE := generic_x86_64_a
-PRODUCT_BRAND := Android
-PRODUCT_MODEL := AOSP on x86_64
diff --git a/target/product/aosp_x86_a.mk b/target/product/aosp_x86_a.mk
deleted file mode 100644
index 743e0b9..0000000
--- a/target/product/aosp_x86_a.mk
+++ /dev/null
@@ -1,32 +0,0 @@
-#
-# Copyright (C) 2017 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.
-#
-
-# PRODUCT_PROPERTY_OVERRIDES cannot be used here because sysprops will be at
-# /vendor/[build|default].prop when build split is on. In order to have sysprops
-# on the generic system image, place them in build/make/target/board/
-# gsi_system.prop.
-
-$(call inherit-product, $(SRC_TARGET_DIR)/product/legacy_gsi_common.mk)
-
-# Enable mainline checking for excat this product name
-ifeq (aosp_x86_a,$(TARGET_PRODUCT))
-PRODUCT_ENFORCE_ARTIFACT_PATH_REQUIREMENTS := relaxed
-endif
-
-PRODUCT_NAME := aosp_x86_a
-PRODUCT_DEVICE := generic_x86_a
-PRODUCT_BRAND := Android
-PRODUCT_MODEL := AOSP on x86
diff --git a/target/product/base_system.mk b/target/product/base_system.mk
index 8fcfa79..67e9d0b 100644
--- a/target/product/base_system.mk
+++ b/target/product/base_system.mk
@@ -73,7 +73,7 @@
dpm \
dumpstate \
dumpsys \
- DynamicAndroidInstallationService \
+ DynamicSystemInstallationService \
e2fsck \
ExtServices \
ExtShared \
@@ -286,6 +286,7 @@
BugReport \
adb \
adbd \
+ art-tools \
atest \
bcc \
bit \
diff --git a/target/product/gsi/adb_debug.prop b/target/product/gsi/adb_debug.prop
new file mode 100644
index 0000000..37e2f2d
--- /dev/null
+++ b/target/product/gsi/adb_debug.prop
@@ -0,0 +1,12 @@
+# Note: This file will be loaded with highest priority to override
+# other system properties, if a special ramdisk with "/force_debuggable"
+# is used and the device is unlocked.
+
+# Disable adb authentication to allow test automation on user build GSI
+ro.adb.secure=0
+
+# Allow 'adb root' on user build GSI
+ro.debuggable=1
+
+# Introduce this property to indicate that init has loaded adb_debug.prop
+ro.force.debuggable=1
diff --git a/target/product/gsi_common.mk b/target/product/gsi_common.mk
index fb0478d..5e73e63 100644
--- a/target/product/gsi_common.mk
+++ b/target/product/gsi_common.mk
@@ -51,23 +51,19 @@
PRODUCT_ARTIFACT_PATH_REQUIREMENT_WHITELIST += \
system/etc/init/config/skip_mount.cfg \
system/etc/init/init.gsi.rc \
+ system/etc/adb_debug.prop \
# Exclude all files under system/product and system/product_services
PRODUCT_ARTIFACT_PATH_REQUIREMENT_WHITELIST += \
system/product/% \
system/product_services/%
-
# Split selinux policy
PRODUCT_FULL_TREBLE_OVERRIDE := true
# Enable dynamic partition size
PRODUCT_USE_DYNAMIC_PARTITION_SIZE := true
-# Enable A/B update
-AB_OTA_UPDATER := true
-AB_OTA_PARTITIONS := system
-
# Needed by Pi newly launched device to pass VtsTrebleSysProp on GSI
PRODUCT_COMPATIBLE_PROPERTY_OVERRIDE := true
@@ -97,3 +93,7 @@
# Provide a libnfc-nci.conf to GSI product
PRODUCT_COPY_FILES += \
device/generic/common/nfc/libnfc-nci.conf:$(TARGET_COPY_OUT_PRODUCT)/etc/libnfc-nci.conf
+
+# Allow 'adb root' on user build GSI
+PRODUCT_COPY_FILES += \
+ build/make/target/product/gsi/adb_debug.prop:$(TARGET_COPY_OUT_SYSTEM)/etc/adb_debug.prop
diff --git a/target/product/mainline_system_arm64.mk b/target/product/mainline_system_arm64.mk
index 0b0929e..f01cc54 100644
--- a/target/product/mainline_system_arm64.mk
+++ b/target/product/mainline_system_arm64.mk
@@ -18,6 +18,16 @@
$(call inherit-product, $(SRC_TARGET_DIR)/product/mainline_system.mk)
$(call enforce-product-packages-exist,)
+PRODUCT_BUILD_CACHE_IMAGE := false
+PRODUCT_BUILD_ODM_IMAGE := false
+PRODUCT_BUILD_PRODUCT_IMAGE := false
+PRODUCT_BUILD_PRODUCT_SERVICES_IMAGE := false
+PRODUCT_BUILD_RAMDISK_IMAGE := false
+PRODUCT_BUILD_SYSTEM_IMAGE := true
+PRODUCT_BUILD_SYSTEM_OTHER_IMAGE := false
+PRODUCT_BUILD_USERDATA_IMAGE := false
+PRODUCT_BUILD_VENDOR_IMAGE := false
+
PRODUCT_NAME := mainline_system_arm64
PRODUCT_DEVICE := mainline_arm64
PRODUCT_BRAND := generic
diff --git a/target/product/telephony_product.mk b/target/product/telephony_product.mk
index 70d4828..a4c7e31 100644
--- a/target/product/telephony_product.mk
+++ b/target/product/telephony_product.mk
@@ -21,3 +21,4 @@
PRODUCT_PACKAGES += \
CarrierConfig \
Dialer \
+ EmergencyInfo \
diff --git a/target/product/telephony_system.mk b/target/product/telephony_system.mk
index fd79472..584cf1e 100644
--- a/target/product/telephony_system.mk
+++ b/target/product/telephony_system.mk
@@ -22,6 +22,5 @@
CarrierDefaultApp \
CallLogBackup \
CellBroadcastReceiver \
- EmergencyInfo \
PRODUCT_COPY_FILES := \
diff --git a/tools/generate-enforce-rro-android-manifest.py b/tools/generate-enforce-rro-android-manifest.py
index 0d7623f..2d9382a 100755
--- a/tools/generate-enforce-rro-android-manifest.py
+++ b/tools/generate-enforce-rro-android-manifest.py
@@ -23,10 +23,10 @@
import sys
ANDROID_MANIFEST_TEMPLATE="""<manifest xmlns:android="http://schemas.android.com/apk/res/android"
- package="%s.auto_generated_rro__"
+ package="%s.auto_generated_rro_%s__"
android:versionCode="1"
android:versionName="1.0">
- <overlay android:targetPackage="%s" android:priority="0" android:isStatic="true"/>
+ <overlay android:targetPackage="%s" android:priority="%s" android:isStatic="true"/>
</manifest>
"""
@@ -40,6 +40,12 @@
'-p', '--package-info', required=True,
help='Manifest package name or manifest file path of source module.')
parser.add_argument(
+ '--partition', required=True,
+ help='The partition this RRO package is installed on.')
+ parser.add_argument(
+ '--priority', required=True,
+ help='The priority for the <overlay>.')
+ parser.add_argument(
'-o', '--output', required=True,
help='Output manifest file path.')
return parser.parse_args()
@@ -48,6 +54,8 @@
def main(argv):
args = get_args()
+ partition = args.partition
+ priority = args.priority
if args.use_package_name:
package_name = args.package_info
else:
@@ -58,7 +66,7 @@
package_name = dom.documentElement.getAttribute('package')
with open(args.output, 'w+') as f:
- f.write(ANDROID_MANIFEST_TEMPLATE % (package_name, package_name))
+ f.write(ANDROID_MANIFEST_TEMPLATE % (package_name, partition, package_name, priority))
f.close()
diff --git a/tools/releasetools/common.py b/tools/releasetools/common.py
index 34c1359..632c1e2 100644
--- a/tools/releasetools/common.py
+++ b/tools/releasetools/common.py
@@ -1008,7 +1008,8 @@
def SignFile(input_name, output_name, key, password, min_api_level=None,
- codename_to_api_level_map=None, whole_file=False):
+ codename_to_api_level_map=None, whole_file=False,
+ extra_signapk_args=None):
"""Sign the input_name zip/jar/apk, producing output_name. Use the
given key and password (the latter may be None if the key does not
have a password.
@@ -1023,9 +1024,14 @@
codename_to_api_level_map is needed to translate the codename which may be
encountered as the APK's minSdkVersion.
+
+ Caller may optionally specify extra args to be passed to SignApk, which
+ defaults to OPTIONS.extra_signapk_args if omitted.
"""
if codename_to_api_level_map is None:
codename_to_api_level_map = {}
+ if extra_signapk_args is None:
+ extra_signapk_args = OPTIONS.extra_signapk_args
java_library_path = os.path.join(
OPTIONS.search_path, OPTIONS.signapk_shared_library_path)
@@ -1033,7 +1039,7 @@
cmd = ([OPTIONS.java_path] + OPTIONS.java_args +
["-Djava.library.path=" + java_library_path,
"-jar", os.path.join(OPTIONS.search_path, OPTIONS.signapk_path)] +
- OPTIONS.extra_signapk_args)
+ extra_signapk_args)
if whole_file:
cmd.append("-w")
diff --git a/tools/releasetools/merge_target_files.py b/tools/releasetools/merge_target_files.py
index 1d62e3b..3c6bfbf 100755
--- a/tools/releasetools/merge_target_files.py
+++ b/tools/releasetools/merge_target_files.py
@@ -204,13 +204,19 @@
return config_file.read().splitlines()
-def validate_config_lists(system_item_list, 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.
@@ -233,6 +239,12 @@
'this script.')
return False
+ if ('dynamic_partition_list' in system_misc_info_keys) or (
+ 'super_partition_groups' in system_misc_info_keys):
+ logger.error('Dynamic partition misc info keys should come from '
+ 'the other instance of META/misc_info.txt.')
+ return False
+
return True
@@ -331,6 +343,25 @@
for key in system_misc_info_keys:
merged_info_dict[key] = system_info_dict[key]
+ # Merge misc info keys used for Dynamic Partitions.
+ if (merged_info_dict.get('use_dynamic_partitions') == 'true') and (
+ system_info_dict.get('use_dynamic_partitions') == 'true'):
+ merged_info_dict['dynamic_partition_list'] = '%s %s' % (
+ system_info_dict.get('dynamic_partition_list', ''),
+ merged_info_dict.get('dynamic_partition_list', ''))
+ # 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(' '):
+ if ('super_%s_group_size' % partition_group) not in merged_info_dict:
+ raise common.ExternalError(
+ '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, ''))
+
output_misc_info_txt = os.path.join(
output_target_files_temp_dir,
'META', 'misc_info.txt')
@@ -717,6 +748,7 @@
if not validate_config_lists(
system_item_list=system_item_list,
+ system_misc_info_keys=system_misc_info_keys,
other_item_list=other_item_list):
sys.exit(1)
diff --git a/tools/releasetools/sign_target_files_apks.py b/tools/releasetools/sign_target_files_apks.py
index 75a98fd..d3e9ea1 100755
--- a/tools/releasetools/sign_target_files_apks.py
+++ b/tools/releasetools/sign_target_files_apks.py
@@ -400,7 +400,6 @@
APEX_PAYLOAD_IMAGE = 'apex_payload.img'
- # Signing an APEX is a two step process.
# 1. Extract and sign the APEX_PAYLOAD_IMAGE entry with the given payload_key.
payload_dir = common.MakeTempDir(prefix='apex-payload-')
with zipfile.ZipFile(apex_file) as apex_fd:
@@ -420,21 +419,28 @@
common.ZipWrite(apex_zip, payload_file, arcname=APEX_PAYLOAD_IMAGE)
common.ZipClose(apex_zip)
- # 2. Sign the overall APEX container with container_key.
+ # 2. Align the files at page boundary (same as in apexer).
+ aligned_apex = common.MakeTempFile(
+ prefix='apex-container-', suffix='.apex')
+ common.RunAndCheckOutput(
+ ['zipalign', '-f', '4096', apex_file, aligned_apex])
+
+ # 3. Sign the APEX container with container_key.
signed_apex = common.MakeTempFile(prefix='apex-container-', suffix='.apex')
+
+ # Specify the 4K alignment when calling SignApk.
+ extra_signapk_args = OPTIONS.extra_signapk_args[:]
+ extra_signapk_args.extend(['-a', '4096'])
+
common.SignFile(
- apex_file,
+ aligned_apex,
signed_apex,
container_key,
container_pw,
- codename_to_api_level_map=codename_to_api_level_map)
+ codename_to_api_level_map=codename_to_api_level_map,
+ extra_signapk_args=extra_signapk_args)
- signed_and_aligned_apex = common.MakeTempFile(
- prefix='apex-container-', suffix='.apex')
- common.RunAndCheckOutput(
- ['zipalign', '-f', '4096', signed_apex, signed_and_aligned_apex])
-
- return (signed_and_aligned_apex, payload_info['apex.key'])
+ return (signed_apex, payload_info['apex.key'])
def ProcessTargetFiles(input_tf_zip, output_tf_zip, misc_info,
@@ -600,7 +606,7 @@
else:
common.ZipWriteStr(output_tf_zip, out_info, data)
- # Update APEX payload public keys.
+ # Copy or update APEX payload public keys.
for info in input_tf_zip.infolist():
filename = info.filename
if (os.path.dirname(filename) != 'SYSTEM/etc/security/apex' or
@@ -609,8 +615,10 @@
name = os.path.basename(filename)
- # Skip PRESIGNED APEXes.
+ # Copy the keys for PRESIGNED APEXes.
if name not in updated_apex_payload_keys:
+ data = input_tf_zip.read(filename)
+ common.ZipWriteStr(output_tf_zip, info, data)
continue
key_path = updated_apex_payload_keys[name]
@@ -1073,7 +1081,6 @@
continue
name = matches.group('NAME')
- payload_public_key = matches.group("PAYLOAD_PUBLIC_KEY")
payload_private_key = matches.group("PAYLOAD_PRIVATE_KEY")
def CompareKeys(pubkey, pubkey_suffix, privkey, privkey_suffix):
@@ -1083,13 +1090,9 @@
privkey.endswith(privkey_suffix) and
pubkey[:-pubkey_suffix_len] == privkey[:-privkey_suffix_len])
- PAYLOAD_PUBLIC_KEY_SUFFIX = '.avbpubkey'
- PAYLOAD_PRIVATE_KEY_SUFFIX = '.pem'
- if not CompareKeys(
- payload_public_key, PAYLOAD_PUBLIC_KEY_SUFFIX,
- payload_private_key, PAYLOAD_PRIVATE_KEY_SUFFIX):
- raise ValueError("Failed to parse payload keys: \n{}".format(line))
-
+ # Sanity check on the container key names, as we'll carry them without the
+ # extensions. This doesn't apply to payload keys though, which we will use
+ # full names only.
container_cert = matches.group("CONTAINER_CERT")
container_private_key = matches.group("CONTAINER_PRIVATE_KEY")
if not CompareKeys(
diff --git a/tools/releasetools/test_sign_target_files_apks.py b/tools/releasetools/test_sign_target_files_apks.py
index 6082baf..6a4df1a 100644
--- a/tools/releasetools/test_sign_target_files_apks.py
+++ b/tools/releasetools/test_sign_target_files_apks.py
@@ -401,14 +401,14 @@
'build/target/product/security/testkey'),
}, keys_info)
- def test_ReadApexKeysInfo_mismatchingKeys(self):
+ def test_ReadApexKeysInfo_mismatchingContainerKeys(self):
# Mismatching payload public / private keys.
apex_keys = self.APEX_KEYS_TXT + (
'name="apex.apexd_test_different_app2.apex" '
'public_key="system/apex/apexd/apexd_testdata/com.android.apex.test_package_2.avbpubkey" '
- 'private_key="system/apex/apexd/apexd_testdata/com.android.apex.test_package_3.pem" '
+ 'private_key="system/apex/apexd/apexd_testdata/com.android.apex.test_package_2.pem" '
'container_certificate="build/target/product/security/testkey.x509.pem" '
- 'container_private_key="build/target/product/security/testkey.pk8"')
+ 'container_private_key="build/target/product/security/testkey2.pk8"')
target_files = common.MakeTempFile(suffix='.zip')
with zipfile.ZipFile(target_files, 'w') as target_files_zip:
target_files_zip.writestr('META/apexkeys.txt', apex_keys)
@@ -416,7 +416,7 @@
with zipfile.ZipFile(target_files) as target_files_zip:
self.assertRaises(ValueError, ReadApexKeysInfo, target_files_zip)
- def test_ReadApexKeysInfo_missingPrivateKey(self):
+ def test_ReadApexKeysInfo_missingPayloadPrivateKey(self):
# Invalid lines will be skipped.
apex_keys = self.APEX_KEYS_TXT + (
'name="apex.apexd_test_different_app2.apex" '
@@ -438,3 +438,26 @@
'system/apex/apexd/apexd_testdata/com.android.apex.test_package_2.pem',
'build/target/product/security/testkey'),
}, keys_info)
+
+ def test_ReadApexKeysInfo_missingPayloadPublicKey(self):
+ # Invalid lines will be skipped.
+ apex_keys = self.APEX_KEYS_TXT + (
+ 'name="apex.apexd_test_different_app2.apex" '
+ 'private_key="system/apex/apexd/apexd_testdata/com.android.apex.test_package_2.pem" '
+ 'container_certificate="build/target/product/security/testkey.x509.pem" '
+ 'container_private_key="build/target/product/security/testkey.pk8"')
+ target_files = common.MakeTempFile(suffix='.zip')
+ with zipfile.ZipFile(target_files, 'w') as target_files_zip:
+ target_files_zip.writestr('META/apexkeys.txt', apex_keys)
+
+ with zipfile.ZipFile(target_files) as target_files_zip:
+ keys_info = ReadApexKeysInfo(target_files_zip)
+
+ self.assertEqual({
+ 'apex.apexd_test.apex': (
+ 'system/apex/apexd/apexd_testdata/com.android.apex.test_package.pem',
+ 'build/target/product/security/testkey'),
+ 'apex.apexd_test_different_app.apex': (
+ 'system/apex/apexd/apexd_testdata/com.android.apex.test_package_2.pem',
+ 'build/target/product/security/testkey'),
+ }, keys_info)
diff --git a/tools/releasetools/validate_target_files.py b/tools/releasetools/validate_target_files.py
index 275939c..1c856a8 100755
--- a/tools/releasetools/validate_target_files.py
+++ b/tools/releasetools/validate_target_files.py
@@ -318,9 +318,31 @@
if info_dict.get("avb_enable") == "true":
logging.info('Verifying Verified Boot 2.0 (AVB) images...')
- # TODO(b/120517892): Temporarily disable the verification for AVB-signed
- # images. Needing supporting changes in caller to pass in the desired keys.
- logging.info('Temporarily disabled due to b/120517892')
+ key = options['verity_key']
+ if key is None:
+ key = info_dict['avb_vbmeta_key_path']
+
+ # avbtool verifies all the images that have descriptors listed in vbmeta.
+ image = os.path.join(input_tmp, 'IMAGES', 'vbmeta.img')
+ cmd = ['avbtool', 'verify_image', '--image', image, '--key', key]
+
+ # Append the args for chained partitions if any.
+ for partition in common.AVB_PARTITIONS:
+ key_name = 'avb_' + partition + '_key_path'
+ if info_dict.get(key_name) is not None:
+ chained_partition_arg = common.GetAvbChainedPartitionArg(
+ partition, info_dict, options[key_name])
+ cmd.extend(["--expected_chain_partition", chained_partition_arg])
+
+ proc = common.Run(cmd)
+ stdoutdata, _ = proc.communicate()
+ assert proc.returncode == 0, \
+ 'Failed to verify {} with avbtool (key: {}):\n{}'.format(
+ image, key, stdoutdata)
+
+ logging.info(
+ 'Verified %s with avbtool (key: %s):\n%s', image, key,
+ stdoutdata.rstrip())
def main():