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/common_service.h b/cros/common_service.h
index 6169d9c..2c176c5 100644
--- a/cros/common_service.h
+++ b/cros/common_service.h
@@ -26,7 +26,6 @@
#include <brillo/errors/error.h>
#include "update_engine/client_library/include/update_engine/update_status.h"
-#include "update_engine/common/system_state.h"
namespace chromeos_update_engine {
@@ -38,7 +37,7 @@
// Generic service error.
static const char* const kErrorFailed;
- explicit UpdateEngineService(SystemState* system_state);
+ UpdateEngineService();
virtual ~UpdateEngineService() = default;
// Set flags that influence how updates and checks are performed. These
@@ -160,9 +159,6 @@
// Returns the last UpdateAttempt error.
bool GetLastAttemptError(brillo::ErrorPtr* error,
int32_t* out_last_attempt_error);
-
- private:
- SystemState* system_state_;
};
} // namespace chromeos_update_engine