summaryrefslogtreecommitdiff
path: root/odrefresh/odr_config.h
diff options
context:
space:
mode:
author Jiakai Zhang <jiakaiz@google.com> 2022-05-04 14:34:01 +0100
committer TreeHugger Robot <treehugger-gerrit@google.com> 2022-05-06 17:42:49 +0000
commit45d0881f7444307955b51db5be88c5f890647c5e (patch)
treed7056c8087bda94c183cce4506c24966dd705e26 /odrefresh/odr_config.h
parent36c0cb0ed53420b65dd79c2cfaaf7f4a49e69ba7 (diff)
Re-compile on userfaultfd phenotype flag change.
After this change, odrefresh re-compiles everything when the phenotype flag `runtime_native_boot.enable_uffd_gc` changes. It writes the value of the flag to cache-info.xml for change detection. According to go/platform-experiment-namespaces#namespace-types, the phenotype flag is back by a persistent system property. Therefore, we can directly read the flag from the system property instead of depending on the `server_configurable_flags` library. This behavior is consistent with the existing ART code (particularly, `art::Flag`), which reads other phenotype flags. Bug: 231298279 Test: atest odsign_e2e_tests_full Ignore-AOSP-First: Merge conflict. Will cherry-pick later. Change-Id: I02b70569ecd96d4ded6d2d3be22c34b2c6a4c5b4
Diffstat (limited to 'odrefresh/odr_config.h')
-rw-r--r--odrefresh/odr_config.h23
1 files changed, 23 insertions, 0 deletions
diff --git a/odrefresh/odr_config.h b/odrefresh/odr_config.h
index ec0290ccfe..c3f3c8010a 100644
--- a/odrefresh/odr_config.h
+++ b/odrefresh/odr_config.h
@@ -19,9 +19,11 @@
#include <optional>
#include <string>
+#include <unordered_map>
#include <vector>
#include "android-base/file.h"
+#include "android-base/no_destructor.h"
#include "arch/instruction_set.h"
#include "base/file_utils.h"
#include "base/globals.h"
@@ -32,6 +34,17 @@
namespace art {
namespace odrefresh {
+struct SystemPropertyConfig {
+ const char* name;
+ const char* default_value;
+};
+
+// The system properties that odrefresh keeps track of. Odrefresh will recompile everything if any
+// property changes.
+const android::base::NoDestructor<std::vector<SystemPropertyConfig>> kSystemProperties{
+ {SystemPropertyConfig{.name = "persist.device_config.runtime_native_boot.enable_uffd_gc",
+ .default_value = "false"}}};
+
// An enumeration of the possible zygote configurations on Android.
enum class ZygoteKind : uint8_t {
// 32-bit primary zygote, no secondary zygote.
@@ -66,6 +79,9 @@ class OdrConfig final {
bool compilation_os_mode_ = false;
bool minimal_ = false;
+ // The current values of system properties listed in `kSystemProperties`.
+ std::unordered_map<std::string, std::string> system_properties_;
+
// Staging directory for artifacts. The directory must exist and will be automatically removed
// after compilation. If empty, use the default directory.
std::string staging_dir_;
@@ -148,6 +164,9 @@ class OdrConfig final {
}
bool GetCompilationOsMode() const { return compilation_os_mode_; }
bool GetMinimal() const { return minimal_; }
+ const std::unordered_map<std::string, std::string>& GetSystemProperties() const {
+ return system_properties_;
+ }
void SetApexInfoListFile(const std::string& file_path) { apex_info_list_file_ = file_path; }
void SetArtBinDir(const std::string& art_bin_dir) { art_bin_dir_ = art_bin_dir; }
@@ -199,6 +218,10 @@ class OdrConfig final {
void SetMinimal(bool value) { minimal_ = value; }
+ std::unordered_map<std::string, std::string>* MutableSystemProperties() {
+ return &system_properties_;
+ }
+
private:
// Returns a pair for the possible instruction sets for the configured instruction set
// architecture. The first item is the 32-bit architecture and the second item is the 64-bit