Add build fingerprint to system info
Bug: 142858742
Change-Id: I1287ef3f9d869f080b025eb54862b52ae64d3ad0
diff --git a/protos/perfetto/trace/perfetto_trace.proto b/protos/perfetto/trace/perfetto_trace.proto
index c514435..b685262 100644
--- a/protos/perfetto/trace/perfetto_trace.proto
+++ b/protos/perfetto/trace/perfetto_trace.proto
@@ -3530,6 +3530,7 @@
message SystemInfo {
optional Utsname utsname = 1;
+ optional string android_build_fingerprint = 2;
}
// End of protos/perfetto/trace/system_info.proto
diff --git a/protos/perfetto/trace/system_info.proto b/protos/perfetto/trace/system_info.proto
index 28f4763..434061e 100644
--- a/protos/perfetto/trace/system_info.proto
+++ b/protos/perfetto/trace/system_info.proto
@@ -28,4 +28,5 @@
message SystemInfo {
optional Utsname utsname = 1;
+ optional string android_build_fingerprint = 2;
}
diff --git a/src/tracing/core/tracing_service_impl.cc b/src/tracing/core/tracing_service_impl.cc
index 0e3b424..370f3e6 100644
--- a/src/tracing/core/tracing_service_impl.cc
+++ b/src/tracing/core/tracing_service_impl.cc
@@ -2307,8 +2307,8 @@
return;
tracing_session->did_emit_system_info = true;
protozero::HeapBuffered<protos::pbzero::TracePacket> packet;
-#if !PERFETTO_BUILDFLAG(PERFETTO_OS_WIN)
auto* info = packet->set_system_info();
+#if !PERFETTO_BUILDFLAG(PERFETTO_OS_WIN)
struct utsname uname_info;
if (uname(&uname_info) == 0) {
auto* utsname_info = info->set_utsname();
@@ -2317,7 +2317,15 @@
utsname_info->set_machine(uname_info.machine);
utsname_info->set_release(uname_info.release);
}
-#endif
+#endif // !PERFETTO_BUILDFLAG(PERFETTO_OS_WIN)
+#if PERFETTO_BUILDFLAG(PERFETTO_OS_ANDROID)
+ char value[PROP_VALUE_MAX];
+ if (__system_property_get("ro.build.fingerprint", value)) {
+ info->set_android_build_fingerprint(value);
+ } else {
+ PERFETTO_ELOG("Unable to read ro.build.fingerprint");
+ }
+#endif // PERFETTO_BUILDFLAG(PERFETTO_OS_ANDROID)
packet->set_trusted_uid(static_cast<int32_t>(uid_));
packet->set_trusted_packet_sequence_id(kServicePacketSequenceID);
SerializeAndAppendPacket(packets, packet.SerializeAsArray());