From 4688186da8d20a784035c3d6d121c21da76285b5 Mon Sep 17 00:00:00 2001 From: Yu-Ting Tseng Date: Fri, 13 Sep 2024 09:27:14 -0700 Subject: [PATCH 1/4] flag guarded move of uprobestats into Mainline Bug: 355315669 Test: m Ignore-AOSP-First: uprobestats is an internal-first project Change-Id: Ifc74630a56a0be8669f0fb56ba6c8ba5f6435fc6 --- core/android_soong_config_vars.mk | 11 +++++++++++ target/product/base_system.mk | 12 +++++++++++- 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/core/android_soong_config_vars.mk b/core/android_soong_config_vars.mk index 5e7a6bbebc..b28cc3e643 100644 --- a/core/android_soong_config_vars.mk +++ b/core/android_soong_config_vars.mk @@ -175,6 +175,17 @@ endif # Required as platform_bootclasspath is using this namespace $(call soong_config_set,bootclasspath,release_crashrecovery_module,$(RELEASE_CRASHRECOVERY_MODULE)) +# Add uprobestats build flag to soong +$(call soong_config_set,ANDROID,release_uprobestats_module,$(RELEASE_UPROBESTATS_MODULE)) +# Add uprobestats file move flags to soong, for both platform and module +ifeq (true,$(RELEASE_UPROBESTATS_FILE_MOVE)) + $(call soong_config_set,ANDROID,uprobestats_files_in_module,true) + $(call soong_config_set,ANDROID,uprobestats_files_in_platform,false) +else + $(call soong_config_set,ANDROID,uprobestats_files_in_module,false) + $(call soong_config_set,ANDROID,uprobestats_files_in_platform,true) +endif + # Enable Profiling module. Also used by platform_bootclasspath. $(call soong_config_set,ANDROID,release_package_profiling_module,$(RELEASE_PACKAGE_PROFILING_MODULE)) $(call soong_config_set,bootclasspath,release_package_profiling_module,$(RELEASE_PACKAGE_PROFILING_MODULE)) diff --git a/target/product/base_system.mk b/target/product/base_system.mk index 0d2aa0e535..a325683052 100644 --- a/target/product/base_system.mk +++ b/target/product/base_system.mk @@ -293,7 +293,6 @@ PRODUCT_PACKAGES += \ uiautomator \ uinput \ uncrypt \ - uprobestats \ usbd \ vdc \ vintf \ @@ -311,6 +310,17 @@ ifeq ($(RELEASE_CRASHRECOVERY_MODULE),true) endif +# When we release uprobestats module +ifeq ($(RELEASE_UPROBESTATS_MODULE),true) + PRODUCT_PACKAGES += \ + com.android.uprobestats \ + +else + PRODUCT_PACKAGES += \ + uprobestats \ + +endif + # These packages are not used on Android TV ifneq ($(PRODUCT_IS_ATV),true) PRODUCT_PACKAGES += \ From 9e103e98e066fb4e4daa2412e06aa73e3b8189ed Mon Sep 17 00:00:00 2001 From: Zhuoyao Zhang Date: Mon, 9 Sep 2024 22:20:06 +0000 Subject: [PATCH 2/4] Bootstrap the edit monitor project Add basic files required for the edit monitor project. The project aims to monitor file changes on Android source trees that are checked out to local disk and upload the edit event logs for post analysis. More details and design doc can be found in the bug. Bug: b/365617369 Test: None Change-Id: Ie5e2bdb0747823f200c87ebe071f5f9a2e567b46 --- tools/edit_monitor/Android.bp | 21 +++++++++++++++++++++ tools/edit_monitor/OWNERS | 1 + 2 files changed, 22 insertions(+) create mode 100644 tools/edit_monitor/Android.bp create mode 100644 tools/edit_monitor/OWNERS diff --git a/tools/edit_monitor/Android.bp b/tools/edit_monitor/Android.bp new file mode 100644 index 0000000000..80437c00d4 --- /dev/null +++ b/tools/edit_monitor/Android.bp @@ -0,0 +1,21 @@ +// Copyright 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. + +// Set of error prone rules to ensure code quality +// PackageLocation check requires the androidCompatible=false otherwise it does not do anything. + +package { + default_applicable_licenses: ["Android-Apache-2.0"], + default_team: "trendy_team_adte", +} diff --git a/tools/edit_monitor/OWNERS b/tools/edit_monitor/OWNERS new file mode 100644 index 0000000000..8f0f3646dd --- /dev/null +++ b/tools/edit_monitor/OWNERS @@ -0,0 +1 @@ +include platform/tools/asuite:/OWNERS_ADTE_TEAM \ No newline at end of file From ee4e44ade705474542b575503b52f90226744498 Mon Sep 17 00:00:00 2001 From: Dennis Shen Date: Fri, 13 Sep 2024 14:24:37 +0000 Subject: [PATCH 3/4] aconfig: update cpp_codegen to just read from new storage Change-Id: Ifc5886e587a64da0d940df903f972593c5e9c9d8 --- .../templates/cpp_source_file.template | 77 +++++++------------ 1 file changed, 28 insertions(+), 49 deletions(-) diff --git a/tools/aconfig/aconfig/templates/cpp_source_file.template b/tools/aconfig/aconfig/templates/cpp_source_file.template index b6012e7a0d..623034a87b 100644 --- a/tools/aconfig/aconfig/templates/cpp_source_file.template +++ b/tools/aconfig/aconfig/templates/cpp_source_file.template @@ -6,7 +6,7 @@ #include "aconfig_storage/aconfig_storage_read_api.hpp" #include #define LOG_TAG "aconfig_cpp_codegen" -#define ALOGI(...) __android_log_print(ANDROID_LOG_INFO, LOG_TAG, __VA_ARGS__) +#define ALOGE(...) __android_log_print(ANDROID_LOG_ERROR, LOG_TAG, __VA_ARGS__) {{ -endif }} {{ endif }} @@ -76,13 +76,14 @@ namespace {cpp_namespace} \{ : boolean_start_index_() {{ -endif }} , flag_value_file_(nullptr) - , read_from_new_storage_(false) - , use_new_storage_value(false) \{ + , read_from_new_storage_(false) \{ struct stat buffer; - if (stat("/metadata/aconfig_test_missions/mission_1", &buffer) == 0) \{ + if (stat("/metadata/aconfig/boot/enable_only_new_storage", &buffer) == 0) \{ read_from_new_storage_ = true; - } else \{ + } + + if (!read_from_new_storage_) \{ return; } @@ -90,15 +91,13 @@ namespace {cpp_namespace} \{ "{container}", aconfig_storage::StorageFileType::package_map); if (!package_map_file.ok()) \{ - ALOGI("error: failed to get package map file: %s", package_map_file.error().c_str()); - return; + ALOGE("error: failed to get package map file: %s", package_map_file.error().c_str()); } auto context = aconfig_storage::get_package_read_context( **package_map_file, "{package}"); if (!context.ok()) \{ - ALOGI("error: failed to get package read context: %s", context.error().c_str()); - return; + ALOGE("error: failed to get package read context: %s", context.error().c_str()); } // cache package boolean flag start index @@ -111,18 +110,13 @@ namespace {cpp_namespace} \{ "{container}", aconfig_storage::StorageFileType::flag_val); if (!flag_value_file.ok()) \{ - ALOGI("error: failed to get flag value file: %s", flag_value_file.error().c_str()); - return; + ALOGE("error: failed to get flag value file: %s", flag_value_file.error().c_str()); } // cache flag value file flag_value_file_ = std::unique_ptr( *flag_value_file); - use_new_storage_value = server_configurable_flags::GetServerConfigurableFlag( - "aconfig_flags.core_experiments_team_internal", - "com.android.providers.settings.use_new_storage_value", - "false") == "true"; } {{ -endif }} {{ -endif }} @@ -131,44 +125,30 @@ namespace {cpp_namespace} \{ virtual bool {item.flag_name}() override \{ {{ -if item.readwrite }} if (cache_[{item.readwrite_idx}] == -1) \{ + {{ if allow_instrumentation- }} + if (read_from_new_storage_) \{ + auto value = aconfig_storage::get_boolean_flag_value( + *flag_value_file_, + boolean_start_index_ + {item.flag_offset}); + + if (!value.ok()) \{ + ALOGE("error: failed to read flag value: %s", value.error().c_str()); + } + + cache_[{item.readwrite_idx}] = *value; + } else \{ + cache_[{item.readwrite_idx}] = server_configurable_flags::GetServerConfigurableFlag( + "aconfig_flags.{item.device_config_namespace}", + "{item.device_config_flag}", + "{item.default_value}") == "true"; + } + {{ -else- }} cache_[{item.readwrite_idx}] = server_configurable_flags::GetServerConfigurableFlag( "aconfig_flags.{item.device_config_namespace}", "{item.device_config_flag}", "{item.default_value}") == "true"; - } - - - {{ if allow_instrumentation- }} - if (read_from_new_storage_) \{ - if (!flag_value_file_) \{ - ALOGI("error: failed to get flag {item.flag_name}: flag value file is null"); - return cache_[{item.readwrite_idx}]; - } - - auto value = aconfig_storage::get_boolean_flag_value( - *flag_value_file_, - boolean_start_index_ + {item.flag_offset}); - - if (!value.ok()) \{ - ALOGI("error: failed to read flag value: %s", value.error().c_str()); - return cache_[{item.readwrite_idx}]; - } - - bool expected_value = cache_[{item.readwrite_idx}]; - if (*value != expected_value) \{ - ALOGI("error: {item.flag_name} value mismatch, new storage value is %s, old storage value is %s", - *value ? "true" : "false", expected_value ? "true" : "false"); - } - - if (use_new_storage_value) \{ - return *value; - } else \{ - return expected_value; - } - } {{ -endif }} - - + } return cache_[{item.readwrite_idx}]; {{ -else }} {{ -if item.is_fixed_read_only }} @@ -189,7 +169,6 @@ namespace {cpp_namespace} \{ std::unique_ptr flag_value_file_; bool read_from_new_storage_; - bool use_new_storage_value; {{ -endif }} {{ -endif }} From f0f939409d0c5a011d74a0130ff74790d416e281 Mon Sep 17 00:00:00 2001 From: Ashutosh Agarwal Date: Wed, 18 Sep 2024 14:24:05 +0000 Subject: [PATCH 4/4] Update core/Makefile to add variable PRODUCT_EXTRA_STUB_LIBRARIES. This allows products to specify additional device-specific stub libraries that should be included in the system_linker_config. This is useful for products that need to include additional stub libraries that are not picked up by Soong automatically. Bug: 361441210 Change-Id: Ia18c476e249ac5b14b43819fa0a4f0059dc620de --- core/Makefile | 2 ++ core/product.mk | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/core/Makefile b/core/Makefile index b0392cdc8b..49b1432266 100644 --- a/core/Makefile +++ b/core/Makefile @@ -3511,6 +3511,8 @@ $(SYSTEM_LINKER_CONFIG): $(INTERNAL_SYSTEMIMAGE_FILES) $(SYSTEM_LINKER_CONFIG_SO --output $@ --value "$(STUB_LIBRARIES)" --system "$(TARGET_OUT)" $(HOST_OUT_EXECUTABLES)/conv_linker_config append --source $@ --output $@ --key requireLibs \ --value "$(foreach lib,$(LLNDK_MOVED_TO_APEX_LIBRARIES), $(lib).so)" + $(HOST_OUT_EXECUTABLES)/conv_linker_config append --source $@ --output $@ --key provideLibs \ + --value "$(foreach lib,$(PRODUCT_EXTRA_STUB_LIBRARIES), $(lib).so)" $(call declare-1p-target,$(SYSTEM_LINKER_CONFIG),) $(call declare-license-deps,$(SYSTEM_LINKER_CONFIG),$(INTERNAL_SYSTEMIMAGE_FILES) $(SYSTEM_LINKER_CONFIG_SOURCE)) diff --git a/core/product.mk b/core/product.mk index 4c23e5dfdd..b07e6e0dc4 100644 --- a/core/product.mk +++ b/core/product.mk @@ -499,6 +499,10 @@ _product_single_value_vars += PRODUCT_BUILD_APPS_WITH_BUILD_NUMBER # If set, build would generate system image from Soong-defined module. _product_single_value_vars += PRODUCT_SOONG_DEFINED_SYSTEM_IMAGE +# List of stub libraries specific to the product that are already present in the system image and +# should be included in the system_linker_config. +_product_list_vars += PRODUCT_EXTRA_STUB_LIBRARIES + .KATI_READONLY := _product_single_value_vars _product_list_vars _product_var_list :=$= $(_product_single_value_vars) $(_product_list_vars)