Merge "Allow bootjars in system_ext."
diff --git a/core/Makefile b/core/Makefile
index 048a0f9..69ee80f 100644
--- a/core/Makefile
+++ b/core/Makefile
@@ -874,7 +874,7 @@
# -----------------------------------------------------------------
# Cert-to-package mapping. Used by the post-build signing tools.
# Use a macro to add newline to each echo command
-# $1 package name
+# $1 stem name of the package
# $2 certificate
# $3 private key
# $4 compressed
@@ -904,8 +904,8 @@
@rm -f $@
$(foreach p,$(sort $(PACKAGES)),\
$(if $(PACKAGES.$(p).EXTERNAL_KEY),\
- $(call _apkcerts_write_line,$(p),"EXTERNAL","",$(PACKAGES.$(p).COMPRESSED),$(PACKAGES.$(p).PARTITION),$@),\
- $(call _apkcerts_write_line,$(p),$(PACKAGES.$(p).CERTIFICATE),$(PACKAGES.$(p).PRIVATE_KEY),$(PACKAGES.$(p).COMPRESSED),$(PACKAGES.$(p).PARTITION),$@)))
+ $(call _apkcerts_write_line,$(PACKAGES.$(p).STEM),"EXTERNAL","",$(PACKAGES.$(p).COMPRESSED),$(PACKAGES.$(p).PARTITION),$@),\
+ $(call _apkcerts_write_line,$(PACKAGES.$(p).STEM),$(PACKAGES.$(p).CERTIFICATE),$(PACKAGES.$(p).PRIVATE_KEY),$(PACKAGES.$(p).COMPRESSED),$(PACKAGES.$(p).PARTITION),$@)))
# In case value of PACKAGES is empty.
$(hide) touch $@
diff --git a/core/app_prebuilt_internal.mk b/core/app_prebuilt_internal.mk
index 61e13e9..ab574b3 100644
--- a/core/app_prebuilt_internal.mk
+++ b/core/app_prebuilt_internal.mk
@@ -172,6 +172,12 @@
$(built_module): PRIVATE_CERTIFICATE_LINEAGE := $(LOCAL_CERTIFICATE_LINEAGE)
endif
+ifneq ($(LOCAL_MODULE_STEM),)
+ PACKAGES.$(LOCAL_MODULE).STEM := $(LOCAL_MODULE_STEM)
+else
+ PACKAGES.$(LOCAL_MODULE).STEM := $(LOCAL_MODULE)
+endif
+
include $(BUILD_SYSTEM)/app_certificate_validate.mk
# Set a actual_partition_tag (calculated in base_rules.mk) for the package.
diff --git a/core/binary.mk b/core/binary.mk
index 0582920..b14d8b8 100644
--- a/core/binary.mk
+++ b/core/binary.mk
@@ -1570,28 +1570,22 @@
## Define PRIVATE_ variables from global vars
###########################################################
ifndef LOCAL_IS_HOST_MODULE
+
ifdef LOCAL_USE_VNDK
-my_target_global_c_includes := \
- $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)PROJECT_INCLUDES)
-my_target_global_c_system_includes := \
- $(TARGET_OUT_HEADERS) \
- $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)PROJECT_SYSTEM_INCLUDES)
+ my_target_global_c_includes :=
+ my_target_global_c_system_includes := $(TARGET_OUT_HEADERS)
else ifdef LOCAL_SDK_VERSION
-my_target_global_c_includes :=
-my_target_global_c_system_includes := $(my_ndk_stl_include_path) $(my_ndk_sysroot_include)
+ my_target_global_c_includes :=
+ my_target_global_c_system_includes := $(my_ndk_stl_include_path) $(my_ndk_sysroot_include)
else ifdef BOARD_VNDK_VERSION
-my_target_global_c_includes := $(SRC_HEADERS) \
- $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)PROJECT_INCLUDES) \
+ my_target_global_c_includes := $(SRC_HEADERS) \
$($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)C_INCLUDES)
-my_target_global_c_system_includes := $(SRC_SYSTEM_HEADERS) \
- $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)PROJECT_SYSTEM_INCLUDES) \
+ my_target_global_c_system_includes := $(SRC_SYSTEM_HEADERS) \
$($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)C_SYSTEM_INCLUDES)
else
-my_target_global_c_includes := $(SRC_HEADERS) \
- $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)PROJECT_INCLUDES) \
+ my_target_global_c_includes := $(SRC_HEADERS) \
$($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)C_INCLUDES)
-my_target_global_c_system_includes := $(SRC_SYSTEM_HEADERS) $(TARGET_OUT_HEADERS) \
- $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)PROJECT_SYSTEM_INCLUDES) \
+ my_target_global_c_system_includes := $(SRC_SYSTEM_HEADERS) $(TARGET_OUT_HEADERS) \
$($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)C_SYSTEM_INCLUDES)
endif
@@ -1674,9 +1668,22 @@
####################################################
## Import includes
####################################################
+imported_includes :=
+
+ifdef LOCAL_USE_VNDK
+ imported_includes += $(call intermediates-dir-for,HEADER_LIBRARIES,device_kernel_headers,$(my_kind),,$(LOCAL_2ND_ARCH_VAR_PREFIX),$(my_host_cross))
+else ifdef LOCAL_SDK_VERSION
+ # Apps shouldn't need device-specific kernel headers
+else ifdef BOARD_VNDK_VERSION
+ # For devices building with the VNDK, only the VNDK gets device-specific kernel headers by default
+ # In soong, it's entirely opt-in
+else
+ # For older non-VNDK builds, continue adding in kernel headers to everything like we used to
+ imported_includes += $(call intermediates-dir-for,HEADER_LIBRARIES,device_kernel_headers,$(my_kind),,$(LOCAL_2ND_ARCH_VAR_PREFIX),$(my_host_cross))
+endif
+
imported_includes := $(strip \
- $(if $(LOCAL_USE_VNDK),\
- $(call intermediates-dir-for,HEADER_LIBRARIES,device_kernel_headers,$(my_kind),,$(LOCAL_2ND_ARCH_VAR_PREFIX),$(my_host_cross))) \
+ $(imported_includes) \
$(foreach l, $(installed_shared_library_module_names), \
$(call intermediates-dir-for,SHARED_LIBRARIES,$(l),$(my_kind),,$(LOCAL_2ND_ARCH_VAR_PREFIX),$(my_host_cross))) \
$(foreach l, $(my_static_libraries) $(my_whole_static_libraries), \
diff --git a/core/config.mk b/core/config.mk
index 69e2b5c..8910c11 100644
--- a/core/config.mk
+++ b/core/config.mk
@@ -135,6 +135,12 @@
LOCAL_IS_AUX_MODULE \
,AUX support has been removed)
$(KATI_obsolete_var HOST_OUT_TEST_CONFIG TARGET_OUT_TEST_CONFIG LOCAL_TEST_CONFIG_OPTIONS)
+$(KATI_obsolete_var \
+ TARGET_PROJECT_INCLUDES \
+ 2ND_TARGET_PROJECT_INCLUDES \
+ TARGET_PROJECT_SYSTEM_INCLUDES \
+ 2ND_TARGET_PROJECT_SYSTEM_INCLUDES \
+ ,Project include variables have been removed)
# Used to force goals to build. Only use for conditionally defined goals.
.PHONY: FORCE
@@ -1057,16 +1063,6 @@
RELATIVE_PWD :=
endif
-TARGET_PROJECT_INCLUDES :=
-TARGET_PROJECT_SYSTEM_INCLUDES := \
- $(TARGET_DEVICE_KERNEL_HEADERS) $(TARGET_BOARD_KERNEL_HEADERS) \
- $(TARGET_PRODUCT_KERNEL_HEADERS)
-
-ifdef TARGET_2ND_ARCH
-$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_PROJECT_INCLUDES := $(TARGET_PROJECT_INCLUDES)
-$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_PROJECT_SYSTEM_INCLUDES := $(TARGET_PROJECT_SYSTEM_INCLUDES)
-endif
-
# Flags for DEX2OAT
first_non_empty_of_three = $(if $(1),$(1),$(if $(2),$(2),$(3)))
DEX2OAT_TARGET_ARCH := $(TARGET_ARCH)
diff --git a/core/package_internal.mk b/core/package_internal.mk
index 62dac99..034a36e 100644
--- a/core/package_internal.mk
+++ b/core/package_internal.mk
@@ -694,6 +694,12 @@
PACKAGES.$(LOCAL_PACKAGE_NAME).OVERRIDES := $(strip $(LOCAL_OVERRIDES_PACKAGES))
PACKAGES.$(LOCAL_PACKAGE_NAME).RESOURCE_FILES := $(all_resources)
+ifneq ($(LOCAL_MODULE_STEM),)
+ PACKAGES.$(LOCAL_MODULE).STEM := $(LOCAL_MODULE_STEM)
+else
+ PACKAGES.$(LOCAL_MODULE).STEM := $(LOCAL_MODULE)
+endif
+
PACKAGES := $(PACKAGES) $(LOCAL_PACKAGE_NAME)
# Reset internal variables.
diff --git a/core/soong_app_prebuilt.mk b/core/soong_app_prebuilt.mk
index 6dc396c..a3de688 100644
--- a/core/soong_app_prebuilt.mk
+++ b/core/soong_app_prebuilt.mk
@@ -157,6 +157,12 @@
include $(BUILD_SYSTEM)/app_certificate_validate.mk
PACKAGES.$(LOCAL_MODULE).OVERRIDES := $(strip $(LOCAL_OVERRIDES_PACKAGES))
+ifneq ($(LOCAL_MODULE_STEM),)
+ PACKAGES.$(LOCAL_MODULE).STEM := $(LOCAL_MODULE_STEM)
+else
+ PACKAGES.$(LOCAL_MODULE).STEM := $(LOCAL_MODULE)
+endif
+
# Set a actual_partition_tag (calculated in base_rules.mk) for the package.
PACKAGES.$(LOCAL_MODULE).PARTITION := $(actual_partition_tag)
diff --git a/core/soong_config.mk b/core/soong_config.mk
index cbc2dd1..18949be 100644
--- a/core/soong_config.mk
+++ b/core/soong_config.mk
@@ -121,7 +121,7 @@
$(call add_json_bool, ArtUseReadBarrier, $(call invert_bool,$(filter false,$(PRODUCT_ART_USE_READ_BARRIER))))
$(call add_json_bool, Binder32bit, $(BINDER32BIT))
$(call add_json_str, BtConfigIncludeDir, $(BOARD_BLUETOOTH_BDROID_BUILDCFG_INCLUDE_DIR))
-$(call add_json_list, DeviceKernelHeaders, $(TARGET_PROJECT_SYSTEM_INCLUDES))
+$(call add_json_list, DeviceKernelHeaders, $(TARGET_DEVICE_KERNEL_HEADERS) $(TARGET_BOARD_KERNEL_HEADERS) $(TARGET_PRODUCT_KERNEL_HEADERS))
$(call add_json_bool, DevicePrefer32BitApps, $(filter true,$(TARGET_PREFER_32_BIT_APPS)))
$(call add_json_bool, DevicePrefer32BitExecutables, $(filter true,$(TARGET_PREFER_32_BIT_EXECUTABLES)))
$(call add_json_str, DeviceVndkVersion, $(BOARD_VNDK_VERSION))
@@ -132,6 +132,8 @@
$(call add_json_list, DeviceSystemSdkVersions, $(BOARD_SYSTEMSDK_VERSIONS))
$(call add_json_list, Platform_systemsdk_versions, $(PLATFORM_SYSTEMSDK_VERSIONS))
$(call add_json_bool, Malloc_not_svelte, $(call invert_bool,$(filter true,$(MALLOC_SVELTE))))
+$(call add_json_bool, Malloc_zero_contents, $(MALLOC_ZERO_CONTENTS))
+$(call add_json_bool, Malloc_pattern_fill_contents, $(MALLOC_PATTERN_FILL_CONTENTS))
$(call add_json_str, Override_rs_driver, $(OVERRIDE_RS_DRIVER))
$(call add_json_bool, UncompressPrivAppDex, $(call invert_bool,$(filter true,$(DONT_UNCOMPRESS_PRIV_APPS_DEXS))))
diff --git a/core/version_defaults.mk b/core/version_defaults.mk
index fe71d7b..39956b6 100644
--- a/core/version_defaults.mk
+++ b/core/version_defaults.mk
@@ -39,9 +39,9 @@
include $(INTERNAL_BUILD_ID_MAKEFILE)
endif
-DEFAULT_PLATFORM_VERSION := RP1A
-MIN_PLATFORM_VERSION := RP1A
-MAX_PLATFORM_VERSION := RP1A
+DEFAULT_PLATFORM_VERSION := SP1A
+MIN_PLATFORM_VERSION := SP1A
+MAX_PLATFORM_VERSION := SP1A
ALLOWED_VERSIONS := $(call allowed-platform-versions,\
$(MIN_PLATFORM_VERSION),\
@@ -85,10 +85,12 @@
# unreleased API level targetable by this branch, not just those that are valid
# lunch targets for this branch.
PLATFORM_VERSION.RP1A := R
+PLATFORM_VERSION.SP1A := S
# 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.RP1A := R
+PLATFORM_VERSION_CODENAME.SP1A := S
ifndef PLATFORM_VERSION
PLATFORM_VERSION := $(PLATFORM_VERSION.$(TARGET_PLATFORM_VERSION))
diff --git a/target/product/aosp_arm64.mk b/target/product/aosp_arm64.mk
index e14effc..3254ccf 100644
--- a/target/product/aosp_arm64.mk
+++ b/target/product/aosp_arm64.mk
@@ -48,8 +48,10 @@
#
$(call inherit-product, $(SRC_TARGET_DIR)/product/aosp_product.mk)
-PRODUCT_FULL_TREBLE_OVERRIDE := true
-
+#
+# All components inherited here go to vendor or vendor_boot image
+#
+$(call inherit-product, $(SRC_TARGET_DIR)/product/emulator_vendor.mk)
$(call inherit-product, $(SRC_TARGET_DIR)/board/generic_arm64/device.mk)
#
diff --git a/tools/releasetools/common.py b/tools/releasetools/common.py
index 5cf4810..7f40374 100644
--- a/tools/releasetools/common.py
+++ b/tools/releasetools/common.py
@@ -336,8 +336,11 @@
_RO_PRODUCT_RESOLVE_PROPS = ["ro.product.brand", "ro.product.device",
"ro.product.manufacturer", "ro.product.model",
"ro.product.name"]
- _RO_PRODUCT_PROPS_DEFAULT_SOURCE_ORDER = ["product", "odm", "vendor",
- "system_ext", "system"]
+ _RO_PRODUCT_PROPS_DEFAULT_SOURCE_ORDER_CURRENT = [
+ "product", "odm", "vendor", "system_ext", "system"]
+ _RO_PRODUCT_PROPS_DEFAULT_SOURCE_ORDER_ANDROID_10 = [
+ "product", "product_services", "odm", "vendor", "system"]
+ _RO_PRODUCT_PROPS_DEFAULT_SOURCE_ORDER_LEGACY = []
def __init__(self, info_dict, oem_dicts=None):
"""Initializes a BuildInfo instance with the given dicts.
@@ -358,10 +361,13 @@
self.oem_dicts = oem_dicts
self._is_ab = info_dict.get("ab_update") == "true"
- self._oem_props = info_dict.get("oem_fingerprint_properties")
- if self._oem_props:
- assert oem_dicts, "OEM source required for this build"
+ # Skip _oem_props if oem_dicts is None to use BuildInfo in
+ # sign_target_files_apks
+ if self.oem_dicts:
+ self._oem_props = info_dict.get("oem_fingerprint_properties")
+ else:
+ self._oem_props = None
def check_fingerprint(fingerprint):
if (" " in fingerprint or any(ord(ch) > 127 for ch in fingerprint)):
@@ -447,16 +453,16 @@
if prop_val:
return prop_val
+ default_source_order = self._GetRoProductPropsDefaultSourceOrder()
source_order_val = self.info_dict.get("build.prop", {}).get(
"ro.product.property_source_order")
if source_order_val:
source_order = source_order_val.split(",")
else:
- source_order = BuildInfo._RO_PRODUCT_PROPS_DEFAULT_SOURCE_ORDER
+ source_order = default_source_order
# Check that all sources in ro.product.property_source_order are valid
- if any([x not in BuildInfo._RO_PRODUCT_PROPS_DEFAULT_SOURCE_ORDER
- for x in source_order]):
+ if any([x not in default_source_order for x in source_order]):
raise ExternalError(
"Invalid ro.product.property_source_order '{}'".format(source_order))
@@ -470,6 +476,27 @@
raise ExternalError("couldn't resolve {}".format(prop))
+ def _GetRoProductPropsDefaultSourceOrder(self):
+ # NOTE: refer to CDDs and android.os.Build.VERSION for the definition and
+ # values of these properties for each Android release.
+ android_codename = self.info_dict.get("build.prop", {}).get(
+ "ro.build.version.codename")
+ if android_codename == "REL":
+ android_version = self.info_dict.get("build.prop", {}).get(
+ "ro.build.version.release")
+ if android_version == "10":
+ return BuildInfo._RO_PRODUCT_PROPS_DEFAULT_SOURCE_ORDER_ANDROID_10
+ # NOTE: float() conversion of android_version will have rounding error.
+ # We are checking for "9" or less, and using "< 10" is well outside of
+ # possible floating point rounding.
+ try:
+ android_version_val = float(android_version)
+ except ValueError:
+ android_version_val = 0
+ if android_version_val < 10:
+ return BuildInfo._RO_PRODUCT_PROPS_DEFAULT_SOURCE_ORDER_LEGACY
+ return BuildInfo._RO_PRODUCT_PROPS_DEFAULT_SOURCE_ORDER_CURRENT
+
def GetOemProperty(self, key):
if self.oem_props is not None and key in self.oem_props:
return self.oem_dicts[0][key]
diff --git a/tools/releasetools/sign_apex.py b/tools/releasetools/sign_apex.py
index b0128dc..fb947f4 100755
--- a/tools/releasetools/sign_apex.py
+++ b/tools/releasetools/sign_apex.py
@@ -35,6 +35,10 @@
-e (--extra_apks) <name,name,...=key>
Add extra APK name/key pairs. This is useful to sign the apk files in the
apex payload image.
+
+ --codename_to_api_level_map Q:29,R:30,...
+ A Mapping of codename to api level. This is useful to provide sdk targeting
+ information to APK Signer.
"""
import logging
@@ -48,7 +52,7 @@
def SignApexFile(avbtool, apex_file, payload_key, container_key, no_hashtree,
- apk_keys=None, signing_args=None):
+ apk_keys=None, signing_args=None, codename_to_api_level_map=None):
"""Signs the given apex file."""
with open(apex_file, 'rb') as input_fp:
apex_data = input_fp.read()
@@ -59,7 +63,7 @@
payload_key=payload_key,
container_key=container_key,
container_pw=None,
- codename_to_api_level_map=None,
+ codename_to_api_level_map=codename_to_api_level_map,
no_hashtree=no_hashtree,
apk_keys=apk_keys,
signing_args=signing_args)
@@ -82,6 +86,13 @@
options['payload_key'] = a
elif o == '--payload_extra_args':
options['payload_extra_args'] = a
+ elif o == '--codename_to_api_level_map':
+ versions = a.split(",")
+ for v in versions:
+ key, value = v.split(":")
+ if 'codename_to_api_level_map' not in options:
+ options['codename_to_api_level_map'] = {}
+ options['codename_to_api_level_map'].update({key: value})
elif o in ("-e", "--extra_apks"):
names, key = a.split("=")
names = names.split(",")
@@ -98,6 +109,7 @@
extra_opts='e:',
extra_long_opts=[
'avbtool=',
+ 'codename_to_api_level_map=',
'container_key=',
'payload_extra_args=',
'payload_key=',
@@ -119,7 +131,9 @@
options['container_key'],
no_hashtree=False,
apk_keys=options.get('extra_apks', {}),
- signing_args=options.get('payload_extra_args'))
+ signing_args=options.get('payload_extra_args'),
+ codename_to_api_level_map=options.get(
+ 'codename_to_api_level_map', {}))
shutil.copyfile(signed_apex, args[1])
logger.info("done.")
diff --git a/tools/releasetools/test_check_target_files_vintf.py b/tools/releasetools/test_check_target_files_vintf.py
index 79f9018..d326229 100644
--- a/tools/releasetools/test_check_target_files_vintf.py
+++ b/tools/releasetools/test_check_target_files_vintf.py
@@ -35,20 +35,20 @@
'SYSTEM_EXT/etc/build.prop': '',
# Non-empty files
- 'SYSTEM/compatibility_matrix.xml':"""
- <compatibility-matrix version="1.0" type="framework">
+ 'SYSTEM/etc/vintf/compatibility_matrix.1.xml':"""
+ <compatibility-matrix version="1.0" level="1" type="framework">
<sepolicy>
<sepolicy-version>0.0</sepolicy-version>
<kernel-sepolicy-version>0</kernel-sepolicy-version>
</sepolicy>
</compatibility-matrix>""",
'SYSTEM/manifest.xml':
- '<manifest version="1.0" type="framework" />',
+ '<manifest version="1.0" type="framework"/>',
'VENDOR/build.prop': 'ro.product.first_api_level=29\n',
'VENDOR/compatibility_matrix.xml':
'<compatibility-matrix version="1.0" type="device" />',
- 'VENDOR/manifest.xml':
- '<manifest version="1.0" type="device"/>',
+ 'VENDOR/etc/vintf/manifest.xml':
+ '<manifest version="1.0" target-level="1" type="device"/>',
'META/misc_info.txt':
'recovery_api_version=3\nfstab_version=2\nvintf_enforce=true\n',
}
@@ -140,6 +140,6 @@
def test_CheckVintf_bad_xml(self):
test_dir = self.prepare_test_dir('does-not-exist')
write_string_to_file('not an XML',
- os.path.join(test_dir, 'VENDOR/manifest.xml'))
+ os.path.join(test_dir, 'VENDOR/etc/vintf/manifest.xml'))
# Should raise an error because a file has invalid format.
self.assertRaises(common.ExternalError, CheckVintf, test_dir)
diff --git a/tools/releasetools/test_common.py b/tools/releasetools/test_common.py
index 551f626..665eb51 100644
--- a/tools/releasetools/test_common.py
+++ b/tools/releasetools/test_common.py
@@ -108,6 +108,51 @@
},
]
+ TEST_INFO_DICT_PROPERTY_SOURCE_ORDER = {
+ 'build.prop' : {
+ 'ro.build.fingerprint' : 'build-fingerprint',
+ 'ro.product.property_source_order' :
+ 'product,odm,vendor,system_ext,system',
+ },
+ 'system.build.prop' : {
+ 'ro.product.system.device' : 'system-product-device',
+ },
+ 'vendor.build.prop' : {
+ 'ro.product.vendor.device' : 'vendor-product-device',
+ },
+ }
+
+ TEST_INFO_DICT_PROPERTY_SOURCE_ORDER_ANDROID_10 = {
+ 'build.prop' : {
+ 'ro.build.fingerprint' : 'build-fingerprint',
+ 'ro.product.property_source_order' :
+ 'product,product_services,odm,vendor,system',
+ 'ro.build.version.release' : '10',
+ 'ro.build.version.codename' : 'REL',
+ },
+ 'system.build.prop' : {
+ 'ro.product.system.device' : 'system-product-device',
+ },
+ 'vendor.build.prop' : {
+ 'ro.product.vendor.device' : 'vendor-product-device',
+ },
+ }
+
+ TEST_INFO_DICT_PROPERTY_SOURCE_ORDER_ANDROID_9 = {
+ 'build.prop' : {
+ 'ro.product.device' : 'product-device',
+ 'ro.build.fingerprint' : 'build-fingerprint',
+ 'ro.build.version.release' : '9',
+ 'ro.build.version.codename' : 'REL',
+ },
+ 'system.build.prop' : {
+ 'ro.product.system.device' : 'system-product-device',
+ },
+ 'vendor.build.prop' : {
+ 'ro.product.vendor.device' : 'vendor-product-device',
+ },
+ }
+
def test_init(self):
target_info = common.BuildInfo(self.TEST_INFO_DICT, None)
self.assertEqual('product-device', target_info.device)
@@ -131,10 +176,6 @@
self.assertEqual('brand3/product-name/device3:build-thumbprint',
target_info.fingerprint)
- # Missing oem_dict should be rejected.
- self.assertRaises(AssertionError, common.BuildInfo,
- self.TEST_INFO_DICT_USES_OEM_PROPS, None)
-
def test_init_badFingerprint(self):
info_dict = copy.deepcopy(self.TEST_INFO_DICT)
info_dict['build.prop']['ro.build.fingerprint'] = 'bad fingerprint'
@@ -254,6 +295,41 @@
],
script_writer.lines)
+ def test_ResolveRoProductProperty_FromVendor(self):
+ info_dict = copy.deepcopy(self.TEST_INFO_DICT_PROPERTY_SOURCE_ORDER)
+ info = common.BuildInfo(info_dict, None)
+ self.assertEqual('vendor-product-device',
+ info.GetBuildProp('ro.product.device'))
+
+ def test_ResolveRoProductProperty_FromSystem(self):
+ info_dict = copy.deepcopy(self.TEST_INFO_DICT_PROPERTY_SOURCE_ORDER)
+ del info_dict['vendor.build.prop']['ro.product.vendor.device']
+ info = common.BuildInfo(info_dict, None)
+ self.assertEqual('system-product-device',
+ info.GetBuildProp('ro.product.device'))
+
+ def test_ResolveRoProductProperty_InvalidPropertySearchOrder(self):
+ info_dict = copy.deepcopy(self.TEST_INFO_DICT_PROPERTY_SOURCE_ORDER)
+ info_dict['build.prop']['ro.product.property_source_order'] = 'bad-source'
+ with self.assertRaisesRegexp(common.ExternalError,
+ 'Invalid ro.product.property_source_order'):
+ info = common.BuildInfo(info_dict, None)
+ info.GetBuildProp('ro.product.device')
+
+ def test_ResolveRoProductProperty_Android10PropertySearchOrder(self):
+ info_dict = copy.deepcopy(
+ self.TEST_INFO_DICT_PROPERTY_SOURCE_ORDER_ANDROID_10)
+ info = common.BuildInfo(info_dict, None)
+ self.assertEqual('vendor-product-device',
+ info.GetBuildProp('ro.product.device'))
+
+ def test_ResolveRoProductProperty_Android9PropertySearchOrder(self):
+ info_dict = copy.deepcopy(
+ self.TEST_INFO_DICT_PROPERTY_SOURCE_ORDER_ANDROID_9)
+ info = common.BuildInfo(info_dict, None)
+ self.assertEqual('product-device',
+ info.GetBuildProp('ro.product.device'))
+
class CommonZipTest(test_utils.ReleaseToolsTestCase):
diff --git a/tools/releasetools/testdata/vintf/kernel/SYSTEM/compatibility_matrix.xml b/tools/releasetools/testdata/vintf/kernel/SYSTEM/etc/vintf/compatibility_matrix.1.xml
similarity index 74%
rename from tools/releasetools/testdata/vintf/kernel/SYSTEM/compatibility_matrix.xml
rename to tools/releasetools/testdata/vintf/kernel/SYSTEM/etc/vintf/compatibility_matrix.1.xml
index ed46b6b..a92dd6e 100644
--- a/tools/releasetools/testdata/vintf/kernel/SYSTEM/compatibility_matrix.xml
+++ b/tools/releasetools/testdata/vintf/kernel/SYSTEM/etc/vintf/compatibility_matrix.1.xml
@@ -1,4 +1,4 @@
-<compatibility-matrix version="1.0" type="framework">
+<compatibility-matrix version="1.0" level="1" type="framework">
<kernel version="4.14.1" />
<sepolicy>
<sepolicy-version>0.0</sepolicy-version>
diff --git a/tools/releasetools/testdata/vintf/matrix_incompat/SYSTEM/compatibility_matrix.xml b/tools/releasetools/testdata/vintf/matrix_incompat/SYSTEM/etc/vintf/compatibility_matrix.1.xml
similarity index 71%
rename from tools/releasetools/testdata/vintf/matrix_incompat/SYSTEM/compatibility_matrix.xml
rename to tools/releasetools/testdata/vintf/matrix_incompat/SYSTEM/etc/vintf/compatibility_matrix.1.xml
index 5d891fa..1700e21 100644
--- a/tools/releasetools/testdata/vintf/matrix_incompat/SYSTEM/compatibility_matrix.xml
+++ b/tools/releasetools/testdata/vintf/matrix_incompat/SYSTEM/etc/vintf/compatibility_matrix.1.xml
@@ -1,4 +1,4 @@
-<compatibility-matrix version="1.0" type="framework">
+<compatibility-matrix version="1.0" level="1" type="framework">
<sepolicy>
<sepolicy-version>1.0</sepolicy-version>
<kernel-sepolicy-version>0</kernel-sepolicy-version>
diff --git a/tools/releasetools/testdata/vintf/sku_compat/SYSTEM/compatibility_matrix.xml b/tools/releasetools/testdata/vintf/sku_compat/SYSTEM/etc/vintf/compatibility_matrix.1.xml
similarity index 85%
rename from tools/releasetools/testdata/vintf/sku_compat/SYSTEM/compatibility_matrix.xml
rename to tools/releasetools/testdata/vintf/sku_compat/SYSTEM/etc/vintf/compatibility_matrix.1.xml
index 19a9b6a..22272fd 100644
--- a/tools/releasetools/testdata/vintf/sku_compat/SYSTEM/compatibility_matrix.xml
+++ b/tools/releasetools/testdata/vintf/sku_compat/SYSTEM/etc/vintf/compatibility_matrix.1.xml
@@ -1,4 +1,4 @@
-<compatibility-matrix version="1.0" type="framework">
+<compatibility-matrix version="1.0" level="1" type="framework">
<hal format="hidl" optional="false">
<name>foo</name>
<version>1.0</version>
diff --git a/tools/releasetools/testdata/vintf/sku_incompat/SYSTEM/compatibility_matrix.xml b/tools/releasetools/testdata/vintf/sku_incompat/SYSTEM/etc/vintf/compatibility_matrix.1.xml
similarity index 85%
rename from tools/releasetools/testdata/vintf/sku_incompat/SYSTEM/compatibility_matrix.xml
rename to tools/releasetools/testdata/vintf/sku_incompat/SYSTEM/etc/vintf/compatibility_matrix.1.xml
index e0e0d6c..1a3fc43 100644
--- a/tools/releasetools/testdata/vintf/sku_incompat/SYSTEM/compatibility_matrix.xml
+++ b/tools/releasetools/testdata/vintf/sku_incompat/SYSTEM/etc/vintf/compatibility_matrix.1.xml
@@ -1,4 +1,4 @@
-<compatibility-matrix version="1.0" type="framework">
+<compatibility-matrix version="1.0" level="1" type="framework">
<hal format="hidl" optional="false">
<name>foo</name>
<version>1.1</version>