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/Android.bp b/Android.bp
index 8f465f6..e5f8c31 100644
--- a/Android.bp
+++ b/Android.bp
@@ -160,7 +160,6 @@
         "common/subprocess.cc",
         "common/terminator.cc",
         "common/utils.cc",
-        "download_action.cc",
         "payload_consumer/bzip_extent_writer.cc",
         "payload_consumer/cached_file_descriptor.cc",
         "payload_consumer/certificate_parser_android.cc",
@@ -297,6 +296,7 @@
 
     srcs: [
         ":libupdate_engine_aidl",
+        "common/system_state.cc",
         "aosp/binder_service_android.cc",
         "aosp/binder_service_stable_android.cc",
         "aosp/daemon_android.cc",
@@ -306,6 +306,7 @@
         "aosp/network_selector_android.cc",
         "aosp/update_attempter_android.cc",
         "certificate_checker.cc",
+        "download_action.cc",
         "libcurl_http_fetcher.cc",
         "metrics_utils.cc",
         "update_boot_flags_action.cc",
@@ -360,6 +361,8 @@
         "aosp/update_attempter_android.cc",
         "common/metrics_reporter_stub.cc",
         "common/network_selector_stub.cc",
+        "common/system_state.cc",
+        "download_action.cc",
         "metrics_utils.cc",
         "update_boot_flags_action.cc",
         "update_status_utils.cc",
@@ -491,6 +494,8 @@
     host_supported: true,
 
     srcs: [
+        "common/system_state.cc",
+        "download_action.cc",
         "payload_generator/ab_generator.cc",
         "payload_generator/annotated_operation.cc",
         "payload_generator/blob_file_writer.cc",