From 79effa56c544b28bdce928964d08f2de6acf3fa1 Mon Sep 17 00:00:00 2001 From: Liz Kammer Date: Wed, 31 Jan 2024 15:44:57 -0500 Subject: Fix cogsetup.sh to work from non-root dirs Test: source make/envsetup.sh Change-Id: I36de407dbbb0cf266f1701d0895ba71d3ad41dba --- cogsetup.sh | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/cogsetup.sh b/cogsetup.sh index 6439af056e..44538f2a65 100644 --- a/cogsetup.sh +++ b/cogsetup.sh @@ -21,18 +21,21 @@ function _create_out_symlink_for_cog() { OUT_DIR="out" fi - if [[ -L "${OUT_DIR}" ]]; then + # getoutdir ensures paths are absolute. envsetup could be called from a + # directory other than the root of the source tree + local outdir=$(getoutdir) + if [[ -L "${outdir}" ]]; then return fi - if [ -d "${OUT_DIR}" ]; then - echo -e "\tOutput directory ${OUT_DIR} cannot be present in a Cog workspace." - echo -e "\tDelete \"${OUT_DIR}\" or create a symlink from \"${OUT_DIR}\" to a directory outside your workspace." + if [ -d "${outdir}" ]; then + echo -e "\tOutput directory ${outdir} cannot be present in a Cog workspace." + echo -e "\tDelete \"${outdir}\" or create a symlink from \"${outdir}\" to a directory outside your workspace." return 1 fi DEFAULT_OUTPUT_DIR="${HOME}/.cog/android-build-out" mkdir -p ${DEFAULT_OUTPUT_DIR} - ln -s ${DEFAULT_OUTPUT_DIR} `pwd`/out + ln -s ${DEFAULT_OUTPUT_DIR} ${outdir} } # This function sets up the build environment to be appropriate for Cog. @@ -63,4 +66,4 @@ if [[ "${PWD}" != /google/cog/* ]]; then echo -e "\e[01;31mERROR:\e[0m This script must be run from a Cog workspace." fi -_setup_cog_env \ No newline at end of file +_setup_cog_env -- cgit v1.2.3 From 000e31c9ed8b8753b922db7416f6496254747920 Mon Sep 17 00:00:00 2001 From: Justin Yun Date: Wed, 28 Feb 2024 20:54:14 +0900 Subject: Define PRODUCT_SHIPPING_VENDOR_API_LEVEL Devices may set its first vendor api level to PRODUCT_SHIPPING_VENDOR_API_LEVEL. This will manually set to ro.vendor.api_level and will be used by tests. If this value is not defined, init process will automatically calculate the ro.vendor.api_level property for tests. Bug: 326164316 Test: Check vendor/build.prop Change-Id: I89f844ffaad9e3e39deab1c680bd1f7f17f4d8ad --- core/main.mk | 5 +++++ core/product.mk | 3 +++ 2 files changed, 8 insertions(+) diff --git a/core/main.mk b/core/main.mk index b4ca2a49b9..c1cafc0c89 100644 --- a/core/main.mk +++ b/core/main.mk @@ -284,6 +284,11 @@ ADDITIONAL_VENDOR_PROPERTIES += \ ro.product.first_api_level=$(PRODUCT_SHIPPING_API_LEVEL) endif +ifdef PRODUCT_SHIPPING_VENDOR_API_LEVEL +ADDITIONAL_VENDOR_PROPERTIES += \ + ro.vendor.api_level=$(PRODUCT_SHIPPING_VENDOR_API_LEVEL) +endif + ifneq ($(TARGET_BUILD_VARIANT),user) ifdef PRODUCT_SET_DEBUGFS_RESTRICTIONS ADDITIONAL_VENDOR_PROPERTIES += \ diff --git a/core/product.mk b/core/product.mk index 60cab47b5b..d64dde2c68 100644 --- a/core/product.mk +++ b/core/product.mk @@ -230,6 +230,9 @@ _product_single_value_vars += PRODUCT_SYSTEM_DLKM_BASE_FS_PATH # The first API level this product shipped with _product_single_value_vars += PRODUCT_SHIPPING_API_LEVEL +# The first vendor API level this product shipped with +_product_single_value_vars += PRODUCT_SHIPPING_VENDOR_API_LEVEL + _product_list_vars += VENDOR_PRODUCT_RESTRICT_VENDOR_FILES _product_list_vars += VENDOR_EXCEPTION_MODULES _product_list_vars += VENDOR_EXCEPTION_PATHS -- cgit v1.2.3 From bebbf54aa08a336c1a1325dc68555700caa3f84b Mon Sep 17 00:00:00 2001 From: Dennis Shen Date: Wed, 28 Feb 2024 15:26:28 +0000 Subject: aconfig_storage: move storage files to /etc/aconfig dir Move them to under aconfig dir so it is easier to define SELinux policy. Bug: b/312459182 Test: m Change-Id: I2af7167a21e004729a9ac8628243080c893fb33a --- core/packaging/flags.mk | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/core/packaging/flags.mk b/core/packaging/flags.mk index 62ef3df7db..500efdd29b 100644 --- a/core/packaging/flags.mk +++ b/core/packaging/flags.mk @@ -154,9 +154,9 @@ endef ifeq ($(RELEASE_CREATE_ACONFIG_STORAGE_FILE),true) $(foreach partition, $(_FLAG_PARTITIONS), \ - $(eval aconfig_storage_package_map.$(partition) := $(PRODUCT_OUT)/$(partition)/etc/package.map) \ - $(eval aconfig_storage_flag_map.$(partition) := $(PRODUCT_OUT)/$(partition)/etc/flag.map) \ - $(eval aconfig_storage_flag_val.$(partition) := $(PRODUCT_OUT)/$(partition)/etc/flag.val) \ + $(eval aconfig_storage_package_map.$(partition) := $(PRODUCT_OUT)/$(partition)/etc/aconfig/package.map) \ + $(eval aconfig_storage_flag_map.$(partition) := $(PRODUCT_OUT)/$(partition)/etc/aconfig/flag.map) \ + $(eval aconfig_storage_flag_val.$(partition) := $(PRODUCT_OUT)/$(partition)/etc/aconfig/flag.val) \ $(eval $(call generate-partition-aconfig-storage-file, \ $(TARGET_OUT_FLAGS)/$(partition)/package.map, \ $(TARGET_OUT_FLAGS)/$(partition)/flag.map, \ -- cgit v1.2.3 From 5dd61f03ff7348d75fc2c580d2a6f8e0714c30b1 Mon Sep 17 00:00:00 2001 From: Wei Li Date: Wed, 28 Feb 2024 15:15:42 -0800 Subject: Add meta-lic.mk for declaring license metadata of some 1P files. The 1p files are included in PRODUCT_COPY_FILES and released with products. Bug: 316805918 Test: CIs Change-Id: Ibe443af26fb14c1bd84552c9f327a1c2ba8c70a4 --- core/tasks/meta-lic.mk | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 core/tasks/meta-lic.mk diff --git a/core/tasks/meta-lic.mk b/core/tasks/meta-lic.mk new file mode 100644 index 0000000000..0079714ac3 --- /dev/null +++ b/core/tasks/meta-lic.mk @@ -0,0 +1,23 @@ +# Copyright (C) 2024 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. + +# Declare license metadata for non-module files released with products. + +# Moved here from frameworks/av/media/Android.mk +$(eval $(call declare-1p-copy-files,frameworks/av/media/libeffects,audio_effects.conf)) +$(eval $(call declare-1p-copy-files,frameworks/av/media/libeffects,audio_effects.xml)) +$(eval $(call declare-1p-copy-files,frameworks/av/media/libstagefright,)) + +# Moved here from frameworks/av/services/Android.mk +$(eval $(call declare-1p-copy-files,frameworks/av/services/audiopolicy,)) -- cgit v1.2.3 From 74dabedcb3ed045607e39ec1611191af2877ed89 Mon Sep 17 00:00:00 2001 From: Alyssa Ketpreechasawat Date: Thu, 29 Feb 2024 01:57:07 +0000 Subject: Use build flag to control the apex boot jars to be excluded. Different prebuilts might have different contents and thus, different boot jars to be removed from the existing apex boot jar lists e.g. next using U prebuilts would need to remove framework-pdf while ap31 with V prebuilts must not remove such. The existing mechanism will always remove framework-pdf whenever prebuilts are enabled regardless of release config, which is not correct in context of multiple prebuilt support. Ignore-AOSP-First: for successful build, we need to submit this togther with ag/26332775. this cl will get cp'ed into aosp later on Bug: 327022391 Test: build device in next and trunk Merged-In: I9949fb7075ab6c207a292f13fd75e010a4958f87 Change-Id: I9949fb7075ab6c207a292f13fd75e010a4958f87 --- core/art_config.mk | 5 ++++- target/product/default_art_config.mk | 7 ------- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/core/art_config.mk b/core/art_config.mk index 54bfd6b728..47b4bcfce6 100644 --- a/core/art_config.mk +++ b/core/art_config.mk @@ -27,8 +27,11 @@ ADDITIONAL_PRODUCT_PROPERTIES += ro.dalvik.vm.enable_uffd_gc=$(config_enable_uff # soong variables indicate whether the prebuilt is enabled: # - $(m)_module/source_build for art and TOGGLEABLE_PREBUILT_MODULES # - ANDROID/module_build_from_source for other mainline modules +# Note that RELEASE_APEX_BOOT_JARS_PREBUILT_EXCLUDED_LIST is the list of module names +# and library names of jars that need to be removed. We have to keep separated list per +# release config due to possibility of different prebuilt content. APEX_BOOT_JARS_EXCLUDED := -$(foreach pair, $(PRODUCT_APEX_BOOT_JARS_FOR_SOURCE_BUILD_ONLY),\ +$(foreach pair, $(RELEASE_APEX_BOOT_JARS_PREBUILT_EXCLUDED_LIST),\ $(eval m := $(subst com.android.,,$(call word-colon,1,$(pair)))) \ $(if $(call soong_config_get,$(m)_module,source_build), \ $(if $(filter true,$(call soong_config_get,$(m)_module,source_build)),, \ diff --git a/target/product/default_art_config.mk b/target/product/default_art_config.mk index dca9baacfd..d13a4c47d3 100644 --- a/target/product/default_art_config.mk +++ b/target/product/default_art_config.mk @@ -104,13 +104,6 @@ else com.android.nfcservices:framework-nfc endif -# TODO(b/308174306): Adjust this after multiple prebuilts version is supported. -# APEX boot jars that are not in prebuilt apexes. -# Keep the list sorted by module names and then library names. -PRODUCT_APEX_BOOT_JARS_FOR_SOURCE_BUILD_ONLY := \ - com.android.mediaprovider:framework-pdf \ - com.android.mediaprovider:framework-pdf-v \ - # List of system_server classpath jars delivered via apex. # Keep the list sorted by module names and then library names. # Note: For modules available in Q, DO NOT add new entries here. -- cgit v1.2.3 From 474afa8f06e297924c7fe03e47ce8d6e7c703024 Mon Sep 17 00:00:00 2001 From: Daniel Zheng Date: Wed, 28 Feb 2024 12:59:52 -0800 Subject: fallback on older cow version If a device's source or target cow version is specified at 2 (or undefined) we should fallback on using the v2 writer. e.g. 1. v3 -> v2 downgrade OTA 2. v2 -> v3 Bug: 322279333 Test: ota_from_target_files Change-Id: I8c5139eceeb64ee255ddea66017b3e17bbdc44c0 --- tools/releasetools/common.py | 4 ++++ tools/releasetools/ota_from_target_files.py | 10 ++++++++++ 2 files changed, 14 insertions(+) diff --git a/tools/releasetools/common.py b/tools/releasetools/common.py index 199037728d..8a8a613c78 100644 --- a/tools/releasetools/common.py +++ b/tools/releasetools/common.py @@ -479,6 +479,10 @@ class BuildInfo(object): def vabc_compression_param(self): return self.get("virtual_ab_compression_method", "") + @property + def vabc_cow_version(self): + return self.get("virtual_ab_cow_version", "") + @property def vendor_api_level(self): vendor_prop = self.info_dict.get("vendor.build.prop") diff --git a/tools/releasetools/ota_from_target_files.py b/tools/releasetools/ota_from_target_files.py index dbbbca2189..c0ff5d2741 100755 --- a/tools/releasetools/ota_from_target_files.py +++ b/tools/releasetools/ota_from_target_files.py @@ -908,6 +908,16 @@ def GenerateAbOtaPackage(target_file, output_file, source_file=None): source_info.vabc_compression_param, target_info.vabc_compression_param, source_info.vabc_compression_param)) vabc_compression_param = source_info.vabc_compression_param + # Virtual AB Cow version 3 is introduced in Android U with improved memory + # and install time performance. All OTA's with + # both the source build and target build with VIRTUAL_AB_COW_VERSION = 3 + # can support the new format. Otherwise, fallback on older versions + if not source_info.vabc_cow_version or not target_info.vabc_cow_version: + logger.info("Source or Target doesn't have VABC_COW_VERSION specified, default to version 2") + OPTIONS.vabc_cow_version = 2 + elif source_info.vabc_cow_version != target_info.vabc_cow_version: + logger.info("Source and Target have different cow VABC_COW_VERSION specified, default to minimum version") + OPTIONS.vabc_cow_version = min(source_info.vabc_cow_version, target_info.vabc_cow_version) # Virtual AB Compression was introduced in Androd S. # Later, we backported VABC to Android R. But verity support was not # backported, so if VABC is used and we are on Android R, disable -- cgit v1.2.3 From 036cdbe92fdf655ff98cded72dc915def6d56d88 Mon Sep 17 00:00:00 2001 From: Zhi Dou Date: Wed, 28 Feb 2024 18:34:57 +0000 Subject: aconfig: disable export mode for generated native flag libraries Currently the default flag values are not loaded into sysprop. Since the current requirements for export flag are for flagged api in java and the new storage system will load default values for all, there won't be changes to make the default value loaded into sysprop. Thus this change disable export mode for generated native flag libraries for now. It will be enabled once the new storage is landed. Test: m libaconfig_test_rust_library_with_exported_mode and expect build failure Bug: 327392334 Change-Id: I2db814d015cdb533778822f7417d055b251ed589 --- tools/aconfig/TEST_MAPPING | 18 ++++++++++-------- tools/aconfig/aconfig/Android.bp | 18 ++++++++++++------ tools/aconfig/aconfig/src/commands.rs | 10 ++++++++++ 3 files changed, 32 insertions(+), 14 deletions(-) diff --git a/tools/aconfig/TEST_MAPPING b/tools/aconfig/TEST_MAPPING index e42b5d3a1f..b07596fdd4 100644 --- a/tools/aconfig/TEST_MAPPING +++ b/tools/aconfig/TEST_MAPPING @@ -20,10 +20,11 @@ // aconfig C++ integration tests (test mode auto-generated code) "name": "aconfig.test.cpp.test_mode" }, - { - // aconfig C++ integration tests (exported mode auto-generated code) - "name": "aconfig.test.cpp.exported_mode" - }, + // TODO(327420679): Enable export mode for native flag library + // { + // // aconfig C++ integration tests (exported mode auto-generated code) + // "name": "aconfig.test.cpp.exported_mode" + // }, { // aconfig Rust integration tests (production mode auto-generated code) "name": "aconfig.prod_mode.test.rust" @@ -32,10 +33,11 @@ // aconfig Rust integration tests (test mode auto-generated code) "name": "aconfig.test_mode.test.rust" }, - { - // aconfig Rust integration tests (exported mode auto-generated code) - "name": "aconfig.exported_mode.test.rust" - }, + // TODO(327420679): Enable export mode for native flag library + // { + // // aconfig Rust integration tests (exported mode auto-generated code) + // "name": "aconfig.exported_mode.test.rust" + // }, { // printflags unit tests "name": "printflags.test" diff --git a/tools/aconfig/aconfig/Android.bp b/tools/aconfig/aconfig/Android.bp index 164bfe747d..2c26166c35 100644 --- a/tools/aconfig/aconfig/Android.bp +++ b/tools/aconfig/aconfig/Android.bp @@ -142,12 +142,6 @@ cc_aconfig_library { mode: "test", } -cc_aconfig_library { - name: "aconfig_test_cpp_library_exported_variant", - aconfig_declarations: "aconfig.test.flags", - mode: "exported", -} - cc_aconfig_library { name: "aconfig_test_cpp_library_force_read_only_variant", aconfig_declarations: "aconfig.test.flags", @@ -184,6 +178,14 @@ cc_test { test_suites: ["general-tests"], } +// TODO(327420679): Enable export mode for native flag library +/* +cc_aconfig_library { + name: "aconfig_test_cpp_library_exported_variant", + aconfig_declarations: "aconfig.test.flags", + mode: "exported", +} + cc_test { name: "aconfig.test.cpp.exported_mode", srcs: [ @@ -198,6 +200,7 @@ cc_test { ], test_suites: ["general-tests"], } +*/ cc_test { name: "aconfig.test.cpp.force_read_only_mode", @@ -249,6 +252,8 @@ rust_test { test_suites: ["general-tests"], } +// TODO(327420679): Enable export mode for native flag library +/* rust_aconfig_library { name: "libaconfig_test_rust_library_with_exported_mode", crate_name: "aconfig_test_rust_library", @@ -266,6 +271,7 @@ rust_test { ], test_suites: ["general-tests"], } +*/ rust_aconfig_library { name: "libaconfig_test_rust_library_with_force_read_only_mode", diff --git a/tools/aconfig/aconfig/src/commands.rs b/tools/aconfig/aconfig/src/commands.rs index 59f349b35d..c1df16bbcf 100644 --- a/tools/aconfig/aconfig/src/commands.rs +++ b/tools/aconfig/aconfig/src/commands.rs @@ -203,6 +203,11 @@ pub fn create_java_lib(mut input: Input, codegen_mode: CodegenMode) -> Result Result> { + // TODO(327420679): Enable export mode for native flag library + ensure!( + codegen_mode != CodegenMode::Exported, + "Exported mode for generated c/c++ flag library is disabled" + ); let parsed_flags = input.try_parse_flags()?; let modified_parsed_flags = modify_parsed_flags_based_on_mode(parsed_flags, codegen_mode)?; let Some(package) = find_unique_package(&modified_parsed_flags) else { @@ -214,6 +219,11 @@ pub fn create_cpp_lib(mut input: Input, codegen_mode: CodegenMode) -> Result Result { + // // TODO(327420679): Enable export mode for native flag library + ensure!( + codegen_mode != CodegenMode::Exported, + "Exported mode for generated rust flag library is disabled" + ); let parsed_flags = input.try_parse_flags()?; let modified_parsed_flags = modify_parsed_flags_based_on_mode(parsed_flags, codegen_mode)?; let Some(package) = find_unique_package(&modified_parsed_flags) else { -- cgit v1.2.3 From 594180d8d0bfc0dc8924b17f203cc000ba58f6ef Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Wed, 28 Feb 2024 12:37:40 -0800 Subject: Makefile: Optimize the code for creating the kernel module list The time needed for executing shell code strongly depends on how many times the shell has to call fork(). Hence, instead of invoking 'basename' once per kernel module, invoke 'basename' once for all kernel modules. Change-Id: Ibe322c8ebf0a466568f902beb5ab91988381678c Signed-off-by: Bart Van Assche --- core/Makefile | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/core/Makefile b/core/Makefile index b023df1e40..381b9f75f3 100644 --- a/core/Makefile +++ b/core/Makefile @@ -465,9 +465,7 @@ $(3)/$(DEPMOD_STAGING_SUBDIR)/modules.dep: $(1) $(6) ) $(if $(1),\ cp $$(PRIVATE_MODULES) $$(PRIVATE_MODULE_DIR)/; \ - for MODULE in $$(PRIVATE_LOAD_MODULES); do \ - basename $$$$MODULE >> $$(PRIVATE_LOAD_FILE); \ - done; \ + if [ -n "$$(PRIVATE_LOAD_MODULES)" ]; then basename -a $$(PRIVATE_LOAD_MODULES); fi > $$(PRIVATE_LOAD_FILE); \ ) # The ln -sf + find -delete sequence is to remove any modules in # PRIVATE_EXTRA_MODULES which have same basename as MODULES in PRIVATE_MODULES -- cgit v1.2.3 From dbbda1eeb7c8d21f334bafe86476dd36f081ab55 Mon Sep 17 00:00:00 2001 From: Dennis Shen Date: Thu, 29 Feb 2024 19:06:29 +0000 Subject: aconfig: update storage file records file name Bug: b/312444587 Test: atest aconfig.test Change-Id: Ib26ab5d50099a7038e161ef59517fad9dca744d5 --- tools/aconfig/aconfig_storage_file/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/aconfig/aconfig_storage_file/src/lib.rs b/tools/aconfig/aconfig_storage_file/src/lib.rs index 84e0e90360..f20600d666 100644 --- a/tools/aconfig/aconfig_storage_file/src/lib.rs +++ b/tools/aconfig/aconfig_storage_file/src/lib.rs @@ -63,7 +63,7 @@ pub(crate) const HASH_PRIMES: [u32; 29] = [ ]; /// Storage file location pb file -pub const STORAGE_LOCATION_FILE: &str = "/metadata/aconfig/storage_files.pb"; +pub const STORAGE_LOCATION_FILE: &str = "/metadata/aconfig/available_storage_file_records.pb"; /// Storage file type enum #[derive(Clone, Debug, PartialEq, Eq)] -- cgit v1.2.3