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 <[email protected]>
Reviewed-by: Jay Srinivasan <[email protected]>
Tested-by: Jay Srinivasan <[email protected]>
diff --git a/prefs.cc b/prefs.cc
index cb6e4f7..1388817 100644
--- a/prefs.cc
+++ b/prefs.cc
@@ -45,6 +45,7 @@
FilePath filename;
TEST_AND_RETURN_FALSE(GetFileNameForKey(key, &filename));
if (!file_util::ReadFileToString(filename, value)) {
+ LOG(INFO) << key << " not present in " << prefs_dir_.value();
return false;
}
return true;
@@ -62,7 +63,8 @@
bool Prefs::GetInt64(const string& key, int64_t* value) {
string str_value;
- TEST_AND_RETURN_FALSE(GetString(key, &str_value));
+ if (!GetString(key, &str_value))
+ return false;
TrimWhitespaceASCII(str_value, TRIM_ALL, &str_value);
TEST_AND_RETURN_FALSE(base::StringToInt64(str_value, value));
return true;