From 98967539fda520e6003baf80feba4cc1f1364d6e Mon Sep 17 00:00:00 2001
From: Kurt Partridge <kep@google.com>
Date: Thu, 9 Aug 2012 12:24:24 -0700
Subject: [PATCH] ResearchLogging of segments: groups of LogUnits that are
 sampled together

Change-Id: Id68de4c6b2df574a38bb5ca800a9b641b1d78200
---
 .../inputmethod/research/ResearchLogger.java    | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/java/src/com/android/inputmethod/research/ResearchLogger.java b/java/src/com/android/inputmethod/research/ResearchLogger.java
index 6295abe8c3..bae34340f9 100644
--- a/java/src/com/android/inputmethod/research/ResearchLogger.java
+++ b/java/src/com/android/inputmethod/research/ResearchLogger.java
@@ -706,12 +706,29 @@ public class ResearchLogger implements SharedPreferences.OnSharedPreferenceChang
         }
     }
 
+    private static final String[] EVENTKEYS_LOG_SEGMENT_START = {
+        "logSegmentStart", "isIncludingPrivateData"
+    };
+    private static final String[] EVENTKEYS_LOG_SEGMENT_END = {
+        "logSegmentEnd"
+    };
     /* package for test */ void publishLogBuffer(final LogBuffer logBuffer,
             final ResearchLog researchLog, final boolean isIncludingPrivateData) {
+        final LogUnit openingLogUnit = new LogUnit();
+        final Object[] values = {
+            isIncludingPrivateData
+        };
+        openingLogUnit.addLogStatement(EVENTKEYS_LOG_SEGMENT_START, values,
+                false /* isPotentiallyPrivate */);
+        researchLog.publish(openingLogUnit, true /* isIncludingPrivateData */);
         LogUnit logUnit;
         while ((logUnit = logBuffer.shiftOut()) != null) {
             researchLog.publish(logUnit, isIncludingPrivateData);
         }
+        final LogUnit closingLogUnit = new LogUnit();
+        closingLogUnit.addLogStatement(EVENTKEYS_LOG_SEGMENT_END, EVENTKEYS_NULLVALUES,
+                false /* isPotentiallyPrivate */);
+        researchLog.publish(closingLogUnit, true /* isIncludingPrivateData */);
     }
 
     private boolean hasOnlyLetters(final String word) {
-- 
GitLab