Don't scatter during OOBE or user-initiated update checks.
We need to add logic to disable scattering of downloads if we are in OOBE
or if we're doing a manual update check.
Scheduled checks are already disabled during OOBE, but this extra check
will ensure that any scattering policy (there's a pending work item to get
policy during OOBE) during OOBE will have no effect on the update.
Similarly manual (i.e user-initiated) update checks through
update_engine_client or through Chrome UI should not honor scattering.
That way, this can serve as a simple user-friendly workaround in case
there's any bug in scattering logic that bricks the system by any chance.
BUG=chromeos-31563: Don't scatter during OOBE or manual update checks.
TEST=Updated unit tests. Tested all code paths manually on ZGB and Kaen.
Change-Id: Ib631e560c1f620ca53db79ee59dc66efb27ea83c
Reviewed-on: https://gerrit.chromium.org/gerrit/24564
Commit-Ready: Jay Srinivasan <jaysri@chromium.org>
Reviewed-by: Jay Srinivasan <jaysri@chromium.org>
Tested-by: Jay Srinivasan <jaysri@chromium.org>
diff --git a/main.cc b/main.cc
index fc0319f..213bb7d 100644
--- a/main.cc
+++ b/main.cc
@@ -26,6 +26,7 @@
#include "update_engine/terminator.h"
#include "update_engine/update_attempter.h"
#include "update_engine/update_check_scheduler.h"
+#include "update_engine/utils.h"
extern "C" {
#include "update_engine/update_engine.dbusserver.h"
@@ -181,10 +182,12 @@
// Create the update attempter:
chromeos_update_engine::ConcreteDbusGlib dbus;
+ chromeos_update_engine::RealSystemState real_system_state;
chromeos_update_engine::UpdateAttempter update_attempter(&prefs,
&metrics_lib,
&dbus,
- NULL);
+ NULL,
+ &real_system_state);
// Create the dbus service object:
dbus_g_object_type_install_info(UPDATE_ENGINE_TYPE_SERVICE,
@@ -197,7 +200,8 @@
// Schedule periodic update checks.
chromeos_update_engine::UpdateCheckScheduler scheduler(&update_attempter,
- NULL);
+ NULL,
+ &real_system_state);
scheduler.Run();
// Update boot flags after 45 seconds.