UpdateEngine: removed libstatspull dependency
Bug: 234904116
Test: build & statsd_testdrive
Change-Id: Ia477c7f988dd79f887f49dd0349759a625b44773
diff --git a/Android.bp b/Android.bp
index 9295985..15ba96a 100644
--- a/Android.bp
+++ b/Android.bp
@@ -266,6 +266,34 @@
],
}
+cc_library_static {
+ name: "libstatslog_ue",
+ generated_sources: ["statslog_ue.cpp"],
+ generated_headers: ["statslog_ue.h"],
+ export_generated_headers: ["statslog_ue.h"],
+ shared_libs: [
+ "libstatssocket",
+ ]
+}
+
+genrule {
+ name: "statslog_ue.h",
+ tools: ["stats-log-api-gen"],
+ cmd: "$(location stats-log-api-gen) --header $(genDir)/statslog_ue.h --module update_engine --namespace chromeos_update_engine,statsd",
+ out: [
+ "statslog_ue.h",
+ ],
+}
+
+genrule {
+ name: "statslog_ue.cpp",
+ tools: ["stats-log-api-gen"],
+ cmd: "$(location stats-log-api-gen) --cpp $(genDir)/statslog_ue.cpp --module update_engine --namespace chromeos_update_engine,statsd --importHeader statslog_ue.h",
+ out: [
+ "statslog_ue.cpp",
+ ],
+}
+
// libupdate_engine_boot_control (type: static_library)
// ========================================================
// A BootControl class implementation using Android's HIDL boot_control HAL.
@@ -280,6 +308,7 @@
"libpayload_consumer",
"libsnapshot",
"libsnapshot_cow",
+ "libstatslog_ue",
"libz",
"update_metadata-protos",
],
@@ -287,7 +316,6 @@
"libbootloader_message",
"libhidlbase",
"liblp",
- "libstatslog",
"libutils",
"android.hardware.boot@1.0",
"android.hardware.boot@1.1",
@@ -307,9 +335,7 @@
exclude_static_libs: [
"libfs_mgr_binder",
"libsnapshot",
- ],
- exclude_shared_libs: [
- "libstatslog",
+ "libstatslog_ue"
],
},
},
@@ -349,6 +375,7 @@
"libavb_user",
"libgkiprops",
"libpayload_consumer",
+ "libstatslog_ue",
"libupdate_engine_boot_control",
"libPlatformProperties",
],
@@ -365,7 +392,7 @@
"libupdate_engine_stable-V1-cpp",
"liblog",
"libssl",
- "libstatslog",
+ "libstatssocket",
"libutils",
],
whole_static_libs: [
diff --git a/aosp/cleanup_previous_update_action.cc b/aosp/cleanup_previous_update_action.cc
index bc92221..2aba9bf 100644
--- a/aosp/cleanup_previous_update_action.cc
+++ b/aosp/cleanup_previous_update_action.cc
@@ -25,7 +25,7 @@
#include <base/bind.h>
#ifndef __ANDROID_RECOVERY__
-#include <statslog.h>
+#include <statslog_ue.h>
#endif
#include "update_engine/common/utils.h"
@@ -513,26 +513,26 @@
<< passed_ms.count() << "ms (resumed " << report.resume_count()
<< " times), using " << report.cow_file_size()
<< " bytes of COW image.";
- android::util::stats_write(android::util::SNAPSHOT_MERGE_REPORTED,
- static_cast<int32_t>(report.state()),
- static_cast<int64_t>(passed_ms.count()),
- static_cast<int32_t>(report.resume_count()),
- vab_retrofit,
- static_cast<int64_t>(report.cow_file_size()),
- vab_compression_enabled,
- vab_compression_used,
- report.total_cow_size_bytes(),
- report.estimated_cow_size_bytes(),
- report.boot_complete_time_ms(),
- report.boot_complete_to_merge_start_time_ms(),
- static_cast<int32_t>(report.merge_failure_code()),
- report.source_build_fingerprint().c_str(),
- target_build_fingerprint.c_str(),
- userspace_snapshots_enabled,
- userspace_snapshots_used,
- xor_compression_enabled,
- xor_compression_used,
- iouring_used);
+ statsd::stats_write(statsd::SNAPSHOT_MERGE_REPORTED,
+ static_cast<int32_t>(report.state()),
+ static_cast<int64_t>(passed_ms.count()),
+ static_cast<int32_t>(report.resume_count()),
+ vab_retrofit,
+ static_cast<int64_t>(report.cow_file_size()),
+ vab_compression_enabled,
+ vab_compression_used,
+ report.total_cow_size_bytes(),
+ report.estimated_cow_size_bytes(),
+ report.boot_complete_time_ms(),
+ report.boot_complete_to_merge_start_time_ms(),
+ static_cast<int32_t>(report.merge_failure_code()),
+ report.source_build_fingerprint().c_str(),
+ target_build_fingerprint.c_str(),
+ userspace_snapshots_enabled,
+ userspace_snapshots_used,
+ xor_compression_enabled,
+ xor_compression_used,
+ iouring_used);
#endif
}
diff --git a/aosp/metrics_reporter_android.cc b/aosp/metrics_reporter_android.cc
index a324fab..d974616 100644
--- a/aosp/metrics_reporter_android.cc
+++ b/aosp/metrics_reporter_android.cc
@@ -29,7 +29,7 @@
#include <libdm/dm.h>
#include <liblp/builder.h>
#include <liblp/liblp.h>
-#include <statslog.h>
+#include <statslog_ue.h>
#include "update_engine/common/constants.h"
#include "update_engine/payload_consumer/install_plan.h"
@@ -132,8 +132,8 @@
bool vab_compression_used =
dynamic_partition_control_->UpdateUsesSnapshotCompression();
- android::util::stats_write(
- android::util::UPDATE_ENGINE_UPDATE_ATTEMPT_REPORTED,
+ statsd::stats_write(
+ statsd::UPDATE_ENGINE_UPDATE_ATTEMPT_REPORTED,
attempt_number,
GetStatsdEnumValue(static_cast<int32_t>(payload_type)),
duration.InMinutes(),
@@ -177,17 +177,16 @@
total_bytes_downloaded += num_bytes_downloaded[i] / kNumBytesInOneMiB;
}
- android::util::stats_write(
- android::util::UPDATE_ENGINE_SUCCESSFUL_UPDATE_REPORTED,
- static_cast<int32_t>(attempt_count),
- GetStatsdEnumValue(static_cast<int32_t>(payload_type)),
- static_cast<int32_t>(payload_size_mib),
- static_cast<int32_t>(total_bytes_downloaded),
- static_cast<int32_t>(download_overhead_percentage),
- static_cast<int32_t>(total_duration.InMinutes()),
- static_cast<int32_t>(reboot_count),
- IsHashTreeEnabled(install_plan_),
- IsFECEnabled(install_plan_));
+ statsd::stats_write(statsd::UPDATE_ENGINE_SUCCESSFUL_UPDATE_REPORTED,
+ static_cast<int32_t>(attempt_count),
+ GetStatsdEnumValue(static_cast<int32_t>(payload_type)),
+ static_cast<int32_t>(payload_size_mib),
+ static_cast<int32_t>(total_bytes_downloaded),
+ static_cast<int32_t>(download_overhead_percentage),
+ static_cast<int32_t>(total_duration.InMinutes()),
+ static_cast<int32_t>(reboot_count),
+ IsHashTreeEnabled(install_plan_),
+ IsFECEnabled(install_plan_));
}
void MetricsReporterAndroid::ReportAbnormallyTerminatedUpdateAttemptMetrics() {