aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDongzhuo Zhang <dongzhuozhang@google.com>2022-05-26 00:58:11 +0000
committerDongzhuo Zhang <dongzhuozhang@google.com>2022-05-31 22:52:57 +0000
commit16a3c34791322ff3ca6c02ce4dd09695764c96e0 (patch)
treee9ca3739f1d168cd4df2d04447a9892542f851e5
parent399865a8887d89fd831985c292385ed112985b5d (diff)
downloadContactsProvider-16a3c34791322ff3ca6c02ce4dd09695764c96e0.tar.gz
Change the CP2 logging to be correct order. The order of the logging fields must match the one in atoms.proto.
This issue was initially introduced in T, so we need Dr.No approval to get this in T. Bug: b/233950995 Change-Id: Ie9a12bc2539a7eac78c20f02b15302badfed77f1
-rw-r--r--src/com/android/providers/contacts/util/LogUtils.java5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/com/android/providers/contacts/util/LogUtils.java b/src/com/android/providers/contacts/util/LogUtils.java
index 368411c7..23e2b140 100644
--- a/src/com/android/providers/contacts/util/LogUtils.java
+++ b/src/com/android/providers/contacts/util/LogUtils.java
@@ -54,6 +54,9 @@ public class LogUtils {
private static final int STATSD_LOG_ATOM_ID = 301;
+
+ // The write methods must be called in the same order as the order of fields in the
+ // atom (frameworks/proto_logging/stats/atoms.proto) definition.
public static void log(LogFields logFields) {
StatsLog.write(StatsEvent.newBuilder()
.setAtomId(STATSD_LOG_ATOM_ID)
@@ -61,9 +64,9 @@ public class LogUtils {
.writeInt(logFields.getUriType())
.writeInt(getCallerType(logFields.isCallerIsSyncAdapter()))
.writeInt(getResultType(logFields.getException()))
- .writeInt(logFields.getTaskType())
.writeInt(logFields.getResultCount())
.writeLong(getLatencyMicros(logFields.getStartNanos()))
+ .writeInt(logFields.getTaskType())
.usePooledBuffer()
.build());
}