odrefresh: Ignore some system properties.
Some power management component is changing dalvik.vm.dex2oat-threads at
runtime. Checking that system property causes odsign_e2e_tests to fail
because the values don't live across reboots.
Bug: 245440100
Test: See ignored system properties no longer exist in cache-info.xml
Change-Id: Ia0408a1f9492cb98576012da156af945178dae5e
diff --git a/odrefresh/odr_config.h b/odrefresh/odr_config.h
index 7a88a1c..b262130 100644
--- a/odrefresh/odr_config.h
+++ b/odrefresh/odr_config.h
@@ -21,6 +21,7 @@
#include <optional>
#include <string>
#include <unordered_map>
+#include <unordered_set>
#include <vector>
#include "android-base/file.h"
@@ -40,6 +41,17 @@
// everything if any property matching a prefix changes.
constexpr const char* kCheckedSystemPropertyPrefixes[]{"dalvik.vm.", "ro.dalvik.vm."};
+// The list of system properties that odrefresh ignores. They don't affect compilation results.
+const std::unordered_set<std::string> kIgnoredSystemProperties{
+ "dalvik.vm.dex2oat-cpu-set",
+ "dalvik.vm.dex2oat-threads",
+ "dalvik.vm.boot-dex2oat-cpu-set",
+ "dalvik.vm.boot-dex2oat-threads",
+ "dalvik.vm.restore-dex2oat-cpu-set",
+ "dalvik.vm.restore-dex2oat-threads",
+ "dalvik.vm.background-dex2oat-cpu-set",
+ "dalvik.vm.background-dex2oat-threads"};
+
struct SystemPropertyConfig {
const char* name;
const char* default_value;
diff --git a/odrefresh/odrefresh_main.cc b/odrefresh/odrefresh_main.cc
index 6505c51..c85115c 100644
--- a/odrefresh/odrefresh_main.cc
+++ b/odrefresh/odrefresh_main.cc
@@ -26,6 +26,7 @@
#include "arch/instruction_set.h"
#include "base/file_utils.h"
#include "base/globals.h"
+#include "base/stl_util.h"
#include "odr_common.h"
#include "odr_compilation_log.h"
#include "odr_config.h"
@@ -40,6 +41,7 @@
using ::art::odrefresh::CompilationOptions;
using ::art::odrefresh::ExitCode;
using ::art::odrefresh::kCheckedSystemPropertyPrefixes;
+using ::art::odrefresh::kIgnoredSystemProperties;
using ::art::odrefresh::kSystemProperties;
using ::art::odrefresh::OdrCompilationLog;
using ::art::odrefresh::OdrConfig;
@@ -197,7 +199,7 @@
return;
}
for (const char* prefix : kCheckedSystemPropertyPrefixes) {
- if (StartsWith(name, prefix)) {
+ if (StartsWith(name, prefix) && !art::ContainsElement(kIgnoredSystemProperties, name)) {
(*system_properties)[name] = value;
}
}