update_engine: Deprecate EOL Status
This is not used anymore. It has been replaced by date based EOL.
It has been deprecated from Chrome per CL:1891467
BUG=chromium:1005511
TEST=sudo FEATURES=test emerge update_engine-client update_engine
Change-Id: I047ca8d641906208728e89adb7c430b71ab11239
Reviewed-on: https://chromium-review.googlesource.com/c/aosp/platform/system/update_engine/+/1891571
Tested-by: Amin Hassani <ahassani@chromium.org>
Commit-Queue: Amin Hassani <ahassani@chromium.org>
Reviewed-by: Jae Hoon Kim <kimjae@chromium.org>
diff --git a/UpdateEngine.conf b/UpdateEngine.conf
index 42f73fc..e01c673 100644
--- a/UpdateEngine.conf
+++ b/UpdateEngine.conf
@@ -84,9 +84,6 @@
<allow send_destination="org.chromium.UpdateEngine"
send_interface="org.chromium.UpdateEngineInterface"
send_member="GetLastAttemptError"/>
- <allow send_destination="org.chromium.UpdateEngine"
- send_interface="org.chromium.UpdateEngineInterface"
- send_member="GetEolStatus"/>
<allow send_interface="org.chromium.UpdateEngineLibcrosProxyResolvedInterface" />
</policy>
<policy user="power">
diff --git a/client_library/client_dbus.cc b/client_library/client_dbus.cc
index d1d6cc0..3497ce0 100644
--- a/client_library/client_dbus.cc
+++ b/client_library/client_dbus.cc
@@ -272,9 +272,5 @@
return proxy_->GetLastAttemptError(last_attempt_error, nullptr);
}
-bool DBusUpdateEngineClient::GetEolStatus(int32_t* eol_status) const {
- return proxy_->GetEolStatus(eol_status, nullptr);
-}
-
} // namespace internal
} // namespace update_engine
diff --git a/client_library/client_dbus.h b/client_library/client_dbus.h
index c9631cf..e964399 100644
--- a/client_library/client_dbus.h
+++ b/client_library/client_dbus.h
@@ -85,8 +85,6 @@
bool GetLastAttemptError(int32_t* last_attempt_error) const override;
- bool GetEolStatus(int32_t* eol_status) const override;
-
private:
void DBusStatusHandlersRegistered(const std::string& interface,
const std::string& signal_name,
diff --git a/client_library/include/update_engine/client.h b/client_library/include/update_engine/client.h
index 89f36af..1a0461c 100644
--- a/client_library/include/update_engine/client.h
+++ b/client_library/include/update_engine/client.h
@@ -135,9 +135,6 @@
// Get the last UpdateAttempt error code.
virtual bool GetLastAttemptError(int32_t* last_attempt_error) const = 0;
- // Get the current end-of-life status code. See EolStatus enum for details.
- virtual bool GetEolStatus(int32_t* eol_status) const = 0;
-
protected:
// Use CreateInstance().
UpdateEngineClient() = default;
diff --git a/common/constants.cc b/common/constants.cc
index 64bdf0c..d779dd4 100644
--- a/common/constants.cc
+++ b/common/constants.cc
@@ -56,7 +56,6 @@
const char kPrefsOmahaCohortHint[] = "omaha-cohort-hint";
const char kPrefsOmahaCohortName[] = "omaha-cohort-name";
const char kPrefsOmahaEolDate[] = "omaha-eol-date";
-const char kPrefsOmahaEolStatus[] = "omaha-eol-status";
const char kPrefsP2PEnabled[] = "p2p-enabled";
const char kPrefsP2PFirstAttemptTimestamp[] = "p2p-first-attempt-timestamp";
const char kPrefsP2PNumAttempts[] = "p2p-num-attempts";
diff --git a/common/constants.h b/common/constants.h
index 23c9003..8685f7e 100644
--- a/common/constants.h
+++ b/common/constants.h
@@ -57,7 +57,6 @@
extern const char kPrefsOmahaCohortHint[];
extern const char kPrefsOmahaCohortName[];
extern const char kPrefsOmahaEolDate[];
-extern const char kPrefsOmahaEolStatus[];
extern const char kPrefsP2PEnabled[];
extern const char kPrefsP2PFirstAttemptTimestamp[];
extern const char kPrefsP2PNumAttempts[];
diff --git a/common_service.cc b/common_service.cc
index 0d5ee6d..d520cf1 100644
--- a/common_service.cc
+++ b/common_service.cc
@@ -412,20 +412,4 @@
return true;
}
-bool UpdateEngineService::GetEolStatus(ErrorPtr* error,
- int32_t* out_eol_status) {
- PrefsInterface* prefs = system_state_->prefs();
-
- string str_eol_status;
- if (prefs->Exists(kPrefsOmahaEolStatus) &&
- !prefs->GetString(kPrefsOmahaEolStatus, &str_eol_status)) {
- LogAndSetError(error, FROM_HERE, "Error getting the end-of-life status.");
- return false;
- }
-
- // StringToEolStatus will return kSupported for invalid values.
- *out_eol_status = static_cast<int32_t>(StringToEolStatus(str_eol_status));
- return true;
-}
-
} // namespace chromeos_update_engine
diff --git a/common_service.h b/common_service.h
index f93855d..3349244 100644
--- a/common_service.h
+++ b/common_service.h
@@ -153,10 +153,6 @@
bool GetLastAttemptError(brillo::ErrorPtr* error,
int32_t* out_last_attempt_error);
- // Returns the current end-of-life status of the device. This value is updated
- // on every update check and persisted on disk across reboots.
- bool GetEolStatus(brillo::ErrorPtr* error, int32_t* out_eol_status);
-
private:
SystemState* system_state_;
};
diff --git a/common_service_unittest.cc b/common_service_unittest.cc
index 65202a0..00c4357 100644
--- a/common_service_unittest.cc
+++ b/common_service_unittest.cc
@@ -169,19 +169,4 @@
UpdateEngineService::kErrorFailed));
}
-TEST_F(UpdateEngineServiceTest, GetEolStatusTest) {
- FakePrefs fake_prefs;
- fake_system_state_.set_prefs(&fake_prefs);
- // The default value should be "supported".
- int32_t eol_status = static_cast<int32_t>(EolStatus::kEol);
- EXPECT_TRUE(common_service_.GetEolStatus(&error_, &eol_status));
- EXPECT_EQ(nullptr, error_);
- EXPECT_EQ(EolStatus::kSupported, static_cast<EolStatus>(eol_status));
-
- fake_prefs.SetString(kPrefsOmahaEolStatus, "security-only");
- EXPECT_TRUE(common_service_.GetEolStatus(&error_, &eol_status));
- EXPECT_EQ(nullptr, error_);
- EXPECT_EQ(EolStatus::kSecurityOnly, static_cast<EolStatus>(eol_status));
-}
-
} // namespace chromeos_update_engine
diff --git a/dbus_bindings/org.chromium.UpdateEngineInterface.dbus-xml b/dbus_bindings/org.chromium.UpdateEngineInterface.dbus-xml
index a183147..b9e0a47 100644
--- a/dbus_bindings/org.chromium.UpdateEngineInterface.dbus-xml
+++ b/dbus_bindings/org.chromium.UpdateEngineInterface.dbus-xml
@@ -137,8 +137,5 @@
<method name="GetLastAttemptError">
<arg type="i" name="last_attempt_error" direction="out" />
</method>
- <method name="GetEolStatus">
- <arg type="i" name="eol_status" direction="out" />
- </method>
</interface>
</node>
diff --git a/dbus_service.cc b/dbus_service.cc
index 065fe0c..72e11eb 100644
--- a/dbus_service.cc
+++ b/dbus_service.cc
@@ -213,11 +213,6 @@
return common_->GetLastAttemptError(error, out_last_attempt_error);
}
-bool DBusUpdateEngineService::GetEolStatus(ErrorPtr* error,
- int32_t* out_eol_status) {
- return common_->GetEolStatus(error, out_eol_status);
-}
-
UpdateEngineAdaptor::UpdateEngineAdaptor(SystemState* system_state)
: org::chromium::UpdateEngineInterfaceAdaptor(&dbus_service_),
bus_(DBusConnection::Get()->GetDBus()),
diff --git a/dbus_service.h b/dbus_service.h
index 2babf8c..4ea1a53 100644
--- a/dbus_service.h
+++ b/dbus_service.h
@@ -157,9 +157,6 @@
bool GetLastAttemptError(brillo::ErrorPtr* error,
int32_t* out_last_attempt_error) override;
- // Returns the current end-of-life status of the device in |out_eol_status|.
- bool GetEolStatus(brillo::ErrorPtr* error, int32_t* out_eol_status) override;
-
private:
std::unique_ptr<UpdateEngineService> common_;
};
diff --git a/omaha_request_action.cc b/omaha_request_action.cc
index 7ca4372..6ebab0d 100644
--- a/omaha_request_action.cc
+++ b/omaha_request_action.cc
@@ -108,7 +108,7 @@
constexpr char kValNoUpdate[] = "noupdate";
// updatecheck attributes (without the underscore prefix).
-constexpr char kAttrEol[] = "eol";
+// Deprecated: "eol"
constexpr char kAttrEolDate[] = "eol_date";
constexpr char kAttrRollback[] = "rollback";
constexpr char kAttrFirmwareVersion[] = "firmware_version";
@@ -699,8 +699,8 @@
}
}
- // Parse the updatecheck attributes.
- PersistEolStatus(parser_data->updatecheck_attrs);
+ PersistEolInfo(parser_data->updatecheck_attrs);
+
// Rollback-related updatecheck attributes.
// Defaults to false if attribute is not present.
output_object->is_rollback =
@@ -1317,30 +1317,16 @@
return true;
}
-bool OmahaRequestAction::PersistEolStatus(const map<string, string>& attrs) {
- bool ret = true;
-
- // Set EOL date.
+bool OmahaRequestAction::PersistEolInfo(const map<string, string>& attrs) {
auto eol_date_attr = attrs.find(kAttrEolDate);
if (eol_date_attr == attrs.end()) {
system_state_->prefs()->Delete(kPrefsOmahaEolDate);
} else if (!system_state_->prefs()->SetString(kPrefsOmahaEolDate,
eol_date_attr->second)) {
LOG(ERROR) << "Setting EOL date failed.";
- ret = false;
+ return false;
}
-
- // Set EOL.
- auto eol_attr = attrs.find(kAttrEol);
- if (eol_attr == attrs.end()) {
- system_state_->prefs()->Delete(kPrefsOmahaEolStatus);
- } else if (!system_state_->prefs()->SetString(kPrefsOmahaEolStatus,
- eol_attr->second)) {
- LOG(ERROR) << "Setting EOL status failed.";
- ret = false;
- }
-
- return ret;
+ return true;
}
void OmahaRequestAction::ActionCompleted(ErrorCode code) {
diff --git a/omaha_request_action.h b/omaha_request_action.h
index 96f09e9..3f66de9 100644
--- a/omaha_request_action.h
+++ b/omaha_request_action.h
@@ -183,11 +183,9 @@
bool PersistCohortData(const std::string& prefs_key,
const std::string& new_value);
- // Parse and persist the end-of-life status flag sent back in the updatecheck
- // tag attributes. In addition, the optional end-of-life date flag will also
- // be parsed and persisted. The flags will be validated and stored in the
- // Prefs.
- bool PersistEolStatus(const std::map<std::string, std::string>& attrs);
+ // Parses and persists the end-of-life date flag sent back in the updatecheck
+ // tag attributes. The flags will be validated and stored in the Prefs.
+ bool PersistEolInfo(const std::map<std::string, std::string>& attrs);
// If this is an update check request, initializes
// |ping_active_days_| and |ping_roll_call_days_| to values that may
diff --git a/omaha_request_action_unittest.cc b/omaha_request_action_unittest.cc
index 94d5152..b66375f 100644
--- a/omaha_request_action_unittest.cc
+++ b/omaha_request_action_unittest.cc
@@ -1992,27 +1992,6 @@
ASSERT_TRUE(TestUpdateCheck());
}
-TEST_F(OmahaRequestActionTest, ParseUpdateCheckAttributesTest) {
- // Test that the "eol" flags is only parsed from the "_eol" attribute and not
- // the "eol" attribute.
- tuc_params_.http_response =
- "<?xml version=\"1.0\" encoding=\"UTF-8\"?><response "
- "protocol=\"3.0\"><app appid=\"foo\" status=\"ok\">"
- "<ping status=\"ok\"/><updatecheck status=\"noupdate\" "
- "_eol=\"security-only\" eol=\"eol\" _foo=\"bar\"/></app></response>";
- tuc_params_.expected_check_result = metrics::CheckResult::kNoUpdateAvailable;
- tuc_params_.expected_check_reaction = metrics::CheckReaction::kUnset;
-
- ASSERT_TRUE(TestUpdateCheck());
-
- string eol_pref;
- EXPECT_TRUE(
- fake_system_state_.prefs()->GetString(kPrefsOmahaEolStatus, &eol_pref));
- // Note that the eol="eol" attribute should be ignored and the _eol should be
- // used instead.
- EXPECT_EQ("security-only", eol_pref);
-}
-
TEST_F(OmahaRequestActionTest, NoUniqueIDTest) {
tuc_params_.http_response = "invalid xml>";
tuc_params_.expected_code = ErrorCode::kOmahaRequestXMLParseError;
@@ -2810,62 +2789,51 @@
EXPECT_EQ(string::npos, post_str.find("requisition"));
}
-TEST_F(OmahaRequestActionTest, PersistEolDatesTest) {
+TEST_F(OmahaRequestActionTest, PersistEolDateTest) {
tuc_params_.http_response =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?><response "
"protocol=\"3.0\"><app appid=\"foo\" status=\"ok\">"
"<ping status=\"ok\"/><updatecheck status=\"noupdate\" "
- "_eol=\"supported\" _eol_date=\"200\" "
+ "_eol_date=\"200\" _foo=\"bar\"/></app></response>";
+ tuc_params_.expected_check_result = metrics::CheckResult::kNoUpdateAvailable;
+ tuc_params_.expected_check_reaction = metrics::CheckReaction::kUnset;
+
+ ASSERT_TRUE(TestUpdateCheck());
+
+ string eol_date;
+ EXPECT_TRUE(
+ fake_system_state_.prefs()->GetString(kPrefsOmahaEolDate, &eol_date));
+ EXPECT_EQ("200", eol_date);
+}
+
+TEST_F(OmahaRequestActionTest, PersistEolMissingDateTest) {
+ tuc_params_.http_response =
+ "<?xml version=\"1.0\" encoding=\"UTF-8\"?><response "
+ "protocol=\"3.0\"><app appid=\"foo\" status=\"ok\">"
+ "<ping status=\"ok\"/><updatecheck status=\"noupdate\" "
"_foo=\"bar\"/></app></response>";
tuc_params_.expected_check_result = metrics::CheckResult::kNoUpdateAvailable;
tuc_params_.expected_check_reaction = metrics::CheckReaction::kUnset;
ASSERT_TRUE(TestUpdateCheck());
- string eol, eol_date;
- EXPECT_TRUE(
- fake_system_state_.prefs()->GetString(kPrefsOmahaEolStatus, &eol));
- EXPECT_EQ(kEolStatusSupported, eol);
- EXPECT_TRUE(
- fake_system_state_.prefs()->GetString(kPrefsOmahaEolDate, &eol_date));
- EXPECT_EQ("200", eol_date);
-}
-
-TEST_F(OmahaRequestActionTest, PersistEolMissingDatesTest) {
- tuc_params_.http_response =
- "<?xml version=\"1.0\" encoding=\"UTF-8\"?><response "
- "protocol=\"3.0\"><app appid=\"foo\" status=\"ok\">"
- "<ping status=\"ok\"/><updatecheck status=\"noupdate\" "
- "_eol=\"supported\" _foo=\"bar\"/></app></response>";
- tuc_params_.expected_check_result = metrics::CheckResult::kNoUpdateAvailable;
- tuc_params_.expected_check_reaction = metrics::CheckReaction::kUnset;
-
- ASSERT_TRUE(TestUpdateCheck());
-
- string eol, eol_date;
- EXPECT_TRUE(
- fake_system_state_.prefs()->GetString(kPrefsOmahaEolStatus, &eol));
- EXPECT_EQ(kEolStatusSupported, eol);
+ string eol_date;
EXPECT_FALSE(
fake_system_state_.prefs()->GetString(kPrefsOmahaEolDate, &eol_date));
}
-TEST_F(OmahaRequestActionTest, PersistEolBadDatesTest) {
+TEST_F(OmahaRequestActionTest, PersistEolBadDateTest) {
tuc_params_.http_response =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?><response "
"protocol=\"3.0\"><app appid=\"foo\" status=\"ok\">"
"<ping status=\"ok\"/><updatecheck status=\"noupdate\" "
- "_eol=\"supported\" _eol_date=\"bad\" "
- "foo=\"bar\"/></app></response>";
+ "_eol_date=\"bad\" foo=\"bar\"/></app></response>";
tuc_params_.expected_check_result = metrics::CheckResult::kNoUpdateAvailable;
tuc_params_.expected_check_reaction = metrics::CheckReaction::kUnset;
ASSERT_TRUE(TestUpdateCheck());
- string eol, eol_date;
- EXPECT_TRUE(
- fake_system_state_.prefs()->GetString(kPrefsOmahaEolStatus, &eol));
- EXPECT_EQ(kEolStatusSupported, eol);
+ string eol_date;
EXPECT_TRUE(
fake_system_state_.prefs()->GetString(kPrefsOmahaEolDate, &eol_date));
EXPECT_EQ(kEolDateInvalid, StringToEolDate(eol_date));
diff --git a/omaha_utils.cc b/omaha_utils.cc
index f9ec85a..18a99ce 100644
--- a/omaha_utils.cc
+++ b/omaha_utils.cc
@@ -21,37 +21,8 @@
namespace chromeos_update_engine {
-const char kEolStatusSupported[] = "supported";
-const char kEolStatusSecurityOnly[] = "security-only";
-const char kEolStatusEol[] = "eol";
-
const EolDate kEolDateInvalid = -9999;
-const char* EolStatusToString(EolStatus eol_status) {
- switch (eol_status) {
- case EolStatus::kSupported:
- return kEolStatusSupported;
- case EolStatus::kSecurityOnly:
- return kEolStatusSecurityOnly;
- case EolStatus::kEol:
- return kEolStatusEol;
- }
- // Only reached if an invalid number is casted to |EolStatus|.
- LOG(WARNING) << "Invalid EolStatus value: " << static_cast<int>(eol_status);
- return kEolStatusSupported;
-}
-
-EolStatus StringToEolStatus(const std::string& eol_status) {
- if (eol_status == kEolStatusSupported || eol_status.empty())
- return EolStatus::kSupported;
- if (eol_status == kEolStatusSecurityOnly)
- return EolStatus::kSecurityOnly;
- if (eol_status == kEolStatusEol)
- return EolStatus::kEol;
- LOG(WARNING) << "Invalid end-of-life attribute: " << eol_status;
- return EolStatus::kSupported;
-}
-
std::string EolDateToString(EolDate eol_date) {
#if BASE_VER < 576279
return base::Int64ToString(eol_date);
diff --git a/omaha_utils.h b/omaha_utils.h
index 128232a..458bf9e 100644
--- a/omaha_utils.h
+++ b/omaha_utils.h
@@ -26,25 +26,6 @@
// |EolDate| indicating an invalid end-of-life date.
extern const EolDate kEolDateInvalid;
-// The possible string values for the end-of-life status.
-extern const char kEolStatusSupported[];
-extern const char kEolStatusSecurityOnly[];
-extern const char kEolStatusEol[];
-
-// The end-of-life status of the device.
-enum class EolStatus {
- kSupported = 0,
- kSecurityOnly,
- kEol,
-};
-
-// Returns the string representation of the |eol_status|.
-const char* EolStatusToString(EolStatus eol_status);
-
-// Converts the end-of-life status string to an EolStatus numeric value. In case
-// of an invalid string, the default "supported" value will be used instead.
-EolStatus StringToEolStatus(const std::string& eol_status);
-
// Returns the string representation of the |eol_date|.
std::string EolDateToString(EolDate eol_date);
diff --git a/omaha_utils_unittest.cc b/omaha_utils_unittest.cc
index ccb9578..849905a 100644
--- a/omaha_utils_unittest.cc
+++ b/omaha_utils_unittest.cc
@@ -23,22 +23,6 @@
class OmahaUtilsTest : public ::testing::Test {};
-TEST(OmahaUtilsTest, EolStatusTest) {
- EXPECT_EQ(EolStatus::kEol, StringToEolStatus("eol"));
-
- // Supported values are converted back and forth properly.
- const std::vector<EolStatus> tests = {
- EolStatus::kSupported, EolStatus::kSecurityOnly, EolStatus::kEol};
- for (EolStatus eol_status : tests) {
- EXPECT_EQ(eol_status, StringToEolStatus(EolStatusToString(eol_status)))
- << "The StringToEolStatus() was " << EolStatusToString(eol_status);
- }
-
- // Invalid values are assumed as "supported".
- EXPECT_EQ(EolStatus::kSupported, StringToEolStatus(""));
- EXPECT_EQ(EolStatus::kSupported, StringToEolStatus("hello, world!"));
-}
-
TEST(OmahaUtilsTest, EolDateTest) {
// Supported values are converted back and forth properly.
const std::vector<EolDate> tests = {kEolDateInvalid, -1, 0, 1};
diff --git a/update_engine_client.cc b/update_engine_client.cc
index 7b5c4df..e78eccf 100644
--- a/update_engine_client.cc
+++ b/update_engine_client.cc
@@ -44,7 +44,6 @@
using brillo::KeyValueStore;
using chromeos_update_engine::EolDate;
using chromeos_update_engine::EolDateToString;
-using chromeos_update_engine::EolStatus;
using chromeos_update_engine::ErrorCode;
using chromeos_update_engine::UpdateEngineStatusToString;
using chromeos_update_engine::UpdateStatusToString;