update_engine: Don't require reboot after install.
We don't require a reboot after installing a DLC. Instead just set
Update Engine's status to idle.
BUG=chromium:907205,chromium:907632
TEST=Attempt a DLC install, UE no longer prompts for a reboot.
Change-Id: I4fba804ba8b62b8e781279c988aba0e1f21fe3cf
Reviewed-on: https://chromium-review.googlesource.com/1344916
Commit-Ready: Colin Howes <chowes@google.com>
Tested-by: Colin Howes <chowes@google.com>
Reviewed-by: Amin Hassani <ahassani@chromium.org>
diff --git a/update_attempter.cc b/update_attempter.cc
index f47a63e..7bb44cc 100644
--- a/update_attempter.cc
+++ b/update_attempter.cc
@@ -1049,6 +1049,13 @@
system_state_->payload_state()->SetStagingWaitPeriod(TimeDelta());
prefs_->Delete(kPrefsUpdateFirstSeenAt);
+ if (is_install_) {
+ LOG(INFO) << "DLC successfully installed, no reboot needed.";
+ SetStatusAndNotify(UpdateStatus::IDLE);
+ ScheduleUpdates();
+ return;
+ }
+
SetStatusAndNotify(UpdateStatus::UPDATED_NEED_REBOOT);
ScheduleUpdates();
LOG(INFO) << "Update successfully applied, waiting to reboot.";
diff --git a/update_attempter.h b/update_attempter.h
index 07a66b9..876d0fe 100644
--- a/update_attempter.h
+++ b/update_attempter.h
@@ -271,6 +271,7 @@
FRIEND_TEST(UpdateAttempterTest, CreatePendingErrorEventResumedTest);
FRIEND_TEST(UpdateAttempterTest, DisableDeltaUpdateIfNeededTest);
FRIEND_TEST(UpdateAttempterTest, DownloadProgressAccumulationTest);
+ FRIEND_TEST(UpdateAttempterTest, InstallSetsStatusIdle);
FRIEND_TEST(UpdateAttempterTest, MarkDeltaUpdateFailureTest);
FRIEND_TEST(UpdateAttempterTest, PingOmahaTest);
FRIEND_TEST(UpdateAttempterTest, ReportDailyMetrics);
diff --git a/update_attempter_unittest.cc b/update_attempter_unittest.cc
index a395e1b..877396e 100644
--- a/update_attempter_unittest.cc
+++ b/update_attempter_unittest.cc
@@ -1216,6 +1216,17 @@
EXPECT_EQ("", attempter_.forced_omaha_url());
}
+TEST_F(UpdateAttempterTest, InstallSetsStatusIdle) {
+ attempter_.CheckForInstall({}, "http://foo.bar");
+ attempter_.status_ = UpdateStatus::DOWNLOADING;
+ EXPECT_TRUE(attempter_.is_install_);
+ attempter_.ProcessingDone(nullptr, ErrorCode::kSuccess);
+ UpdateEngineStatus status;
+ attempter_.GetStatus(&status);
+ // Should set status to idle after an install operation.
+ EXPECT_EQ(UpdateStatus::IDLE, status.status);
+}
+
TEST_F(UpdateAttempterTest, TargetVersionPrefixSetAndReset) {
attempter_.CalculateUpdateParams("", "", "", "1234", false, false, false);
EXPECT_EQ("1234",