AU: Skip all automatic update checks if OOBE is not complete.
Right before an automatic update check is initiated, check if OOBE is
complete. If it is, go ahead with the check. Otherwise, skip the check
and schedule a new one as if it is the first one.
BUG=5377
TEST=unit tests, gmerged on device and tried with/without .oobe_completed.
Change-Id: I713e156a176b58a4dd04a01bca340b88277b0361
Review URL: http://codereview.chromium.org/3398018
diff --git a/update_check_scheduler.cc b/update_check_scheduler.cc
index 3d00ff3..7319ec4 100644
--- a/update_check_scheduler.cc
+++ b/update_check_scheduler.cc
@@ -50,6 +50,10 @@
return utils::IsRemovableDevice(utils::RootDevice(utils::BootDevice()));
}
+bool UpdateCheckScheduler::IsOOBEComplete() {
+ return utils::IsOOBEComplete();
+}
+
bool UpdateCheckScheduler::IsOfficialBuild() {
return utils::IsOfficialBuild();
}
@@ -77,7 +81,14 @@
UpdateCheckScheduler* me = reinterpret_cast<UpdateCheckScheduler*>(scheduler);
CHECK(me->scheduled_);
me->scheduled_ = false;
- me->update_attempter_->Update("", "");
+ if (me->IsOOBEComplete()) {
+ me->update_attempter_->Update("", "");
+ } else {
+ // Skips all automatic update checks if the OOBE process is not complete and
+ // schedules a new check as if it is the first one.
+ LOG(WARNING) << "Skipping update check because OOBE is not complete.";
+ me->ScheduleCheck(kTimeoutOnce, kTimeoutRegularFuzz);
+ }
// This check ensures that future update checks will be or are already
// scheduled. The check should never fail. A check failure means that there's
// a bug that will most likely prevent further automatic update checks. It