UpdateManager: UpdateCurrentConnectionAllowed should return kAskMeAgainLater.
This reflects the fact that the restriction is temporary, and that the
update process should not be terminated, therefore is more correct than
returning kFailed.
This also relocates the code that allows user settings to enable update
over a cellular connection, in cases where a policy is active but does
not specify allowed connections.
BUG=chromium:390264
TEST=Unit tests.
Change-Id: Iadfd05ba3c4617a22c69b82232b7802d1ea65504
Reviewed-on: https://chromium-review.googlesource.com/206144
Tested-by: Gilad Arnold <garnold@chromium.org>
Reviewed-by: Gilad Arnold <garnold@chromium.org>
Commit-Queue: Gilad Arnold <garnold@chromium.org>
diff --git a/update_manager/chromeos_policy.cc b/update_manager/chromeos_policy.cc
index 5273ea4..8a2e2c2 100644
--- a/update_manager/chromeos_policy.cc
+++ b/update_manager/chromeos_policy.cc
@@ -358,7 +358,6 @@
return EvalStatus::kSucceeded;
// Check whether the device policy specifically allows this connection.
- bool user_settings_can_override = false;
if (device_policy_can_override) {
DevicePolicyProvider* const dp_provider = state->device_policy_provider();
const bool* device_policy_is_loaded_p = ec->GetValue(
@@ -371,23 +370,18 @@
*result = true;
return EvalStatus::kSucceeded;
}
- } else {
- user_settings_can_override = true;
+ } else if (conn_type == ConnectionType::kCellular) {
+ // Local user settings can allow updates over cellular iff a policy was
+ // loaded but no allowed connections were specified in it.
+ const bool* update_over_cellular_allowed_p = ec->GetValue(
+ state->updater_provider()->var_cellular_enabled());
+ if (update_over_cellular_allowed_p && *update_over_cellular_allowed_p)
+ *result = true;
}
}
}
- // Local user settings can allow updates iff a policy was loaded but no
- // allowed connections were specified in it. In all other cases, we either
- // stick with the default or use the values determined by the policy.
- if (user_settings_can_override) {
- const bool* update_over_cellular_allowed_p = ec->GetValue(
- state->updater_provider()->var_cellular_enabled());
- if (update_over_cellular_allowed_p && *update_over_cellular_allowed_p)
- *result = true;
- }
-
- return EvalStatus::kSucceeded;
+ return (*result ? EvalStatus::kSucceeded : EvalStatus::kAskMeAgainLater);
}
EvalStatus ChromeOSPolicy::NextUpdateCheckTime(EvaluationContext* ec,