diff options
author | 2021-02-19 12:04:58 -0800 | |
---|---|---|
committer | 2021-02-23 14:44:35 +0000 | |
commit | b7cb691fb8da124e8a6276a5a7fee47dd0aaa338 (patch) | |
tree | ab145cf22542511fbbe72d522aca623f663a9db7 | |
parent | cedec9db0a9accfdcf5eb695879e0b2caf2c34cb (diff) |
Do not read persist.device_config properties in flags
This was causing permission warnings in dexoptanalyzer. Let's disable
this for now until we can be sure to do it right.
Test: presubmit
Change-Id: I42828857b7db06d6cde47b57c5834ffb02f2f9a6
-rw-r--r-- | libartbase/base/flags.cc | 20 | ||||
-rw-r--r-- | libartbase/base/flags.h | 15 |
2 files changed, 4 insertions, 31 deletions
diff --git a/libartbase/base/flags.cc b/libartbase/base/flags.cc index 68dc78fefa..4320c954a8 100644 --- a/libartbase/base/flags.cc +++ b/libartbase/base/flags.cc @@ -26,7 +26,6 @@ #pragma clang diagnostic error "-Wconversion" namespace { -constexpr const char* kServerConfigurableFlagsPrefix = "persist.device_config.runtime_native_boot."; constexpr const char* kUndefinedValue = "UNSET"; // The various ParseValue functions store the parsed value into *destination. If parsing fails for @@ -72,11 +71,6 @@ Flag<Value>::Flag(const std::string& name, Value default_value) : default_{defau std::replace(command_line_argument_name_.begin(), command_line_argument_name_.end(), '.', '-'); system_property_name_ = "dalvik.vm." + name; - std::string server_setting = name; - std::replace(server_setting.begin(), server_setting.end(), '.', '_'); - std::replace(server_setting.begin(), server_setting.end(), '-', '_'); - server_setting_name_ = kServerConfigurableFlagsPrefix + server_setting; - ALL_FLAGS.push_front(this); } @@ -99,9 +93,6 @@ std::optional<Value> Flag<Value>::GetOptional() { if (!initialized_) { Reload(); } - if (from_server_setting_.has_value()) { - return from_server_setting_.value(); - } if (from_system_property_.has_value()) { return from_system_property_.value(); } @@ -113,17 +104,6 @@ void Flag<Value>::Reload() { initialized_ = true; // Command line argument cannot be reloaded. It must be set during initial command line parsing. - // Check the server-side configuration - from_server_setting_ = std::nullopt; - // Read the device_config setting directly to avoid a dependency on server_configurable_flags. - const std::string server_config = - ::android::base::GetProperty(server_setting_name_, kUndefinedValue); - if (server_config != kUndefinedValue) { - ParseValue(server_config, &from_server_setting_); - // Don't bother checking system properties if we have a server-configured value. - return; - } - // Check system properties from_system_property_ = std::nullopt; const std::string sysprop = ::android::base::GetProperty(system_property_name_, kUndefinedValue); diff --git a/libartbase/base/flags.h b/libartbase/base/flags.h index 66c0b3a785..6dd5898945 100644 --- a/libartbase/base/flags.h +++ b/libartbase/base/flags.h @@ -23,9 +23,8 @@ #include <variant> // This file defines a set of flags that can be used to enable/disable features within ART or -// otherwise tune ART's behavior. Flags can be set through command line options, server side -// configuration, system properties, or default values. This flexibility enables easier development -// and also larger experiments. +// otherwise tune ART's behavior. Flags can be set through command line options, system properties, +// or default values. This flexibility enables easier development and also larger experiments. // // The flags are defined in the Flags struct near the bottom of the file. To define a new flag, add // a Flag field to the struct. Then to read the value of the flag, use gFlag.MyNewFlag(). @@ -70,7 +69,6 @@ class FlagMetaBase { std::string command_line_argument_name_; std::string system_property_name_; - std::string server_setting_name_; virtual FlagValuePointer GetLocation() = 0; }; @@ -99,8 +97,8 @@ class Flag : public FlagBase { // Returns the value of the flag or an empty option if it was not set. std::optional<Value> GetOptional(); - // Reload the server-configured value and system property values. In general this should not be - // used directly, but it can be used to support reloading the value without restarting the device. + // Reload the system property values. In general this should not be used directly, but it can be + // used to support reloading the value without restarting the device. void Reload(); protected: @@ -111,7 +109,6 @@ class Flag : public FlagBase { const Value default_; std::optional<Value> from_command_line_; std::optional<Value> from_system_property_; - std::optional<Value> from_server_setting_; }; // This struct contains the list of ART flags. Flags are parameterized by the type of value they @@ -132,10 +129,6 @@ class Flag : public FlagBase { // // -Xmetrics-write-to-log=true // -// Server Side Configuration: -// -// runtime_native_boot.metrics_write_to_log -// // System Property: // // setprop dalvik.vm.metrics.write-to-log true |