Add a version of update engine that does not send stats

update_engine_nostats has the same functionality as the update_engine
but without interaction with statsd libraires and without build
dependency on it.

Test: Apply an upadte to an aosp cf vm - note that merge stats are
      reported in logcat.
      Replace update engine with the nostats service in the product
      packages and apply an update - note that stats reporting is
      skipped.
Bug: 328227527
Change-Id: Iba87119838ecb9bdd8c94f8a913ec0d6e86a26d1
diff --git a/Android.bp b/Android.bp
index 62afe09..4e5f6f5 100644
--- a/Android.bp
+++ b/Android.bp
@@ -422,6 +422,16 @@
 }
 
 cc_library_static {
+    name: "libupdate_engine_boot_control_nostats",
+    cflags: ["-DUE_DISABLE_STATS"],
+    defaults: [
+        "libupdate_engine_boot_control_defaults",
+        "libupdate_engine_boot_control_exports",
+        "libpayload_consumer_exports",
+    ],
+}
+
+cc_library_static {
     name: "libupdate_engine_boot_control_proto-full",
     defaults: [
         "libupdate_engine_boot_control_defaults",
@@ -564,6 +574,43 @@
     init_rc: ["update_engine.rc"],
 }
 
+// update_engine_nostats (type: executable)
+// ========================================================
+// update_engine daemon version without the stats integration.
+cc_binary {
+    name: "update_engine_nostats",
+    defaults: [
+        "ue_defaults",
+        "libupdate_engine_android_exports",
+    ],
+
+    static_libs: [
+        "libupdate_engine_android",
+        "libgflags",
+        "libupdate_engine_boot_control_nostats",
+    ],
+    required: [
+        "cacerts",
+        "otacerts",
+    ],
+
+    exclude_static_libs: [
+        "libstatslog_ue",
+        "libupdate_engine_boot_control"
+    ],
+
+    exclude_shared_libs: [
+        "libstatssocket",
+    ],
+
+    cflags: ["-DUE_DISABLE_STATS"],
+    srcs: [
+        "main.cc",
+        "common/metrics_reporter_stub.cc",
+    ],
+    init_rc: ["update_engine_nostats.rc"],
+}
+
 // update_engine_sideload (type: executable)
 // ========================================================
 // A binary executable equivalent to update_engine daemon that installs an update
@@ -579,7 +626,10 @@
     ],
     recovery: true,
 
-    cflags: ["-D_UE_SIDELOAD"],
+    cflags: [
+        "-D_UE_SIDELOAD",
+        "-DUE_DISABLE_STATS",
+    ],
     header_libs: ["libgtest_prod_headers"],
 
     srcs: [