update_engine: Use clock and fake clock from SystemState

No need to pass clock and fake clock anywhere anymore. This CL makes it
to just use those objects available from SystemState and
FakeSystemState.

BUG=b:171829801
TEST=cros_workon_make --board reef --test update_engine

Change-Id: I9a3cf6dd2057620c11b862d3317b83489c76f3ca
Reviewed-on: https://chromium-review.googlesource.com/c/aosp/platform/system/update_engine/+/2546625
Tested-by: Amin Hassani <ahassani@chromium.org>
Reviewed-by: Jae Hoon Kim <kimjae@chromium.org>
Commit-Queue: Jae Hoon Kim <kimjae@chromium.org>
diff --git a/update_manager/chromeos_policy_unittest.cc b/update_manager/chromeos_policy_unittest.cc
index 97a4599..5bd416d 100644
--- a/update_manager/chromeos_policy_unittest.cc
+++ b/update_manager/chromeos_policy_unittest.cc
@@ -109,7 +109,7 @@
       curr_time += TimeDelta::FromSeconds(1);
     else
       curr_time -= TimeDelta::FromSeconds(1);
-    fake_clock_.SetWallclockTime(curr_time);
+    fake_clock_->SetWallclockTime(curr_time);
   }
 
   // Sets the policies required for a kiosk app to control Chrome OS version:
@@ -180,7 +180,7 @@
   // case.
   Time next_update_check;
   Time last_checked_time =
-      fake_clock_.GetWallclockTime() + TimeDelta::FromMinutes(1234);
+      fake_clock_->GetWallclockTime() + TimeDelta::FromMinutes(1234);
 
   fake_state_.updater_provider()->var_last_checked_time()->reset(
       new Time(last_checked_time));
@@ -195,7 +195,7 @@
   SetUpDefaultState();
   fake_state_.updater_provider()->var_last_checked_time()->reset(
       new Time(last_checked_time));
-  fake_clock_.SetWallclockTime(next_update_check - TimeDelta::FromSeconds(1));
+  fake_clock_->SetWallclockTime(next_update_check - TimeDelta::FromSeconds(1));
   ExpectPolicyStatus(
       EvalStatus::kAskMeAgainLater, &Policy::UpdateCheckAllowed, &result);
 
@@ -203,7 +203,7 @@
   SetUpDefaultState();
   fake_state_.updater_provider()->var_last_checked_time()->reset(
       new Time(last_checked_time));
-  fake_clock_.SetWallclockTime(next_update_check + TimeDelta::FromSeconds(1));
+  fake_clock_->SetWallclockTime(next_update_check + TimeDelta::FromSeconds(1));
   ExpectPolicyStatus(
       EvalStatus::kSucceeded, &Policy::UpdateCheckAllowed, &result);
   EXPECT_TRUE(result.updates_enabled);
@@ -216,7 +216,7 @@
   // Ensure that update is not allowed even if wait period is satisfied.
   Time next_update_check;
   Time last_checked_time =
-      fake_clock_.GetWallclockTime() + TimeDelta::FromMinutes(1234);
+      fake_clock_->GetWallclockTime() + TimeDelta::FromMinutes(1234);
 
   fake_state_.updater_provider()->var_last_checked_time()->reset(
       new Time(last_checked_time));
@@ -228,7 +228,7 @@
   SetUpDefaultState();
   fake_state_.updater_provider()->var_last_checked_time()->reset(
       new Time(last_checked_time));
-  fake_clock_.SetWallclockTime(next_update_check + TimeDelta::FromSeconds(1));
+  fake_clock_->SetWallclockTime(next_update_check + TimeDelta::FromSeconds(1));
   fake_state_.system_provider()->var_is_oobe_complete()->reset(new bool(false));
 
   UpdateCheckParams result;
@@ -240,7 +240,7 @@
   SetUpDefaultState();
   fake_state_.updater_provider()->var_last_checked_time()->reset(
       new Time(last_checked_time));
-  fake_clock_.SetWallclockTime(next_update_check + TimeDelta::FromSeconds(1));
+  fake_clock_->SetWallclockTime(next_update_check + TimeDelta::FromSeconds(1));
   ExpectPolicyStatus(
       EvalStatus::kSucceeded, &Policy::UpdateCheckAllowed, &result);
   EXPECT_TRUE(result.updates_enabled);
@@ -358,8 +358,8 @@
 
   // After moving the time forward more than the update check interval, it
   // should now allow for update.
-  fake_clock_.SetWallclockTime(fake_clock_.GetWallclockTime() +
-                               TimeDelta::FromSeconds(11));
+  fake_clock_->SetWallclockTime(fake_clock_->GetWallclockTime() +
+                                TimeDelta::FromSeconds(11));
   ExpectPolicyStatus(
       EvalStatus::kSucceeded, &Policy::UpdateCheckAllowed, &result);
 }
@@ -572,7 +572,7 @@
 
   SetUpdateCheckAllowed(false);
 
-  const Time curr_time = fake_clock_.GetWallclockTime();
+  const Time curr_time = fake_clock_->GetWallclockTime();
   UpdateState update_state = GetDefaultUpdateState(TimeDelta::FromSeconds(10));
   update_state.download_errors_max = 1;
   update_state.download_errors.emplace_back(
@@ -602,7 +602,7 @@
 
   SetUpdateCheckAllowed(false);
 
-  const Time curr_time = fake_clock_.GetWallclockTime();
+  const Time curr_time = fake_clock_->GetWallclockTime();
   UpdateState update_state = GetDefaultUpdateState(TimeDelta::FromSeconds(10));
   update_state.download_errors_max = 1;
   update_state.download_errors.emplace_back(
@@ -635,7 +635,7 @@
 
   SetUpdateCheckAllowed(false);
 
-  const Time curr_time = fake_clock_.GetWallclockTime();
+  const Time curr_time = fake_clock_->GetWallclockTime();
   UpdateState update_state = GetDefaultUpdateState(TimeDelta::FromSeconds(10));
   update_state.download_errors_max = 1;
   update_state.download_errors.emplace_back(
@@ -669,7 +669,7 @@
 
   SetUpdateCheckAllowed(false);
 
-  const Time curr_time = fake_clock_.GetWallclockTime();
+  const Time curr_time = fake_clock_->GetWallclockTime();
   UpdateState update_state = GetDefaultUpdateState(TimeDelta::FromSeconds(10));
   update_state.download_errors_max = 1;
   update_state.download_errors.emplace_back(
@@ -702,7 +702,7 @@
 
   SetUpdateCheckAllowed(false);
 
-  const Time curr_time = fake_clock_.GetWallclockTime();
+  const Time curr_time = fake_clock_->GetWallclockTime();
   UpdateState update_state = GetDefaultUpdateState(TimeDelta::FromSeconds(10));
   update_state.download_errors_max = 1;
   update_state.download_errors.emplace_back(
@@ -735,7 +735,7 @@
 
   SetUpdateCheckAllowed(false);
 
-  const Time curr_time = fake_clock_.GetWallclockTime();
+  const Time curr_time = fake_clock_->GetWallclockTime();
   UpdateState update_state = GetDefaultUpdateState(TimeDelta::FromSeconds(10));
   update_state.download_errors_max = 1;
   update_state.download_errors.emplace_back(
@@ -768,7 +768,7 @@
 
   SetUpdateCheckAllowed(false);
 
-  const Time curr_time = fake_clock_.GetWallclockTime();
+  const Time curr_time = fake_clock_->GetWallclockTime();
   UpdateState update_state = GetDefaultUpdateState(TimeDelta::FromSeconds(10));
   update_state.download_errors_max = 1;
   update_state.download_errors.emplace_back(
@@ -1144,7 +1144,7 @@
   UpdateState update_state = GetDefaultUpdateState(TimeDelta::FromMinutes(10));
   update_state.p2p_num_attempts = 1;
   update_state.p2p_first_attempted =
-      fake_clock_.GetWallclockTime() -
+      fake_clock_->GetWallclockTime() -
       TimeDelta::FromSeconds(ChromeOSPolicy::kMaxP2PAttemptsPeriodInSeconds +
                              1);
   UpdateDownloadParams result;
@@ -1218,7 +1218,7 @@
   UpdateState update_state = GetDefaultUpdateState(TimeDelta::FromMinutes(10));
   update_state.num_checks = 5;
   update_state.download_urls.emplace_back("http://another/fake/url/");
-  Time t = fake_clock_.GetWallclockTime() - TimeDelta::FromSeconds(12);
+  Time t = fake_clock_->GetWallclockTime() - TimeDelta::FromSeconds(12);
   for (int i = 0; i < 5; i++) {
     update_state.download_errors.emplace_back(
         0, ErrorCode::kDownloadTransferError, t);
@@ -1247,7 +1247,7 @@
   UpdateState update_state = GetDefaultUpdateState(TimeDelta::FromMinutes(10));
   update_state.num_checks = 10;
   update_state.download_urls.emplace_back("http://another/fake/url/");
-  Time t = fake_clock_.GetWallclockTime() - TimeDelta::FromSeconds(12);
+  Time t = fake_clock_->GetWallclockTime() - TimeDelta::FromSeconds(12);
   for (int i = 0; i < 11; i++) {
     update_state.download_errors.emplace_back(
         0, ErrorCode::kDownloadTransferError, t);
@@ -1279,7 +1279,7 @@
   update_state.download_errors.emplace_back(
       0,
       ErrorCode::kPayloadHashMismatchError,
-      fake_clock_.GetWallclockTime() - TimeDelta::FromSeconds(1));
+      fake_clock_->GetWallclockTime() - TimeDelta::FromSeconds(1));
 
   // Check that the UpdateCanStart returns true.
   UpdateDownloadParams result;
@@ -1308,7 +1308,7 @@
   update_state.download_errors.emplace_back(
       1,
       ErrorCode::kPayloadHashMismatchError,
-      fake_clock_.GetWallclockTime() - TimeDelta::FromSeconds(1));
+      fake_clock_->GetWallclockTime() - TimeDelta::FromSeconds(1));
 
   // Check that the UpdateCanStart returns true.
   UpdateDownloadParams result;
@@ -1443,7 +1443,7 @@
 
   SetUpdateCheckAllowed(false);
 
-  const Time curr_time = fake_clock_.GetWallclockTime();
+  const Time curr_time = fake_clock_->GetWallclockTime();
   UpdateState update_state = GetDefaultUpdateState(TimeDelta::FromSeconds(10));
   update_state.download_errors_max = 1;
   update_state.download_errors.emplace_back(
@@ -1509,7 +1509,7 @@
 
 TEST_F(UmChromeOSPolicyTest,
        UpdateCanBeAppliedForcedUpdatesDisablesTimeRestrictions) {
-  Time curr_time = fake_clock_.GetWallclockTime();
+  Time curr_time = fake_clock_->GetWallclockTime();
   fake_state_.updater_provider()->var_forced_update_requested()->reset(
       new UpdateRequestStatus(UpdateRequestStatus::kInteractive));
   // Should return kAskMeAgainLater when updated are not forced.
@@ -1522,7 +1522,7 @@
 }
 
 TEST_F(UmChromeOSPolicyTest, UpdateCanBeAppliedFailsInDisallowedTime) {
-  Time curr_time = fake_clock_.GetWallclockTime();
+  Time curr_time = fake_clock_->GetWallclockTime();
   TestDisallowedTimeIntervals(
       {WeeklyTimeInterval(
           WeeklyTime::FromTime(curr_time),
@@ -1532,7 +1532,7 @@
 }
 
 TEST_F(UmChromeOSPolicyTest, UpdateCanBeAppliedOutsideDisallowedTime) {
-  Time curr_time = fake_clock_.GetWallclockTime();
+  Time curr_time = fake_clock_->GetWallclockTime();
   TestDisallowedTimeIntervals(
       {WeeklyTimeInterval(
           WeeklyTime::FromTime(curr_time - TimeDelta::FromHours(3)),
@@ -1542,7 +1542,7 @@
 }
 
 TEST_F(UmChromeOSPolicyTest, UpdateCanBeAppliedPassesOnNonKiosk) {
-  Time curr_time = fake_clock_.GetWallclockTime();
+  Time curr_time = fake_clock_->GetWallclockTime();
   TestDisallowedTimeIntervals(
       {WeeklyTimeInterval(
           WeeklyTime::FromTime(curr_time),
diff --git a/update_manager/default_policy.cc b/update_manager/default_policy.cc
index cb9977f..0713e06 100644
--- a/update_manager/default_policy.cc
+++ b/update_manager/default_policy.cc
@@ -14,10 +14,12 @@
 // limitations under the License.
 //
 
+#include "update_engine/common/system_state.h"
 #include "update_engine/update_manager/default_policy.h"
 
 using chromeos_update_engine::ErrorCode;
 using chromeos_update_engine::InstallPlan;
+using chromeos_update_engine::SystemState;
 
 namespace {
 
@@ -31,9 +33,6 @@
 
 namespace chromeos_update_manager {
 
-DefaultPolicy::DefaultPolicy(chromeos_update_engine::ClockInterface* clock)
-    : clock_(clock), aux_state_(new DefaultPolicyState()) {}
-
 EvalStatus DefaultPolicy::UpdateCheckAllowed(EvaluationContext* ec,
                                              State* state,
                                              std::string* error,
@@ -54,8 +53,8 @@
       ec->IsMonotonicTimeGreaterThan(
           aux_state_->last_check_allowed_time() +
           base::TimeDelta::FromSeconds(kCheckIntervalInSeconds))) {
-    if (clock_)
-      aux_state_->set_last_check_allowed_time(clock_->GetMonotonicTime());
+    aux_state_->set_last_check_allowed_time(
+        SystemState::Get()->clock()->GetMonotonicTime());
     return EvalStatus::kSucceeded;
   }
 
diff --git a/update_manager/default_policy.h b/update_manager/default_policy.h
index 006bcb7..c93bb46 100644
--- a/update_manager/default_policy.h
+++ b/update_manager/default_policy.h
@@ -22,7 +22,6 @@
 
 #include <base/time/time.h>
 
-#include "update_engine/common/clock_interface.h"
 #include "update_engine/update_manager/policy.h"
 
 namespace chromeos_update_manager {
@@ -60,9 +59,8 @@
 // actual policy being used by the UpdateManager.
 class DefaultPolicy : public Policy {
  public:
-  explicit DefaultPolicy(chromeos_update_engine::ClockInterface* clock);
-  DefaultPolicy() : DefaultPolicy(nullptr) {}
-  ~DefaultPolicy() override {}
+  DefaultPolicy() : aux_state_(new DefaultPolicyState()) {}
+  ~DefaultPolicy() override = default;
 
   // Policy overrides.
   EvalStatus UpdateCheckAllowed(EvaluationContext* ec,
@@ -99,9 +97,6 @@
   std::string PolicyName() const override { return "DefaultPolicy"; }
 
  private:
-  // A clock interface.
-  chromeos_update_engine::ClockInterface* clock_;
-
   // An auxiliary state object.
   std::unique_ptr<DefaultPolicyState> aux_state_;
 
diff --git a/update_manager/evaluation_context.cc b/update_manager/evaluation_context.cc
index e796fec..b86f41c 100644
--- a/update_manager/evaluation_context.cc
+++ b/update_manager/evaluation_context.cc
@@ -27,6 +27,7 @@
 #include <base/strings/string_util.h>
 #include <base/values.h>
 
+#include "update_engine/common/system_state.h"
 #include "update_engine/common/utils.h"
 
 using base::Callback;
@@ -34,7 +35,7 @@
 using base::Time;
 using base::TimeDelta;
 using brillo::MessageLoop;
-using chromeos_update_engine::ClockInterface;
+using chromeos_update_engine::SystemState;
 using std::string;
 using std::unique_ptr;
 
@@ -65,12 +66,10 @@
 namespace chromeos_update_manager {
 
 EvaluationContext::EvaluationContext(
-    ClockInterface* clock,
     TimeDelta evaluation_timeout,
     TimeDelta expiration_timeout,
     unique_ptr<Callback<void(EvaluationContext*)>> unregister_cb)
-    : clock_(clock),
-      evaluation_timeout_(evaluation_timeout),
+    : evaluation_timeout_(evaluation_timeout),
       expiration_timeout_(expiration_timeout),
       unregister_cb_(std::move(unregister_cb)),
       weak_ptr_factory_(this) {
@@ -98,13 +97,15 @@
 TimeDelta EvaluationContext::RemainingTime(Time monotonic_deadline) const {
   if (monotonic_deadline.is_max())
     return TimeDelta::Max();
-  TimeDelta remaining = monotonic_deadline - clock_->GetMonotonicTime();
+  TimeDelta remaining =
+      monotonic_deadline - SystemState::Get()->clock()->GetMonotonicTime();
   return std::max(remaining, TimeDelta());
 }
 
 Time EvaluationContext::MonotonicDeadline(TimeDelta timeout) {
-  return (timeout.is_max() ? Time::Max()
-                           : clock_->GetMonotonicTime() + timeout);
+  return (timeout.is_max()
+              ? Time::Max()
+              : SystemState::Get()->clock()->GetMonotonicTime() + timeout);
 }
 
 void EvaluationContext::ValueChanged(BaseVariable* var) {
@@ -139,8 +140,9 @@
 }
 
 void EvaluationContext::ResetEvaluation() {
-  evaluation_start_wallclock_ = clock_->GetWallclockTime();
-  evaluation_start_monotonic_ = clock_->GetMonotonicTime();
+  const auto* clock = SystemState::Get()->clock();
+  evaluation_start_wallclock_ = clock->GetWallclockTime();
+  evaluation_start_monotonic_ = clock->GetMonotonicTime();
   reevaluation_time_wallclock_ = Time::Max();
   reevaluation_time_monotonic_ = Time::Max();
   evaluation_monotonic_deadline_ = MonotonicDeadline(evaluation_timeout_);
diff --git a/update_manager/evaluation_context.h b/update_manager/evaluation_context.h
index 5c5b013..3460f2a 100644
--- a/update_manager/evaluation_context.h
+++ b/update_manager/evaluation_context.h
@@ -27,7 +27,6 @@
 #include <base/time/time.h>
 #include <brillo/message_loops/message_loop.h>
 
-#include "update_engine/common/clock_interface.h"
 #include "update_engine/update_manager/boxed_value.h"
 #include "update_engine/update_manager/variable.h"
 
@@ -64,14 +63,11 @@
 class EvaluationContext : private BaseVariable::ObserverInterface {
  public:
   EvaluationContext(
-      chromeos_update_engine::ClockInterface* clock,
       base::TimeDelta evaluation_timeout,
       base::TimeDelta expiration_timeout,
       std::unique_ptr<base::Callback<void(EvaluationContext*)>> unregister_cb);
-  EvaluationContext(chromeos_update_engine::ClockInterface* clock,
-                    base::TimeDelta evaluation_timeout)
+  explicit EvaluationContext(base::TimeDelta evaluation_timeout)
       : EvaluationContext(
-            clock,
             evaluation_timeout,
             base::TimeDelta::Max(),
             std::unique_ptr<base::Callback<void(EvaluationContext*)>>()) {}
@@ -172,9 +168,6 @@
   // Whether the evaluation context has indeed expired.
   bool is_expired_ = false;
 
-  // Pointer to the mockable clock interface;
-  chromeos_update_engine::ClockInterface* const clock_;
-
   // The timestamps when the evaluation of this EvaluationContext started,
   // corresponding to ClockInterface::GetWallclockTime() and
   // ClockInterface::GetMonotonicTime(), respectively. These values are reset
diff --git a/update_manager/evaluation_context_unittest.cc b/update_manager/evaluation_context_unittest.cc
index cd0b2e6..fdb408b 100644
--- a/update_manager/evaluation_context_unittest.cc
+++ b/update_manager/evaluation_context_unittest.cc
@@ -26,6 +26,7 @@
 #include <gtest/gtest.h>
 
 #include "update_engine/common/fake_clock.h"
+#include "update_engine/cros/fake_system_state.h"
 #include "update_engine/update_manager/fake_variable.h"
 #include "update_engine/update_manager/generic_variables.h"
 #include "update_engine/update_manager/mock_variable.h"
@@ -39,6 +40,7 @@
 using brillo::MessageLoopRunMaxIterations;
 using brillo::MessageLoopRunUntil;
 using chromeos_update_engine::FakeClock;
+using chromeos_update_engine::FakeSystemState;
 using std::shared_ptr;
 using std::string;
 using std::unique_ptr;
@@ -88,13 +90,14 @@
 class UmEvaluationContextTest : public ::testing::Test {
  protected:
   void SetUp() override {
+    FakeSystemState::CreateInstance();
+    fake_clock_ = FakeSystemState::Get()->fake_clock();
     loop_.SetAsCurrent();
     // Apr 22, 2009 19:25:00 UTC (this is a random reference point).
-    fake_clock_.SetMonotonicTime(Time::FromTimeT(1240428300));
+    fake_clock_->SetMonotonicTime(Time::FromTimeT(1240428300));
     // Mar 2, 2006 1:23:45 UTC.
-    fake_clock_.SetWallclockTime(Time::FromTimeT(1141262625));
+    fake_clock_->SetWallclockTime(Time::FromTimeT(1141262625));
     eval_ctx_.reset(new EvaluationContext(
-        &fake_clock_,
         default_timeout_,
         default_timeout_,
         unique_ptr<base::Callback<void(EvaluationContext*)>>(nullptr)));
@@ -126,7 +129,7 @@
   TimeDelta default_timeout_ = TimeDelta::FromSeconds(5);
 
   brillo::FakeMessageLoop loop_{nullptr};
-  FakeClock fake_clock_;
+  FakeClock* fake_clock_;
   shared_ptr<EvaluationContext> eval_ctx_;
 
   // FakeVariables used for testing the EvaluationContext. These are required
@@ -365,8 +368,8 @@
 }
 
 TEST_F(UmEvaluationContextTest, TimeoutUpdatesWithMonotonicTime) {
-  fake_clock_.SetMonotonicTime(fake_clock_.GetMonotonicTime() +
-                               TimeDelta::FromSeconds(1));
+  fake_clock_->SetMonotonicTime(fake_clock_->GetMonotonicTime() +
+                                TimeDelta::FromSeconds(1));
 
   TimeDelta timeout = default_timeout_ - TimeDelta::FromSeconds(1);
 
@@ -375,9 +378,9 @@
 }
 
 TEST_F(UmEvaluationContextTest, ResetEvaluationResetsTimesWallclock) {
-  Time cur_time = fake_clock_.GetWallclockTime();
+  Time cur_time = fake_clock_->GetWallclockTime();
   // Advance the time on the clock but don't call ResetEvaluation yet.
-  fake_clock_.SetWallclockTime(cur_time + TimeDelta::FromSeconds(4));
+  fake_clock_->SetWallclockTime(cur_time + TimeDelta::FromSeconds(4));
 
   EXPECT_TRUE(eval_ctx_->IsWallclockTimeGreaterThan(cur_time -
                                                     TimeDelta::FromSeconds(1)));
@@ -387,7 +390,7 @@
   // Call ResetEvaluation now, which should use the new evaluation time.
   eval_ctx_->ResetEvaluation();
 
-  cur_time = fake_clock_.GetWallclockTime();
+  cur_time = fake_clock_->GetWallclockTime();
   EXPECT_TRUE(eval_ctx_->IsWallclockTimeGreaterThan(cur_time -
                                                     TimeDelta::FromSeconds(1)));
   EXPECT_FALSE(eval_ctx_->IsWallclockTimeGreaterThan(cur_time));
@@ -396,9 +399,9 @@
 }
 
 TEST_F(UmEvaluationContextTest, ResetEvaluationResetsTimesMonotonic) {
-  Time cur_time = fake_clock_.GetMonotonicTime();
+  Time cur_time = fake_clock_->GetMonotonicTime();
   // Advance the time on the clock but don't call ResetEvaluation yet.
-  fake_clock_.SetMonotonicTime(cur_time + TimeDelta::FromSeconds(4));
+  fake_clock_->SetMonotonicTime(cur_time + TimeDelta::FromSeconds(4));
 
   EXPECT_TRUE(eval_ctx_->IsMonotonicTimeGreaterThan(cur_time -
                                                     TimeDelta::FromSeconds(1)));
@@ -408,7 +411,7 @@
   // Call ResetEvaluation now, which should use the new evaluation time.
   eval_ctx_->ResetEvaluation();
 
-  cur_time = fake_clock_.GetMonotonicTime();
+  cur_time = fake_clock_->GetMonotonicTime();
   EXPECT_TRUE(eval_ctx_->IsMonotonicTimeGreaterThan(cur_time -
                                                     TimeDelta::FromSeconds(1)));
   EXPECT_FALSE(eval_ctx_->IsMonotonicTimeGreaterThan(cur_time));
@@ -419,7 +422,7 @@
 TEST_F(UmEvaluationContextTest,
        IsWallclockTimeGreaterThanSignalsTriggerReevaluation) {
   EXPECT_FALSE(eval_ctx_->IsWallclockTimeGreaterThan(
-      fake_clock_.GetWallclockTime() + TimeDelta::FromSeconds(1)));
+      fake_clock_->GetWallclockTime() + TimeDelta::FromSeconds(1)));
 
   // The "false" from IsWallclockTimeGreaterThan means that's not that timestamp
   // yet, so this should schedule a callback for when that happens.
@@ -429,7 +432,7 @@
 TEST_F(UmEvaluationContextTest,
        IsMonotonicTimeGreaterThanSignalsTriggerReevaluation) {
   EXPECT_FALSE(eval_ctx_->IsMonotonicTimeGreaterThan(
-      fake_clock_.GetMonotonicTime() + TimeDelta::FromSeconds(1)));
+      fake_clock_->GetMonotonicTime() + TimeDelta::FromSeconds(1)));
 
   // The "false" from IsMonotonicTimeGreaterThan means that's not that timestamp
   // yet, so this should schedule a callback for when that happens.
@@ -441,9 +444,9 @@
   // IsWallclockTimeGreaterThan() should ignore timestamps on the past for
   // reevaluation.
   EXPECT_TRUE(eval_ctx_->IsWallclockTimeGreaterThan(
-      fake_clock_.GetWallclockTime() - TimeDelta::FromSeconds(20)));
+      fake_clock_->GetWallclockTime() - TimeDelta::FromSeconds(20)));
   EXPECT_TRUE(eval_ctx_->IsWallclockTimeGreaterThan(
-      fake_clock_.GetWallclockTime() - TimeDelta::FromSeconds(1)));
+      fake_clock_->GetWallclockTime() - TimeDelta::FromSeconds(1)));
 
   // Callback should not be scheduled.
   EXPECT_FALSE(eval_ctx_->RunOnValueChangeOrTimeout(base::DoNothing()));
@@ -454,9 +457,9 @@
   // IsMonotonicTimeGreaterThan() should ignore timestamps on the past for
   // reevaluation.
   EXPECT_TRUE(eval_ctx_->IsMonotonicTimeGreaterThan(
-      fake_clock_.GetMonotonicTime() - TimeDelta::FromSeconds(20)));
+      fake_clock_->GetMonotonicTime() - TimeDelta::FromSeconds(20)));
   EXPECT_TRUE(eval_ctx_->IsMonotonicTimeGreaterThan(
-      fake_clock_.GetMonotonicTime() - TimeDelta::FromSeconds(1)));
+      fake_clock_->GetMonotonicTime() - TimeDelta::FromSeconds(1)));
 
   // Callback should not be scheduled.
   EXPECT_FALSE(eval_ctx_->RunOnValueChangeOrTimeout(base::DoNothing()));
diff --git a/update_manager/fake_update_manager.h b/update_manager/fake_update_manager.h
index 173b1a9..b880582 100644
--- a/update_manager/fake_update_manager.h
+++ b/update_manager/fake_update_manager.h
@@ -26,13 +26,12 @@
 
 class FakeUpdateManager : public UpdateManager {
  public:
-  explicit FakeUpdateManager(chromeos_update_engine::ClockInterface* clock)
-      : UpdateManager(clock,
-                      base::TimeDelta::FromSeconds(5),
+  FakeUpdateManager()
+      : UpdateManager(base::TimeDelta::FromSeconds(5),
                       base::TimeDelta::FromHours(1),
                       new FakeState()) {
     // The FakeUpdateManager uses a DefaultPolicy.
-    set_policy(new DefaultPolicy(clock));
+    set_policy(new DefaultPolicy());
   }
 
   // UpdateManager overrides.
diff --git a/update_manager/mock_policy.h b/update_manager/mock_policy.h
index 183130f..3c6313f 100644
--- a/update_manager/mock_policy.h
+++ b/update_manager/mock_policy.h
@@ -29,8 +29,7 @@
 // A mocked implementation of Policy.
 class MockPolicy : public Policy {
  public:
-  explicit MockPolicy(chromeos_update_engine::ClockInterface* clock)
-      : default_policy_(clock) {
+  MockPolicy() {
     // We defer to the corresponding DefaultPolicy methods, by default.
     ON_CALL(*this,
             UpdateCheckAllowed(testing::_, testing::_, testing::_, testing::_))
@@ -55,8 +54,6 @@
         .WillByDefault(testing::Invoke(&default_policy_,
                                        &DefaultPolicy::P2PEnabledChanged));
   }
-
-  MockPolicy() : MockPolicy(nullptr) {}
   ~MockPolicy() override {}
 
   // Policy overrides.
diff --git a/update_manager/mock_update_manager.h b/update_manager/mock_update_manager.h
index 07e4689..06e17d8 100644
--- a/update_manager/mock_update_manager.h
+++ b/update_manager/mock_update_manager.h
@@ -28,7 +28,7 @@
 class MockUpdateManager : public UpdateManager {
  public:
   MockUpdateManager()
-      : UpdateManager(nullptr, base::TimeDelta(), base::TimeDelta(), nullptr) {}
+      : UpdateManager(base::TimeDelta(), base::TimeDelta(), nullptr) {}
 
   MOCK_METHOD2(
       AsyncPolicyRequestUpdateCheckAllowed,
diff --git a/update_manager/next_update_check_policy_impl_unittest.cc b/update_manager/next_update_check_policy_impl_unittest.cc
index 58aff66..d80063d 100644
--- a/update_manager/next_update_check_policy_impl_unittest.cc
+++ b/update_manager/next_update_check_policy_impl_unittest.cc
@@ -52,14 +52,14 @@
   // Set the last update time so it'll appear as if this is a first update check
   // in the lifetime of the current updater.
   fake_state_.updater_provider()->var_last_checked_time()->reset(
-      new Time(fake_clock_.GetWallclockTime() - TimeDelta::FromMinutes(10)));
+      new Time(fake_clock_->GetWallclockTime() - TimeDelta::FromMinutes(10)));
 
   CallMethodWithContext(&NextUpdateCheckTimePolicyImpl::NextUpdateCheckTime,
                         &next_update_check,
                         policy_test_constants);
 
-  EXPECT_LE(fake_clock_.GetWallclockTime(), next_update_check);
-  EXPECT_GE(fake_clock_.GetWallclockTime() +
+  EXPECT_LE(fake_clock_->GetWallclockTime(), next_update_check);
+  EXPECT_GE(fake_clock_->GetWallclockTime() +
                 TimeDelta::FromSeconds(
                     policy_test_constants.timeout_initial_interval +
                     policy_test_constants.timeout_regular_fuzz / 2),
@@ -75,12 +75,12 @@
                         &next_update_check,
                         policy_test_constants);
 
-  EXPECT_LE(fake_clock_.GetWallclockTime() +
+  EXPECT_LE(fake_clock_->GetWallclockTime() +
                 TimeDelta::FromSeconds(
                     policy_test_constants.timeout_periodic_interval -
                     policy_test_constants.timeout_regular_fuzz / 2),
             next_update_check);
-  EXPECT_GE(fake_clock_.GetWallclockTime() +
+  EXPECT_GE(fake_clock_->GetWallclockTime() +
                 TimeDelta::FromSeconds(
                     policy_test_constants.timeout_periodic_interval +
                     policy_test_constants.timeout_regular_fuzz / 2),
@@ -103,11 +103,11 @@
 
   int expected_interval = policy_test_constants.timeout_periodic_interval * 4;
   EXPECT_LE(
-      fake_clock_.GetWallclockTime() +
+      fake_clock_->GetWallclockTime() +
           TimeDelta::FromSeconds(expected_interval - expected_interval / 2),
       next_update_check);
   EXPECT_GE(
-      fake_clock_.GetWallclockTime() +
+      fake_clock_->GetWallclockTime() +
           TimeDelta::FromSeconds(expected_interval + expected_interval / 2),
       next_update_check);
 }
@@ -129,10 +129,10 @@
                &next_update_check,
                policy_test_constants);
 
-  EXPECT_LE(fake_clock_.GetWallclockTime() +
+  EXPECT_LE(fake_clock_->GetWallclockTime() +
                 TimeDelta::FromSeconds(kInterval - kInterval / 2),
             next_update_check);
-  EXPECT_GE(fake_clock_.GetWallclockTime() +
+  EXPECT_GE(fake_clock_->GetWallclockTime() +
                 TimeDelta::FromSeconds(kInterval + kInterval / 2),
             next_update_check);
 }
@@ -148,12 +148,12 @@
                &next_update_check,
                policy_test_constants);
 
-  EXPECT_LE(fake_clock_.GetWallclockTime() +
+  EXPECT_LE(fake_clock_->GetWallclockTime() +
                 TimeDelta::FromSeconds(
                     policy_test_constants.timeout_max_backoff_interval -
                     policy_test_constants.timeout_max_backoff_interval / 2),
             next_update_check);
-  EXPECT_GE(fake_clock_.GetWallclockTime() +
+  EXPECT_GE(fake_clock_->GetWallclockTime() +
                 TimeDelta::FromSeconds(
                     policy_test_constants.timeout_max_backoff_interval +
                     policy_test_constants.timeout_max_backoff_interval / 2),
diff --git a/update_manager/policy_test_utils.cc b/update_manager/policy_test_utils.cc
index 653592a..e8961b1 100644
--- a/update_manager/policy_test_utils.cc
+++ b/update_manager/policy_test_utils.cc
@@ -20,11 +20,13 @@
 #include <tuple>
 #include <vector>
 
+#include "update_engine/cros/fake_system_state.h"
 #include "update_engine/update_manager/next_update_check_policy_impl.h"
 
 using base::Time;
 using base::TimeDelta;
 using chromeos_update_engine::ErrorCode;
+using chromeos_update_engine::FakeSystemState;
 using std::string;
 using std::tuple;
 using std::vector;
@@ -33,9 +35,10 @@
 
 void UmPolicyTestBase::SetUp() {
   loop_.SetAsCurrent();
+  FakeSystemState::CreateInstance();
+  fake_clock_ = FakeSystemState::Get()->fake_clock();
   SetUpDefaultClock();
-  eval_ctx_.reset(
-      new EvaluationContext(&fake_clock_, TimeDelta::FromSeconds(5)));
+  eval_ctx_.reset(new EvaluationContext(TimeDelta::FromSeconds(5)));
   SetUpDefaultState();
 }
 
@@ -45,12 +48,12 @@
 
 // Sets the clock to fixed values.
 void UmPolicyTestBase::SetUpDefaultClock() {
-  fake_clock_.SetMonotonicTime(Time::FromInternalValue(12345678L));
-  fake_clock_.SetWallclockTime(Time::FromInternalValue(12345678901234L));
+  fake_clock_->SetMonotonicTime(Time::FromInternalValue(12345678L));
+  fake_clock_->SetWallclockTime(Time::FromInternalValue(12345678901234L));
 }
 
 void UmPolicyTestBase::SetUpDefaultTimeProvider() {
-  Time current_time = fake_clock_.GetWallclockTime();
+  Time current_time = FakeSystemState::Get()->clock()->GetWallclockTime();
   base::Time::Exploded exploded;
   current_time.LocalExplode(&exploded);
   fake_state_.time_provider()->var_curr_hour()->reset(new int(exploded.hour));
@@ -62,9 +65,9 @@
 
 void UmPolicyTestBase::SetUpDefaultState() {
   fake_state_.updater_provider()->var_updater_started_time()->reset(
-      new Time(fake_clock_.GetWallclockTime()));
+      new Time(fake_clock_->GetWallclockTime()));
   fake_state_.updater_provider()->var_last_checked_time()->reset(
-      new Time(fake_clock_.GetWallclockTime()));
+      new Time(fake_clock_->GetWallclockTime()));
   fake_state_.updater_provider()->var_consecutive_failed_update_checks()->reset(
       new unsigned int(0));  // NOLINT(readability/casting)
   fake_state_.updater_provider()->var_server_dictated_poll_interval()->reset(
@@ -79,7 +82,8 @@
 // Returns a default UpdateState structure:
 UpdateState UmPolicyTestBase::GetDefaultUpdateState(
     TimeDelta first_seen_period) {
-  Time first_seen_time = fake_clock_.GetWallclockTime() - first_seen_period;
+  Time first_seen_time =
+      FakeSystemState::Get()->clock()->GetWallclockTime() - first_seen_period;
   UpdateState update_state = UpdateState();
 
   // This is a non-interactive check returning a delta payload, seen for the
diff --git a/update_manager/policy_test_utils.h b/update_manager/policy_test_utils.h
index cd94907..72bd3bc 100644
--- a/update_manager/policy_test_utils.h
+++ b/update_manager/policy_test_utils.h
@@ -91,7 +91,7 @@
   }
 
   brillo::FakeMessageLoop loop_{nullptr};
-  chromeos_update_engine::FakeClock fake_clock_;
+  chromeos_update_engine::FakeClock* fake_clock_;
   FakeState fake_state_;
   std::shared_ptr<EvaluationContext> eval_ctx_;
   std::unique_ptr<Policy> policy_;
diff --git a/update_manager/real_shill_provider.cc b/update_manager/real_shill_provider.cc
index 0144603..4d067fd 100644
--- a/update_manager/real_shill_provider.cc
+++ b/update_manager/real_shill_provider.cc
@@ -24,6 +24,7 @@
 #include <shill/dbus-constants.h>
 #include <shill/dbus-proxies.h>
 
+using chromeos_update_engine::SystemState;
 using chromeos_update_engine::connection_utils::ParseConnectionType;
 using org::chromium::flimflam::ManagerProxyInterface;
 using org::chromium::flimflam::ServiceProxyInterface;
@@ -97,7 +98,8 @@
   bool is_connected =
       (default_service_path_.IsValid() && default_service_path_.value() != "/");
   var_is_connected_.SetValue(is_connected);
-  var_conn_last_changed_.SetValue(clock_->GetWallclockTime());
+  var_conn_last_changed_.SetValue(
+      SystemState::Get()->clock()->GetWallclockTime());
 
   if (!is_connected) {
     var_conn_type_.UnsetValue();
diff --git a/update_manager/real_shill_provider.h b/update_manager/real_shill_provider.h
index baa2cdc..cd53d92 100644
--- a/update_manager/real_shill_provider.h
+++ b/update_manager/real_shill_provider.h
@@ -27,7 +27,7 @@
 #include <base/time/time.h>
 #include <dbus/object_path.h>
 
-#include "update_engine/common/clock_interface.h"
+#include "update_engine/common/system_state.h"
 #include "update_engine/cros/shill_proxy_interface.h"
 #include "update_engine/update_manager/generic_variables.h"
 #include "update_engine/update_manager/shill_provider.h"
@@ -37,9 +37,9 @@
 // ShillProvider concrete implementation.
 class RealShillProvider : public ShillProvider {
  public:
-  RealShillProvider(chromeos_update_engine::ShillProxyInterface* shill_proxy,
-                    chromeos_update_engine::ClockInterface* clock)
-      : shill_proxy_(shill_proxy), clock_(clock) {}
+  explicit RealShillProvider(
+      chromeos_update_engine::ShillProxyInterface* shill_proxy)
+      : shill_proxy_(shill_proxy) {}
 
   ~RealShillProvider() override = default;
 
@@ -81,9 +81,6 @@
   // The mockable interface to access the shill DBus proxies.
   std::unique_ptr<chromeos_update_engine::ShillProxyInterface> shill_proxy_;
 
-  // A clock abstraction (mockable).
-  chromeos_update_engine::ClockInterface* const clock_;
-
   // The provider's variables.
   AsyncCopyVariable<bool> var_is_connected_{"is_connected"};
   AsyncCopyVariable<chromeos_update_engine::ConnectionType> var_conn_type_{
diff --git a/update_manager/real_shill_provider_unittest.cc b/update_manager/real_shill_provider_unittest.cc
index 682c233..9a2d8a8 100644
--- a/update_manager/real_shill_provider_unittest.cc
+++ b/update_manager/real_shill_provider_unittest.cc
@@ -27,17 +27,17 @@
 #include <shill/dbus-proxies.h>
 #include <shill/dbus-proxy-mocks.h>
 
-#include "update_engine/common/fake_clock.h"
 #include "update_engine/common/test_utils.h"
 #include "update_engine/cros/dbus_test_utils.h"
 #include "update_engine/cros/fake_shill_proxy.h"
+#include "update_engine/cros/fake_system_state.h"
 #include "update_engine/update_manager/umtest_utils.h"
 
 using base::Time;
 using base::TimeDelta;
 using chromeos_update_engine::ConnectionTethering;
 using chromeos_update_engine::ConnectionType;
-using chromeos_update_engine::FakeClock;
+using chromeos_update_engine::FakeSystemState;
 using org::chromium::flimflam::ManagerProxyMock;
 using org::chromium::flimflam::ServiceProxyMock;
 using std::unique_ptr;
@@ -63,10 +63,10 @@
  protected:
   // Initialize the RealShillProvider under test.
   void SetUp() override {
-    fake_clock_.SetWallclockTime(InitTime());
+    FakeSystemState::Get()->fake_clock()->SetWallclockTime(InitTime());
     loop_.SetAsCurrent();
     fake_shill_proxy_ = new chromeos_update_engine::FakeShillProxy();
-    provider_.reset(new RealShillProvider(fake_shill_proxy_, &fake_clock_));
+    provider_.reset(new RealShillProvider(fake_shill_proxy_));
 
     ManagerProxyMock* manager_proxy_mock = fake_shill_proxy_->GetManagerProxy();
 
@@ -127,11 +127,12 @@
   void SendDefaultServiceSignal(const std::string& service_path,
                                 Time* conn_change_time_p) {
     const Time conn_change_time = ConnChangedTime();
-    fake_clock_.SetWallclockTime(conn_change_time);
+    FakeSystemState::Get()->fake_clock()->SetWallclockTime(conn_change_time);
     ASSERT_TRUE(manager_property_changed_.IsHandlerRegistered());
     manager_property_changed_.signal_callback().Run(
         shill::kDefaultServiceProperty, dbus::ObjectPath(service_path));
-    fake_clock_.SetWallclockTime(conn_change_time + TimeDelta::FromSeconds(5));
+    FakeSystemState::Get()->fake_clock()->SetWallclockTime(
+        conn_change_time + TimeDelta::FromSeconds(5));
     if (conn_change_time_p)
       *conn_change_time_p = conn_change_time;
   }
@@ -202,7 +203,6 @@
   }
 
   brillo::FakeMessageLoop loop_{nullptr};
-  FakeClock fake_clock_;
   chromeos_update_engine::FakeShillProxy* fake_shill_proxy_;
 
   // The registered signal handler for the signal Manager.PropertyChanged.
diff --git a/update_manager/real_time_provider.cc b/update_manager/real_time_provider.cc
index efd1747..2b71fa0 100644
--- a/update_manager/real_time_provider.cc
+++ b/update_manager/real_time_provider.cc
@@ -20,11 +20,11 @@
 
 #include <base/time/time.h>
 
-#include "update_engine/common/clock_interface.h"
+#include "update_engine/common/system_state.h"
 
 using base::Time;
 using base::TimeDelta;
-using chromeos_update_engine::ClockInterface;
+using chromeos_update_engine::SystemState;
 using std::string;
 
 namespace chromeos_update_manager {
@@ -34,13 +34,13 @@
  public:
   // TODO(garnold) Turn this into an async variable with the needed callback
   // logic for when it value changes.
-  CurrDateVariable(const string& name, ClockInterface* clock)
-      : Variable<Time>(name, TimeDelta::FromHours(1)), clock_(clock) {}
+  explicit CurrDateVariable(const string& name)
+      : Variable<Time>(name, TimeDelta::FromHours(1)) {}
 
  protected:
   virtual const Time* GetValue(TimeDelta /* timeout */, string* /* errmsg */) {
     Time::Exploded now_exp;
-    clock_->GetWallclockTime().LocalExplode(&now_exp);
+    SystemState::Get()->clock()->GetWallclockTime().LocalExplode(&now_exp);
     now_exp.hour = now_exp.minute = now_exp.second = now_exp.millisecond = 0;
     Time* now = new Time();
     bool success = Time::FromLocalExploded(now_exp, now);
@@ -49,8 +49,6 @@
   }
 
  private:
-  ClockInterface* clock_;
-
   DISALLOW_COPY_AND_ASSIGN(CurrDateVariable);
 };
 
@@ -59,44 +57,40 @@
  public:
   // TODO(garnold) Turn this into an async variable with the needed callback
   // logic for when it value changes.
-  CurrHourVariable(const string& name, ClockInterface* clock)
-      : Variable<int>(name, TimeDelta::FromMinutes(5)), clock_(clock) {}
+  explicit CurrHourVariable(const string& name)
+      : Variable<int>(name, TimeDelta::FromMinutes(5)) {}
 
  protected:
   virtual const int* GetValue(TimeDelta /* timeout */, string* /* errmsg */) {
     Time::Exploded exploded;
-    clock_->GetWallclockTime().LocalExplode(&exploded);
+    SystemState::Get()->clock()->GetWallclockTime().LocalExplode(&exploded);
     return new int(exploded.hour);
   }
 
  private:
-  ClockInterface* clock_;
-
   DISALLOW_COPY_AND_ASSIGN(CurrHourVariable);
 };
 
 class CurrMinuteVariable : public Variable<int> {
  public:
-  CurrMinuteVariable(const string& name, ClockInterface* clock)
-      : Variable<int>(name, TimeDelta::FromSeconds(15)), clock_(clock) {}
+  explicit CurrMinuteVariable(const string& name)
+      : Variable<int>(name, TimeDelta::FromSeconds(15)) {}
 
  protected:
   virtual const int* GetValue(TimeDelta /* timeout */, string* /* errmsg */) {
     Time::Exploded exploded;
-    clock_->GetWallclockTime().LocalExplode(&exploded);
+    SystemState::Get()->clock()->GetWallclockTime().LocalExplode(&exploded);
     return new int(exploded.minute);
   }
 
  private:
-  ClockInterface* clock_;
-
   DISALLOW_COPY_AND_ASSIGN(CurrMinuteVariable);
 };
 
 bool RealTimeProvider::Init() {
-  var_curr_date_.reset(new CurrDateVariable("curr_date", clock_));
-  var_curr_hour_.reset(new CurrHourVariable("curr_hour", clock_));
-  var_curr_minute_.reset(new CurrMinuteVariable("curr_minute", clock_));
+  var_curr_date_.reset(new CurrDateVariable("curr_date"));
+  var_curr_hour_.reset(new CurrHourVariable("curr_hour"));
+  var_curr_minute_.reset(new CurrMinuteVariable("curr_minute"));
   return true;
 }
 
diff --git a/update_manager/real_time_provider.h b/update_manager/real_time_provider.h
index 40dab36..58b0fa5 100644
--- a/update_manager/real_time_provider.h
+++ b/update_manager/real_time_provider.h
@@ -21,7 +21,6 @@
 
 #include <base/time/time.h>
 
-#include "update_engine/common/clock_interface.h"
 #include "update_engine/update_manager/time_provider.h"
 
 namespace chromeos_update_manager {
@@ -29,8 +28,7 @@
 // TimeProvider concrete implementation.
 class RealTimeProvider : public TimeProvider {
  public:
-  explicit RealTimeProvider(chromeos_update_engine::ClockInterface* clock)
-      : clock_(clock) {}
+  RealTimeProvider() = default;
 
   // Initializes the provider and returns whether it succeeded.
   bool Init();
@@ -44,9 +42,6 @@
   Variable<int>* var_curr_minute() override { return var_curr_minute_.get(); }
 
  private:
-  // A clock abstraction (fakeable).
-  chromeos_update_engine::ClockInterface* const clock_;
-
   std::unique_ptr<Variable<base::Time>> var_curr_date_;
   std::unique_ptr<Variable<int>> var_curr_hour_;
   std::unique_ptr<Variable<int>> var_curr_minute_;
diff --git a/update_manager/real_time_provider_unittest.cc b/update_manager/real_time_provider_unittest.cc
index ce2a718..f8ed0d2 100644
--- a/update_manager/real_time_provider_unittest.cc
+++ b/update_manager/real_time_provider_unittest.cc
@@ -22,11 +22,11 @@
 #include <base/time/time.h>
 #include <gtest/gtest.h>
 
-#include "update_engine/common/fake_clock.h"
+#include "update_engine/cros/fake_system_state.h"
 #include "update_engine/update_manager/umtest_utils.h"
 
 using base::Time;
-using chromeos_update_engine::FakeClock;
+using chromeos_update_engine::FakeSystemState;
 using std::unique_ptr;
 
 namespace chromeos_update_manager {
@@ -34,8 +34,9 @@
 class UmRealTimeProviderTest : public ::testing::Test {
  protected:
   void SetUp() override {
+    FakeSystemState::CreateInstance();
     // The provider initializes correctly.
-    provider_.reset(new RealTimeProvider(&fake_clock_));
+    provider_.reset(new RealTimeProvider());
     ASSERT_NE(nullptr, provider_.get());
     ASSERT_TRUE(provider_->Init());
   }
@@ -56,7 +57,6 @@
     return time;
   }
 
-  FakeClock fake_clock_;
   unique_ptr<RealTimeProvider> provider_;
 };
 
@@ -71,7 +71,7 @@
   Time expected;
   ignore_result(Time::FromLocalExploded(exploded, &expected));
 
-  fake_clock_.SetWallclockTime(now);
+  FakeSystemState::Get()->fake_clock()->SetWallclockTime(now);
   UmTestUtils::ExpectVariableHasValue(expected, provider_->var_curr_date());
 }
 
@@ -79,7 +79,7 @@
   const Time now = CurrTime();
   Time::Exploded expected;
   now.LocalExplode(&expected);
-  fake_clock_.SetWallclockTime(now);
+  FakeSystemState::Get()->fake_clock()->SetWallclockTime(now);
   UmTestUtils::ExpectVariableHasValue(expected.hour,
                                       provider_->var_curr_hour());
 }
@@ -88,7 +88,7 @@
   const Time now = CurrTime();
   Time::Exploded expected;
   now.LocalExplode(&expected);
-  fake_clock_.SetWallclockTime(now);
+  FakeSystemState::Get()->fake_clock()->SetWallclockTime(now);
   UmTestUtils::ExpectVariableHasValue(expected.minute,
                                       provider_->var_curr_minute());
 }
diff --git a/update_manager/real_updater_provider.cc b/update_manager/real_updater_provider.cc
index 6da30c9..4bc28a9 100644
--- a/update_manager/real_updater_provider.cc
+++ b/update_manager/real_updater_provider.cc
@@ -27,7 +27,6 @@
 #include <update_engine/dbus-constants.h>
 
 #include "update_engine/client_library/include/update_engine/update_status.h"
-#include "update_engine/common/clock_interface.h"
 #include "update_engine/common/prefs.h"
 #include "update_engine/common/system_state.h"
 #include "update_engine/cros/omaha_request_params.h"
@@ -238,7 +237,7 @@
       return nullptr;
     }
 
-    chromeos_update_engine::ClockInterface* clock = SystemState::Get()->clock();
+    const auto* clock = SystemState::Get()->clock();
     Time curr_boottime = clock->GetBootTime();
     if (curr_boottime < update_boottime) {
       if (errmsg)
diff --git a/update_manager/real_updater_provider_unittest.cc b/update_manager/real_updater_provider_unittest.cc
index bde074e..a59a91d 100644
--- a/update_manager/real_updater_provider_unittest.cc
+++ b/update_manager/real_updater_provider_unittest.cc
@@ -23,7 +23,6 @@
 #include <gtest/gtest.h>
 #include <update_engine/dbus-constants.h>
 
-#include "update_engine/common/fake_clock.h"
 #include "update_engine/common/fake_prefs.h"
 #include "update_engine/cros/fake_system_state.h"
 #include "update_engine/cros/mock_update_attempter.h"
@@ -32,7 +31,6 @@
 
 using base::Time;
 using base::TimeDelta;
-using chromeos_update_engine::FakeClock;
 using chromeos_update_engine::FakePrefs;
 using chromeos_update_engine::FakeSystemState;
 using chromeos_update_engine::OmahaRequestParams;
@@ -101,7 +99,6 @@
  protected:
   void SetUp() override {
     FakeSystemState::CreateInstance();
-    fake_clock_ = FakeSystemState::Get()->fake_clock();
     FakeSystemState::Get()->set_prefs(&fake_prefs_);
     provider_.reset(new RealUpdaterProvider());
     // Check that provider initializes correctly.
@@ -120,19 +117,20 @@
     EXPECT_CALL(*FakeSystemState::Get()->mock_update_attempter(),
                 GetBootTimeAtUpdate(_))
         .WillOnce(DoAll(SetArgPointee<0>(kUpdateBootTime), Return(true)));
-    fake_clock_->SetBootTime(kCurrBootTime);
-    fake_clock_->SetWallclockTime(kCurrWallclockTime);
+    FakeSystemState::Get()->fake_clock()->SetBootTime(kCurrBootTime);
+    FakeSystemState::Get()->fake_clock()->SetWallclockTime(kCurrWallclockTime);
     return kCurrWallclockTime - kDurationSinceUpdate;
   }
 
-  FakeClock* fake_clock_;  // Short for FakeSystemState::Get()->fake_clock()
   FakePrefs fake_prefs_;
   unique_ptr<RealUpdaterProvider> provider_;
 };
 
 TEST_F(UmRealUpdaterProviderTest, UpdaterStartedTimeIsWallclockTime) {
-  fake_clock_->SetWallclockTime(Time::FromDoubleT(123.456));
-  fake_clock_->SetMonotonicTime(Time::FromDoubleT(456.123));
+  FakeSystemState::Get()->fake_clock()->SetWallclockTime(
+      Time::FromDoubleT(123.456));
+  FakeSystemState::Get()->fake_clock()->SetMonotonicTime(
+      Time::FromDoubleT(456.123));
   // Re-initialize to re-setup the provider under test to use these values.
   provider_.reset(new RealUpdaterProvider());
   ASSERT_TRUE(provider_->Init());
diff --git a/update_manager/state_factory.cc b/update_manager/state_factory.cc
index badbe23..0ab4f7b 100644
--- a/update_manager/state_factory.cc
+++ b/update_manager/state_factory.cc
@@ -23,7 +23,6 @@
 #include <session_manager/dbus-proxies.h>
 #endif  // USE_DBUS
 
-#include "update_engine/common/clock_interface.h"
 #if USE_DBUS
 #include "update_engine/cros/dbus_connection.h"
 #endif  // USE_DBUS
@@ -47,8 +46,6 @@
 State* DefaultStateFactory(
     policy::PolicyProvider* policy_provider,
     org::chromium::KioskAppServiceInterfaceProxyInterface* kiosk_app_proxy) {
-  chromeos_update_engine::ClockInterface* const clock =
-      SystemState::Get()->clock();
   unique_ptr<RealConfigProvider> config_provider(
       new RealConfigProvider(SystemState::Get()->hardware()));
 #if USE_DBUS
@@ -63,12 +60,12 @@
       new RealDevicePolicyProvider(policy_provider));
 #endif  // USE_DBUS
   unique_ptr<RealShillProvider> shill_provider(
-      new RealShillProvider(new chromeos_update_engine::ShillProxy(), clock));
+      new RealShillProvider(new chromeos_update_engine::ShillProxy()));
   unique_ptr<RealRandomProvider> random_provider(new RealRandomProvider());
   unique_ptr<RealSystemProvider> system_provider(
       new RealSystemProvider(kiosk_app_proxy));
 
-  unique_ptr<RealTimeProvider> time_provider(new RealTimeProvider(clock));
+  unique_ptr<RealTimeProvider> time_provider(new RealTimeProvider());
   unique_ptr<RealUpdaterProvider> updater_provider(new RealUpdaterProvider());
 
   if (!(config_provider->Init() && device_policy_provider->Init() &&
diff --git a/update_manager/update_manager-inl.h b/update_manager/update_manager-inl.h
index 550642c..045ecff 100644
--- a/update_manager/update_manager-inl.h
+++ b/update_manager/update_manager-inl.h
@@ -116,7 +116,7 @@
         EvaluationContext*, State*, std::string*, R*, ExpectedArgs...) const,
     R* result,
     ActualArgs... args) {
-  auto ec = std::make_shared<EvaluationContext>(clock_, evaluation_timeout_);
+  auto ec = std::make_shared<EvaluationContext>(evaluation_timeout_);
   // A PolicyRequest always consists on a single evaluation on a new
   // EvaluationContext.
   // IMPORTANT: To ensure that ActualArgs can be converted to ExpectedArgs, we
@@ -138,7 +138,6 @@
         EvaluationContext*, State*, std::string*, R*, ExpectedArgs...) const,
     ActualArgs... args) {
   auto ec = std::make_shared<EvaluationContext>(
-      clock_,
       evaluation_timeout_,
       expiration_timeout_,
       std::unique_ptr<base::Callback<void(EvaluationContext*)>>(
diff --git a/update_manager/update_manager.cc b/update_manager/update_manager.cc
index 2974d7d..dbb6b33 100644
--- a/update_manager/update_manager.cc
+++ b/update_manager/update_manager.cc
@@ -19,14 +19,11 @@
 
 namespace chromeos_update_manager {
 
-UpdateManager::UpdateManager(chromeos_update_engine::ClockInterface* clock,
-                             base::TimeDelta evaluation_timeout,
+UpdateManager::UpdateManager(base::TimeDelta evaluation_timeout,
                              base::TimeDelta expiration_timeout,
                              State* state)
     : policy_(GetSystemPolicy()),
-      default_policy_(clock),
       state_(state),
-      clock_(clock),
       evaluation_timeout_(evaluation_timeout),
       expiration_timeout_(expiration_timeout),
       weak_ptr_factory_(this) {}
diff --git a/update_manager/update_manager.h b/update_manager/update_manager.h
index 8ab61d0..e266b57 100644
--- a/update_manager/update_manager.h
+++ b/update_manager/update_manager.h
@@ -24,7 +24,7 @@
 #include <base/callback.h>
 #include <base/time/time.h>
 
-#include "update_engine/common/clock_interface.h"
+#include "update_engine/common/system_state.h"
 #include "update_engine/update_manager/default_policy.h"
 #include "update_engine/update_manager/evaluation_context.h"
 #include "update_engine/update_manager/policy.h"
@@ -56,8 +56,7 @@
  public:
   // Creates the UpdateManager instance, assuming ownership on the provided
   // |state|.
-  UpdateManager(chromeos_update_engine::ClockInterface* clock,
-                base::TimeDelta evaluation_timeout,
+  UpdateManager(base::TimeDelta evaluation_timeout,
                 base::TimeDelta expiration_timeout,
                 State* state);
 
@@ -162,9 +161,6 @@
   // State Providers.
   std::unique_ptr<State> state_;
 
-  // Pointer to the mockable clock interface;
-  chromeos_update_engine::ClockInterface* clock_;
-
   // Timeout for a policy evaluation.
   const base::TimeDelta evaluation_timeout_;
 
diff --git a/update_manager/update_manager_unittest.cc b/update_manager/update_manager_unittest.cc
index f1a8d17..a02d7ef 100644
--- a/update_manager/update_manager_unittest.cc
+++ b/update_manager/update_manager_unittest.cc
@@ -34,7 +34,7 @@
 #include <gmock/gmock.h>
 #include <gtest/gtest.h>
 
-#include "update_engine/common/fake_clock.h"
+#include "update_engine/cros/fake_system_state.h"
 #include "update_engine/update_manager/default_policy.h"
 #include "update_engine/update_manager/fake_state.h"
 #include "update_engine/update_manager/mock_policy.h"
@@ -48,6 +48,7 @@
 using brillo::MessageLoopRunMaxIterations;
 using chromeos_update_engine::ErrorCode;
 using chromeos_update_engine::FakeClock;
+using chromeos_update_engine::FakeSystemState;
 using std::pair;
 using std::string;
 using std::tuple;
@@ -80,11 +81,10 @@
  protected:
   void SetUp() override {
     loop_.SetAsCurrent();
+    FakeSystemState::CreateInstance();
     fake_state_ = new FakeState();
-    umut_.reset(new UpdateManager(&fake_clock_,
-                                  TimeDelta::FromSeconds(5),
-                                  TimeDelta::FromSeconds(1),
-                                  fake_state_));
+    umut_.reset(new UpdateManager(
+        TimeDelta::FromSeconds(5), TimeDelta::FromSeconds(1), fake_state_));
   }
 
   void TearDown() override { EXPECT_FALSE(loop_.PendingTasks()); }
@@ -92,7 +92,6 @@
   base::SimpleTestClock test_clock_;
   brillo::FakeMessageLoop loop_{&test_clock_};
   FakeState* fake_state_;  // Owned by the umut_.
-  FakeClock fake_clock_;
   unique_ptr<UpdateManager> umut_;
 };
 
@@ -291,13 +290,14 @@
 }
 
 TEST_F(UmUpdateManagerTest, AsyncPolicyRequestTimesOut) {
+  auto* fake_clock = FakeSystemState::Get()->fake_clock();
   // Set up an async policy call to exceed its expiration timeout, make sure
   // that the default policy was not used (no callback) and that evaluation is
   // reattempted.
   int num_called = 0;
   umut_->set_policy(new DelayPolicy(
       0,
-      fake_clock_.GetWallclockTime() + TimeDelta::FromSeconds(3),
+      fake_clock->GetWallclockTime() + TimeDelta::FromSeconds(3),
       &num_called));
 
   vector<pair<EvalStatus, UpdateCheckParams>> calls;
@@ -314,7 +314,7 @@
   // ensure that reevaluation occurred but callback was not invoked (i.e.
   // default policy was not consulted).
   test_clock_.Advance(TimeDelta::FromSeconds(2));
-  fake_clock_.SetWallclockTime(fake_clock_.GetWallclockTime() +
+  fake_clock->SetWallclockTime(fake_clock->GetWallclockTime() +
                                TimeDelta::FromSeconds(2));
   MessageLoopRunMaxIterations(MessageLoop::current(), 10);
   EXPECT_EQ(2, num_called);
@@ -322,7 +322,7 @@
   // Wait for reevaluation due to delay to happen, ensure that it occurs and
   // that the callback is invoked.
   test_clock_.Advance(TimeDelta::FromSeconds(2));
-  fake_clock_.SetWallclockTime(fake_clock_.GetWallclockTime() +
+  fake_clock->SetWallclockTime(fake_clock->GetWallclockTime() +
                                TimeDelta::FromSeconds(2));
   MessageLoopRunMaxIterations(MessageLoop::current(), 10);
   EXPECT_EQ(3, num_called);
diff --git a/update_manager/update_time_restrictions_policy_impl_unittest.cc b/update_manager/update_time_restrictions_policy_impl_unittest.cc
index 74e7f3c..f99a285 100644
--- a/update_manager/update_time_restrictions_policy_impl_unittest.cc
+++ b/update_manager/update_time_restrictions_policy_impl_unittest.cc
@@ -60,7 +60,7 @@
 
     Time time;
     EXPECT_TRUE(Time::FromLocalExploded(exploded, &time));
-    fake_clock_.SetWallclockTime(time);
+    fake_clock_->SetWallclockTime(time);
     SetUpDefaultTimeProvider();
     fake_state_.device_policy_provider()
         ->var_disallowed_time_intervals()