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/payload_state.h b/cros/payload_state.h
index 0827273..ad19074 100644
--- a/cros/payload_state.h
+++ b/cros/payload_state.h
@@ -48,7 +48,7 @@
// It performs the initial loading of all persisted state into memory and
// dumps the initial state for debugging purposes. Note: the other methods
// should be called only after calling Initialize on this object.
- bool Initialize(SystemState* system_state);
+ bool Initialize();
// Implementation of PayloadStateInterface methods.
void SetResponse(const OmahaResponse& response) override;
@@ -429,9 +429,6 @@
// Get the total size of all payloads.
int64_t GetPayloadSize();
- // The global state of the system.
- SystemState* system_state_;
-
// Interface object with which we read/write persisted state. This must
// be set by calling the Initialize method before calling any other method.
PrefsInterface* prefs_;