Revert "Add functions to allow update over cellular (including tethered connection)"
This reverts commit 4b0d6032cbb86ce488c03b31936cda31283f97e3.
Bug: 62366504
Test: GmsCore sees the old status code (i.e. UPDATED_NEED_REBOOT == 6).
Change-Id: I9185614a41bd621ad85e7f773b0f96919b0f70d5
diff --git a/connection_manager.cc b/connection_manager.cc
index f0a2c92..f72d9e8 100644
--- a/connection_manager.cc
+++ b/connection_manager.cc
@@ -30,7 +30,6 @@
#include "update_engine/connection_utils.h"
#include "update_engine/shill_proxy.h"
#include "update_engine/system_state.h"
-#include "update_engine/update_attempter.h"
using org::chromium::flimflam::ManagerProxyInterface;
using org::chromium::flimflam::ServiceProxyInterface;
@@ -59,23 +58,15 @@
case ConnectionType::kCellular: {
set<string> allowed_types;
-
const policy::DevicePolicy* device_policy =
system_state_->device_policy();
- // The device_policy is loaded in a lazy way before an update check. Load
- // it now from the libbrillo cache if it wasn't already loaded.
+ // A device_policy is loaded in a lazy way right before an update check,
+ // so the device_policy should be already loaded at this point. If it's
+ // not, return a safe value for this setting.
if (!device_policy) {
- UpdateAttempter* update_attempter = system_state_->update_attempter();
- if (update_attempter) {
- update_attempter->RefreshDevicePolicy();
- device_policy = system_state_->device_policy();
- }
- }
-
- if (!device_policy) {
- LOG(INFO) << "Disabling updates over cellular as device policy "
- "fails to be loaded.";
+ LOG(INFO) << "Disabling updates over cellular networks as there's no "
+ "device policy loaded yet.";
return false;
}
@@ -83,17 +74,38 @@
// The update setting is enforced by the device policy.
if (!ContainsKey(allowed_types, shill::kTypeCellular)) {
- LOG(INFO) << "Disabling updates over cellular per device policy.";
+ LOG(INFO) << "Disabling updates over cellular connection as it's not "
+ "allowed in the device policy.";
return false;
}
LOG(INFO) << "Allowing updates over cellular per device policy.";
- }
+ return true;
+ } else {
+ // There's no update setting in the device policy, using the local user
+ // setting.
+ PrefsInterface* prefs = system_state_->prefs();
- // If there's no update setting in the device policy, we do not check
- // the local user setting here, which should be checked by
- // |OmahaRequestAction| during checking for update.
- return true;
+ if (!prefs || !prefs->Exists(kPrefsUpdateOverCellularPermission)) {
+ LOG(INFO) << "Disabling updates over cellular connection as there's "
+ "no device policy setting nor user preference present.";
+ return false;
+ }
+
+ bool stored_value;
+ if (!prefs->GetBoolean(kPrefsUpdateOverCellularPermission,
+ &stored_value)) {
+ return false;
+ }
+
+ if (!stored_value) {
+ LOG(INFO) << "Disabling updates over cellular connection per user "
+ "setting.";
+ return false;
+ }
+ LOG(INFO) << "Allowing updates over cellular per user setting.";
+ return true;
+ }
}
default:
@@ -108,22 +120,6 @@
}
}
-bool ConnectionManager::IsAllowedConnectionTypesForUpdateSet() const {
- const policy::DevicePolicy* device_policy = system_state_->device_policy();
- if (!device_policy) {
- LOG(INFO) << "There's no device policy loaded yet.";
- return false;
- }
-
- set<string> allowed_types;
- if (!device_policy->GetAllowedConnectionTypesForUpdate(
- &allowed_types)) {
- return false;
- }
-
- return true;
-}
-
bool ConnectionManager::GetConnectionProperties(
ConnectionType* out_type, ConnectionTethering* out_tethering) {
dbus::ObjectPath default_service_path;