update_engine: Make SystemState accessible from everywhere
SystemState is supposed to be a global context and is used lamost
everywhere. So instead of passing it to functions and keeping multiple
pointers to it, its better to do what we did in dlcservice and make it a
singleton class with a getter that can be get from everywhere.
BUG=b:171829801
TEST=unittests
Change-Id: I3b2de9394b7769b3911195ca52d61dbe49afd4dd
Reviewed-on: https://chromium-review.googlesource.com/c/aosp/platform/system/update_engine/+/2521792
Commit-Queue: Amin Hassani <ahassani@chromium.org>
Tested-by: Amin Hassani <ahassani@chromium.org>
Reviewed-by: Jae Hoon Kim <kimjae@chromium.org>
diff --git a/cros/connection_manager.h b/cros/connection_manager.h
index b1fb961..bb54ff7 100644
--- a/cros/connection_manager.h
+++ b/cros/connection_manager.h
@@ -35,8 +35,7 @@
public:
// Constructs a new ConnectionManager object initialized with the
// given system state.
- ConnectionManager(ShillProxyInterface* shill_proxy,
- SystemState* system_state);
+ explicit ConnectionManager(ShillProxyInterface* shill_proxy);
~ConnectionManager() override = default;
// ConnectionManagerInterface overrides.
@@ -58,9 +57,6 @@
// The mockable interface to access the shill DBus proxies.
std::unique_ptr<ShillProxyInterface> shill_proxy_;
- // The global context for update_engine.
- SystemState* system_state_;
-
DISALLOW_COPY_AND_ASSIGN(ConnectionManager);
};