From 22f07c13f60654c4cff846b3f17999e719947645 Mon Sep 17 00:00:00 2001 From: Wenzhao Zang Date: Thu, 19 Apr 2018 21:54:15 +0000 Subject: [PATCH] cros: Check True value instead of False in IsStatefulEvent Bug: 832867 Change-Id: Ie93bb1a9aa2ed051c437a56fe9aec25b6b99c60c Reviewed-on: https://chromium-review.googlesource.com/1017540 Commit-Queue: Wenzhao (Colin) Zang Reviewed-by: Roger Tawa Cr-Commit-Position: refs/heads/master@{#552175} --- rlz/chromeos/lib/rlz_value_store_chromeos.cc | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/rlz/chromeos/lib/rlz_value_store_chromeos.cc b/rlz/chromeos/lib/rlz_value_store_chromeos.cc index fea765b997b551..cab3e0c5527054 100644 --- a/rlz/chromeos/lib/rlz_value_store_chromeos.cc +++ b/rlz/chromeos/lib/rlz_value_store_chromeos.cc @@ -291,12 +291,17 @@ bool RlzValueStoreChromeOS::IsStatefulEvent(Product product, if (should_send_rlz_ping_value == chromeos::system::kShouldSendRlzPingValueFalse) { return true; + } else if (should_send_rlz_ping_value != + chromeos::system::kShouldSendRlzPingValueTrue) { + LOG(WARNING) << chromeos::system::kShouldSendRlzPingKey + << " has an unexpected value: " + << should_send_rlz_ping_value << ". Treat it as " + << chromeos::system::kShouldSendRlzPingValueFalse + << " to avoid sending duplicate rlz ping."; + return true; } if (!HasRlzEmbargoEndDatePassed()) return true; - - DCHECK_EQ(should_send_rlz_ping_value, - chromeos::system::kShouldSendRlzPingValueTrue); } else { // If |kShouldSendRlzPingKey| doesn't exist in RW_VPD, treat it in the // same way with the case of |kShouldSendRlzPingValueFalse|. @@ -385,8 +390,8 @@ void RlzValueStoreChromeOS::OnSetRlzPingSent(bool success) { UMA_HISTOGRAM_BOOLEAN("Rlz.SetRlzPingSent", true); } else if (set_rlz_ping_sent_attempts_ >= kMaxRetryCount) { UMA_HISTOGRAM_BOOLEAN("Rlz.SetRlzPingSent", false); - LOG(ERROR) << "Setting |should_send_rlz_ping| to 0 failed after " - << kMaxRetryCount << " attempts"; + LOG(ERROR) << "Setting " << chromeos::system::kShouldSendRlzPingKey + << " failed after " << kMaxRetryCount << " attempts."; } else { SetRlzPingSent(); }